Skip to content

Temporary File

Overview

This API is used to upload files to a intermediate location for furture uses in other CBD's system.

Upload File - Unlimited Size

This method is used for uploading files of unlimited size through a three-step process:

  1. Create a Slot
  2. Upload the File to the Slot
  3. Retrieve the File slot details

Step 1: Create a Slot


Request

POST https://api.cbddev.xyz/api/v2015/temporary-files


Headers
FieldTypeDescription
AuthorizationStringRequired authorization token

Body
NameType
filenameString
Response Body
NameType
urlString
uidString
contentTypeString
metadataKey-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
FieldTypeDescription
Content-TypeStringContent 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 https://api.cbddev.xyz/api/v2015/temporary-files/{uid}


URL Parameters
FieldTypeDescription
uidStringUnique identifier for file
Headers
FieldTypeDescription
AuthorizationStringRequired authorization token
Response Body
NameType
urlString
uidString
hashString
filenameString
sizeNumber
contentTypeString
metadataKey-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 https://api.cbddev.xyz/api/v2015/temporary-files


Headers
FieldTypeDescription
AuthorizationStringRequired authorization token
Content-TypeStringmultipart/form-data; boundary=...
Body

Form-Data:

KeyValue
fileFile Binary
Response Body
NameType
urlString
uidString
hashString
sizeNumber
contentTypeString
metadataKey-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...