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
The URL which you will get in response in step one is a temporary URL with a validity time of 1 minute.
Endpoint: https://api.dps.io/api
APIVersion: v1
route: documents
path:
POST
https://api.dps.io/api/v1/documents
{
"Content-Type": "application/json",
"x-api-key": "<YOUR_API_KEY>",
"ShipperHash": "<YOUR_SHIPPER_HASH>"
}
{
"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 --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"
}'
{
"Url": "https://dps-docs.s3.amazonaws.com/multi_file_pdf/*****************g%3D%3D&Expires=1668450878",
"Key": "multi_file_pdf/********************/5vHolWeFeYEF1qW1bK8hLg.pdf",
"DocumentHash": "5vHol****************1bK8hLg"
}
Key | Value/Type | Description |
---|---|---|
Url | String | String formatted URL that you need to make another API call described in step1 |
Key | String | This would be the file path where your document file would be stored |
DocumentHash | String |
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.
PUT
https://dps-docs.s3.amazonaws.com/multi_file_pdf/*****************g%3D%3D&Expires=1668450878
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 --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}'
In data-binary you need to provide the file path which has been described in step1.