Uploading content to storage
Uploading content will allow you to programatically upload documents instead of using the console.
Uploading content works by requesting a signed URL and executing a PUT
request with the data to upload. You can view the full Swagger documentation here.
Presigned URL request
- cURL
- Javascript
- PHP
curl --location 'https://storage-api.doclabs.cloud/api/v1/MyBucketName/upload?contentPathName=DocumentIWantToUpload.docx' \
--header 'x-api-key: MY_API_KEY'
var settings = {
"url": "https://storage-api.doclabs.cloud/api/v1/MyBucketName/upload?contentPathName=DocumentIWantToUpload.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/upload?contentPathName=DocumentIWantToUpload.docx', $headers);
$res = $client->sendAsync($request)->wait();
echo $res->getBody();
Presigned URL response
{
"message": "",
"preSignedUrl": "https://myPreSignedURL.com"
}
You can then send content as multipart/form-data over a PUT
request to the preSignedUrl in order to upload.