API Reference
Log In
API Reference

Blocks

Using Blocks to upload files in SideDrawer.

In SideDrawer, files (recordFiles) can be uploaded one of two ways:

  1. File mode – basic file uploading; simple and backwards compatible but not very efficient
  2. Blocks mode – more efficient file uploading

ℹ️

Blocks SDK

Use the SDK to easily split and upload files using Blocks.


Steps

Consider the following example of a Blocks mode implementation:

my_file.pdf is a 10 MB file I would like to upload as a file (recordFile)

my_file.pdf has a size of 10 MB.

1. Split file

Split the file into Blocks (hashes) of maximum 4 MB each.

my_file.pdf is split into 3 blocks of maximum 4 MB each:

my_file.pdf is split into 3 blocks. Block 1 has size 4 MB, block 2 has size 4 MB, and block 3 has size 10 MB.

2. Upload blocks

Make an API call for each of the Blocks of the file. Specify the order of the Block as a query parameter.

URL: /api/v2/blocks/sidedrawer/sidedrawer-id/{sidedrawerId}/records/record-id/{recordId}/upload
HTTP method: POST
Query parameters: order


Block 1:

POST /api/v2/blocks/sidedrawer/sidedrawer-id/{sidedrawerId}/records/record-id/{recordId}/upload?order=1

{
 "block": <first-block-4-MB> 
}

{
  "hash": "string1",
  "order": 1
}

Block 2:

POST /api/v2/blocks/sidedrawer/sidedrawer-id/{sidedrawerId}/records/record-id/{recordId}/upload?order=2

{
 "block": <second-block-4-MB> 
}

{
  "hash": "string2",
  "order": 2
}

Block 3:

POST /api/v2/blocks/sidedrawer/sidedrawer-id/{sidedrawerId}/records/record-id/{recordId}/upload?order=3

{
 "block": <third-block-2-MB> 
}

{
  "hash": "string3",
  "order": 3
}


3. Rejoin Blocks

Rejoin the Blocks in their correct order, using the created Blocks/hashes and the order parameters, plus optional key-value data.

URL: /api/v2/record-files/sidedrawer/sidedrawer-id/{sidedrawerId}/records/record-id/{recordId}/record-files
HTTP method: POST
Query parameters: correlationId, uploadTitle, fileName, caption, fileType, fileExtension, displayType, envelopeId
Headers:

  • metadata entity (file JSON metadata) optional
  • externalKeys entity optional
  • blocks array of comma-separated blocks/hashes

POST /api/v2/record-files/sidedrawer/sidedrawer-id/{sidedrawerId}/records/record-id/{recordId}/record-files

metadata: {
  "history": [
    {
      "action": "fileUpload",
      "actorName": "string",
      "actorEmailAddress": "string",
      "createdAt": "2022-01-01T12:50:24.856Z",
      "ipAddress": "string"
    }
  ]
}

externalKeys: {}

blocks: [
  {
    "hash": "string1",
    "order": 1
  },
  {
    "hash": "string2",
    "order": 2
  },
  {
    "hash": "string3",
    "order": 3
  }
]

Implementation

To easily use Blocks, we recommend the use of our SDK.