Title
Create new category
Edit page index title
Edit category
Edit link
API - Upload a file
In this chapter we'll learn how to upload file. Uploading file using API is multi-step process.
Initiate a group transfer
Initiate a file transfer
Upload a file
Complete a file transfer
Complete a group transfer
Initiate group transfer
You can upload multiple files in single group upload. To initiate group transfer use GET/vault_rest/transfer``endpoint. Here is an example:
Initiate file transfer
Now we'll create empty file on server where we'll stream data from our local file. for that we use GET /vault_rest``/transfer_file endpoint. We need to send some essential data with headers.
transfer_method– Method used for transferring the file as Binary data either Stream or Chunk.group_id– The transfer group ID.file_size– Size of the file in bytes.file_name– Name of the file to be uploaded. (Example: Testing image 2.png → Testing image 2)
For larger files, this method may cause issues due to size limitations. In such cases, you should upload the file in chunks (typically 10MB per chunk). To enable chunked upload, make sure to include the chunk_offset header in your request.
Upload a file
For uploading file we'll use PATCH /vault_rest/transfer_file endpoint. For this transfer we need to sed some headers:
group_id– The group transfer ID received from the Initialize Group Transfer stepfile_id– The file ID received from the Initialize File Transfer step
Complete file transfer
For uploading file we'll use POST /vault_rest/transfer_file endpoint. For this transfer we need to sed some headers:
group_id– The group transfer ID received from the Initialize Group Transfer stepfile_id– The file ID received from the Initialize File Transfer step
Complete group transfer
For uploading file we'll use POST /vault_rest/transfer endpoint. For this transfer we need to sed some headers:
group_id– The group transfer ID received from the Initialize Group Transfer step
Conclusion
Process described in this document will upload one smaller file. To upload more files, repeat steps 2, 3, 4 for each file. In case of bigger files upload file in more chunks of around 10MB by repeating step 3.
Whole example
Here is whole ting on one place. Make sure to change configuration variable at the beginning of the code.