Uploading a file
Use this API to upload a file. On success it returns a blobId. This API returns one result and emits no events.
URI
{{base_url}}/generic/ns/{{namespace}}/bot-provider/{{bot_provider_name}}/blob
HTTP method
POST
Headers
If you have enabled the API key feature, include X-API-KEY in the header, set to the API key configured in the Asgard console. Without it the connection fails.
| Name | Type | Description |
|---|---|---|
| X-API-KEY | string | Your API key |
Content-Type
multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW
Request parameters
The file is uploaded as multipart/form-data:
| Name | Type | Description |
|---|---|---|
| customChannelId | string | The chat channel's id. Use the same one as the start request. Conversation memory is per channel id. |
| file | file | The file to upload |
Response
A successful upload returns:
{
"isSuccess": true,
"data": [
{
"channelId": "1939596381945597952",
"blobId": "1939596382025289728",
"fileType": "IMAGE",
"fileName": "image.png",
"size": 326492,
"mime": "image/png"
}
],
"paging": null,
"error": null,
"errorCode": null
}
Keep the blobId from the response, so you can reference it in the message API afterwards.