Appearance
Temporary File
Overview
This API is used to upload files to a intermediate location for furture uses in other CBD's system.
Environment URLs
This API has two different endpoints for production and development environments. Use the appropriate endpoint based on your current environment.
PROD Endpoint:
https://api.cbd.int/- This endpoint is used for accessing the production environment of the API. Use this endpoint for all live, real-world applications where you need to interact with the actual production data.
DEV Endpoint:
https://api.cbddev.xyz/- This endpoint is for the development environment. Use this for testing, development, and staging purposes. It allows you to safely test your applications without affecting the live production data.
Upload File - Unlimited Size
This method is used for uploading files of unlimited size through a three-step process:
- Create a Slot
- Upload the File to the Slot
- Retrieve the File slot details
Step 1: Create a Slot
Request
POST /api/v2015/temporary-files
Headers
| Field | Type | Description |
|---|---|---|
| Authorization | String | Required authorization token |
Body
| Name | Type |
|---|---|
| filename | String |
Response Body
| Name | Type |
|---|---|
| url | String |
| uid | String |
| contentType | String |
| metadata | Key-pair Object |
Response Example
json
{
"url": "https://s3.amazonaws.com/cbd.documents.temporary/1cfb1381f08ddb32071af684b5dc9d16?Expires=1734738728&Signature=...",
"uid": "1cfb1381f08ddb32071af684b5dc9d16",
"contentType": "application/pdf",
"metadata": {
"filename": "5_KB_file.pdf",
"content-type": "application/pdf",
"user": "301785"
}
}Playground
Swagger playground is loading, please wait...
Step 2: Upload File to Slot
Request
PUT Response URL from Step 1
Headers
| Field | Type | Description |
|---|---|---|
| Content-Type | String | Content type of the file (mime-type) |
Body
Upload the file as binary data
Playground
Swagger playground is loading, please wait...
Step 3: Retrieve the File slot details
Request
GET /api/v2015/temporary-files/{uid}
URL Parameters
| Field | Type | Description |
|---|---|---|
| uid | String | Unique identifier for file |
Headers
| Field | Type | Description |
|---|---|---|
| Authorization | String | Required authorization token |
Response Body
| Name | Type |
|---|---|
| url | String |
| uid | String |
| hash | String |
| filename | String |
| size | Number |
| contentType | String |
| metadata | Key-pair Object |
Response Example
json
{
"url": null,
"uid": "1cfb1381f08ddb32071af684b5dc9d16",
"hash": "0071b125fc59b2b39651854beddbe275",
"filename": "5_KB_file.pdf",
"size": 5120,
"contentType": "application/pdf",
"metadata": {
"filename": "5_KB_file.pdf",
"user": "301785",
"content-type": "application/pdf"
}
}Playground
Swagger playground is loading, please wait...
Upload File - Limited Size
This method is used to upload a file with a size limit of 1MB. The file is uploaded in a single step using a POST request.
Request
POST /api/v2015/temporary-files
Headers
| Field | Type | Description |
|---|---|---|
| Authorization | String | Required authorization token |
| Content-Type | String | multipart/form-data; boundary=... |
Body
Form-Data:
| Key | Value |
|---|---|
| file | File Binary |
Response Body
| Name | Type |
|---|---|
| url | String |
| uid | String |
| hash | String |
| size | Number |
| contentType | String |
| metadata | Key-pair Object |
Response Example
json
{
"url": "https://s3.amazonaws.com/cbd.documents.temporary/4fa0f71b-cd7c-c0ce-03a4-3dd264fdcde3?AWSAccessKeyId=AKIAIABSUSESLXAZRGMQ&Expires=1734709685&Signature=gyq8UILFrezIPAPq%2FYKO7xzaAMk%3D",
"uid": "4fa0f71b-cd7c-c0ce-03a4-3dd264fdcde3",
"contentType": "application/pdf",
"metadata": {
"fileName": "5_KB_file.pdf",
"user": "301785"
},
"hash": "0071b125fc59b2b39651854beddbe275",
"size": 5120
}Playground
Swagger playground is loading, please wait...
