Skip to main content

Upload Document

You can upload your document to DPS and can reuse them as per your need.

Steps of creating/uploading document

Creating or uploading documents with DPS is very simple. To make it easily trackable for users, we have split this process into two steps so that users can easily understand and implement the document upload process into their system.

1. Provide document details

First, you need to provide the details of your document like document name, filename, etc so that the DPS system will create an object internally and return you a temporary URL, which you can use in step 2

Note

The URL which you will get in response in step one is a temporary URL with a validity time of 1 minute.

URL Config
Endpoint: https://api.dps.io/api
APIVersion: v1
route: documents
path:
Method
POST
URL
https://api.dps.io/api/v1/documents
Request Headers
{
"Content-Type": "application/json",
"x-api-key": "<YOUR_API_KEY>",
"ShipperHash": "<YOUR_SHIPPER_HASH>"
}
Request Body
{
"ShipperHash":"{{ShipperHash}}",
"FileName": "sample.pdf",
"DocumentName": "Sample_PDF_for_test",
"Tags": "sample_pdf, pdf_sample",
"Category": "test document",
"Description": "Sample PDF document to upload"
}
Curl request
curl --location --request POST 'https://api.dps.io/api/v1/documents' \
--header 'x-api-key: xxxxxxdfjbdjdfjdhfxxxxxxx' \
--header 'ShipperHash: 05K9****************************JG6a' \
--header 'Content-Type: application/json' \
--data-raw '{
"ShipperHash": "05K9****************************JG6a",
"FileName": "sample.pdf",
"DocumentName": "Sample_PDF_for_test",
"Tags": "sample_pdf, pdf_sample",
"Category": "test document",
"Description": "Sample PDF document to upload"
}'
Response
{
"Url": "https://dps-docs.s3.amazonaws.com/multi_file_pdf/*****************g%3D%3D&Expires=1668450878",
"Key": "multi_file_pdf/********************/5vHolWeFeYEF1qW1bK8hLg.pdf",
"DocumentHash": "5vHol****************1bK8hLg"
}
response Details
KeyValue/TypeDescription
UrlStringString formatted URL that you need to make another API call described in step1
KeyStringThis would be the file path where your document file would be stored
DocumentHashString

2. Uploading actual document

Once you executed the link you will get a temporary URL in response, which you can use for uploading your document to the DPS server.

Method
PUT
URL
https://dps-docs.s3.amazonaws.com/multi_file_pdf/*****************g%3D%3D&Expires=1668450878

note

This temporary URL is valid for 5 minutes only, in case of expiration of this URL you need to recall the step-1 API.

Curl request
curl --location --request PUT 'https://dps-docs.s3.amazonaws.com/multi_file_pdf/*****************g%3D%3D&Expires=1668450878' \
--header 'Content-Type: application/pdf' \
--data-binary '{Local Of Your File/*.pdf}'
Note

In data-binary you need to provide the file path which has been described in step1.