Appearance
Responses
Response format
Cassiopeia supports two response formats: inline base64 or as attachment. The default response format is inline base64.
You can change the response format by setting the respond_with
JSON field to eiter base64
or download
.
Inline base64
This is the default response format or when the respond_with
field is set to base64
.
bash
curl -X POST "https://www.cassiopeia-api.cloud/api/documents" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-d "{\"respond_with\": \"base645\", \"files\": [\"$(base64 -w 0 -i /path/to/your/file)\"]}"
The response will be a JSON object with the base64 encoded PDF:
json
{
"data": {
"pdf": "..."
}
}
As attachment
When response_with
is set to download
, the response will be a content-disposition: attachment
and content-type: application/pdf
to download the file:
bash
curl -X POST "https://www.cassiopeia-api.cloud/api/documents" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-d "{\"respond_with\": \"download\", \"files\": [\"$(base64 -w 0 -i /path/to/your/file)\"]}"
The response will be the PDF file.