The Reports API enables creation, retrieval, updating, and deletion of Swiftor reports.
GET /reports
) Returns a summary list of all reports owned by the authenticated user. Note that the full content
and hash
are omitted in this list view.
{
"reports": [
{
"id": "generated-uuid-1",
"reportlabel": "My First Report",
"theme": "dark",
"protected": false,
"date_created": 1678886400000, // Unix timestamp in milliseconds
"last_updated": 1678886405000 // Unix timestamp in milliseconds
},
{
"id": "generated-uuid-2",
"reportlabel": "Another Analysis",
"theme": "light",
"protected": true,
"date_created": 1678886410000,
"last_updated": 1678886410000
}
// ... other reports
]
}
POST /reports
) Creates a new report entry in the database.
{
"label": "New Analysis Report",
"hash": "optional-identifier-hash",
"protected": false,
"theme": "dark",
"logo": "base64_encoded_image_data_or_url",
"content": "Initial report content as a string (can be markdown, HTML, etc.)"
}
label
(string, required): The display name for the report.hash
(string, required): An identifier hash (usage context may vary).protected
(boolean, required): Whether the report requires authentication/password for public access.theme
(string, required): Theme identifier (e.g., "dark", "light").logo
(string, required): Base64 encoded image data or a URL for the report logo.content
(string, optional): The initial content of the report. Defaults to an empty string.Returns the newly created report object, including the generated id
and timestamps.
{
"message": "Report created successfully",
"report": {
"id": "generated-uuid-3",
"user_id": "user-supabase-id",
"reportlabel": "New Analysis Report",
"theme": "dark",
"protected": false,
"hash": "optional-identifier-hash",
"content": "Initial report content...",
"created_at": "2023-03-15T12:00:01.123456+00:00", // ISO 8601 format
"updated_at": "2023-03-15T12:00:01.123456+00:00" // ISO 8601 format
}
}
GET /reports/get/{report_id}
) Retrieves the full details for a specific report, including its content
and hash
.
{report_id}
: The UUID of the report to retrieve.Returns an object where the key is the report ID, and the value contains the report details.
{
"generated-uuid-1": {
"label": "My First Report",
"hash": "optional-identifier-hash",
"theme": "dark",
"protected": false,
"content": "Detailed report content here...",
"date_created": 1678886400000, // Unix timestamp in milliseconds
"last_updated": 1678886405000 // Unix timestamp in milliseconds
}
}
PUT /reports/{report_id}
) Updates only the content
of an existing report and sets its updated_at
timestamp to the current time.
{report_id}
: The UUID of the report to update.{
"content": "Updated report content goes here."
}
content
(string, required): The new content for the report.{
"message": "Report published successfully"
}
DELETE /reports/{report_id}
) Permanently deletes a specific report.
{report_id}
: The UUID of the report to delete.Irreversible Action
Report deletion cannot be undone.
{
"message": "Report deleted successfully"
}