Files can be uploaded to the API by creating a File object.
Create a File (via upload)
Accepted file formats are listed below. The content type must be specified in the Content-Type
header.
File Format | Content Type |
---|---|
GIF | image/gif |
JPEG | image/jpeg |
Microsoft Word, .doc | application/msword |
Microsoft Word (OpenXML), .docx | application/vnd.openxmlformats-officedocument.wordprocessingml.document |
Microsoft Excel, .xml | application/vnd.ms-excel |
Microsoft Excel (OpenXML), .xlsx | application/vnd.openxmlformats-officedocument.spreadsheetml.sheet |
application/pdf | |
PNG | image/png |
Text | text/plain |
TIFF | image/tiff |
Definition
POST https://api.treasuryprime.com/file
Parameter | Type | Required? | Description |
---|---|---|---|
file | binary | Required | File to be uploaded. |
Example Request
$ cat myimage.jpg | curl -u $API_KEY_ID:$API_SECRET_KEY \
-H 'Content-Type: image/jpeg' \
-X POST \
-T - https://api.treasuryprime.com/file
Example Response
{
"content_hash": "95141e22e6d74d9cedc6b063c6a57cbbf80d9f06",
"content_length": 16526,
"content_type": "image/jpeg",
"content_url": null,
"created_at": "2019-03-25T21:31:50Z",
"id": "file_0123456789",
"updated_at": "2019-03-25T21:31:50Z"
}