File upload

Some APIs require you to upload binary data, like images or documents. In order to efficiently transfer such additional data we do not embed them in the JSON request body, but provide a separate API to only upload the binary data. This API returns a temp file identifier, which you can then use to refer to the file in the JSON request body of subsequent API calls.

The returned temp file id expires after one week, so you should not store it in your database but only use for immediate API calls.

In order to upload a binary file you have to make two HTTP requests. First, create a signed upload URL:

Create a new temp file identifier

POST https://www.talque.com/webhook/file/temp/create

Create a new temp file id and associated signed upload URL. This API call requires authentication as described in the Authentication section.

Body

There is no input, so the request body is an empty {} object.

Response

{
    "tempFileId": "NL3bI9SZBaEalxdIpre4", 
    "uploadUrl": "https://storage.googleapis.com/...", 
    "success": true, 
    "reasonEnum": "CreateTempFileWebhookReason", 
    "reason": "SUCCESS"
}

The returned value is a JSON dictionary that includes the tempFileId and uploadUrl. The second and final step is to upload the file content to the provided upload URL with a HTTP PUT request. For example, on the command line this could be done with the CURL command

curl -v --upload-file test.pdf 'https://storage.googleapis.com/...'

After the upload completes you can start using the temp file id in subsequent API calls.

Last updated