Downloading content from storage
Downloading content will allow you to programatically download documents instead of using the console.
Downloading content works by requesting a signed URL and executing a GET
request. You can view the full Swagger documentation here.
Presigned URL request
- cURL
- Javascript
- PHP
curl --location 'https://storage-api.doclabs.cloud/api/v1/MyBucketName/download?contentPathName=DocumentIWantToDownload.docx' \
--header 'x-api-key: MY_API_KEY'
var settings = {
"url": "https://storage-api.doclabs.cloud/api/v1/MyBucketName/download?contentPathName=DocumentIWantToDownload.docx",
"method": "GET",
"timeout": 0,
"headers": {
"x-api-key": "MY_API_KEY"
},
};
$.ajax(settings).done(function (response) {
console.log(response);
});
<?php
$client = new Client();
$headers = [
'x-api-key' => 'MY_API_KEY'
];
$request = new Request('GET', 'https://storage-api.doclabs.cloud/api/v1/MyBucketName/download?contentPathName=DocumentIWantToDownload.docx', $headers);
$res = $client->sendAsync($request)->wait();
echo $res->getBody();
Presigned URL response
{
"message": "",
"preSignedUrl": "https://myPreSignedURL.com"
}
You can then download the content by executing a GET
request against the preSignedUrl.