Obtain credentials before upload
API endpoint to send HTTP PUT request to receive upload credentials is https://dev.vdocipher.com/api/videos
. To initiate video upload you would need to pass the title of video as a query string: https://dev.vdocipher.com/api/videos?title=videotitle
where videotitle
is the title of the video.
Optionally, you can also pass folder ID in the query parameter to upload video inside a specific folder. If no folder ID is pass then default folder ID root
in considered.
Folder id can be copied from dashboard as shown below:
This API returns a JSON object, which authorizes you to initiate upload. You may upload the file yourself, or can pass the upload credentials to your content providers who can then upload videos to your account. The JSON object looks like this:
The values received in upload policy are presented in the following format - {{policy}}
{
"clientPayload": {
"policy": "{{format}}",
"key": "{{key}}",
"x-amz-signature": "{{x-amz-signature}}",
"x-amz-algorithm": "{{x-amz-algorithm}}",
"x-amz-date": "{{x-amz-date}}",
"x-amz-credential": "{{x-amz-credential}}",
"uploadLink": "https://{s3-bucket-url}}.amazonaws.com"
},
"videoId": "1234567890"
}
Obtain Credentials Sample Codeβ
Use the language tab on top-right to choose your server language.
The API Secret Key is a1b2c3d4e5
and sample folder ID is ca038407e1b0XXXXXXXXXXXXXXXXXXXX
.
- CURL
- NODE
- PHP
- C#
- Python
- Ruby
curl -X PUT \
'https://dev.vdocipher.com/api/videos?title=title&folderId=ca038407e1b0XXXXXXXXXXXXXXXXXXXX' \
-H 'Authorization: Apisecret a1b2c3d4e5'
var request = require('request');
var options = {
method: 'PUT',
url: 'https://dev.vdocipher.com/api/videos',
qs: {title: 'title', folderId: 'ca038407e1b0xxxxxxxxxxxxxxxxxxxx'},
headers: {Authorization: 'Apisecret a1b2c3d4e5'},
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://dev.vdocipher.com/api/videos?title=title&folderId=ca038407e1b0XXXXXXXXXXXXXXXXXXXX",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_HTTPHEADER => array(
"Authorization: Apisecret a1b2c3d4e5"
),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
var client = new RestClient("https://dev.vdocipher.com/api/videos?title=title&folderId=ca038407e1b0XXXXXXXXXXXXXXXXXXXX");
var request = new RestRequest(Method.PUT);
request.AddHeader("Authorization", "Apisecret a1b2c3d4e5");
IRestResponse response = client.Execute(request);
import requests
url = "https://dev.vdocipher.com/api/videos"
querystring = {"title":"title", "folderId": "ca038407e1b0xxxxxxxxxxxxxxxxxxxx"}
headers = {
'Authorization': "Apisecret a1b2c3d4e5"
}
response = requests.request("PUT", url, headers=headers, params=querystring)
print(response.text)
require 'uri'
require 'net/http'
url = URI("https://dev.vdocipher.com/api/videos?title=title&folderId=ca038407e1b0XXXXXXXXXXXXXXXXXXXX")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Apisecret a1b2c3d4e5'
response = http.request(request)
puts response.read_body