Renaming Videos
If you wish to update the title of an uploaded video then this API enables you to change title of an existing video. You would need to send an
HTTP POST request to https://dev.vdocipher.com/api/videos/{videoID}
The POST request body should include a new video title:
{
"title": "new-title"
}
In order to avoid multiple callbacks for uploading and then change the title of the video, it is recommended to pass the title while uploading the video OR importing video from a URL.
When uploading a video the title
attribute in the url sets the title for the uploading video before start uploading.
Similarly, title property in PUT request body while importing video from url sets the title for the video before uploading.
Sample Code for Renaming a Videoβ
The sample API Secret Key is a1b2c3d4e5
. The video ID are written as {{videoID}} and new video title as {{videoTitle}}.
Replace these with the actual videoID and videoTitle.
- CURL
- NODE
- PHP
- C#
- Python
- Ruby
curl -X POST \
'https://dev.vdocipher.com/api/videos/{videoID}' \
-H 'Accept: application/json' \
-H 'Authorization: Apisecret a1b2c3d4e5' \
-H 'Content-Type: application/json' \
-d '{
"title": "{{newTitle}}"
}'
var request = require('request');
var options = {
method: 'POST',
url: 'https://dev.vdocipher.com/api/videos/{videoID}',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json',
'Authorization': 'Apisecret a1b2c3d4e5',
},
body: {
title: '{{newTitle}}',
},
json: true,
};
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/{videoID}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
"title" => "{{newTitle}}"
]),
CURLOPT_HTTPHEADER => array(
"Accept: application/json",
"Authorization: Apisecret a1b2c3d4e5",
"Content-Type: application/json",
),
));
$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/{videoID}");
var request = new RestRequest(Method.POST);
request.AddHeader("Accept", "application/json");
request.AddHeader("Content-Type", "application/json");
request.AddHeader("Authorization", "Apisecret a1b2c3d4e5");
request.AddParameter("undefined", "{\"title\": \"{{newTitle}}\"}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
import requests
url = "https://dev.vdocipher.com/api/videos/{videoID}"
payload = json.dumps({
"title": "{{newTitle}}"
})
headers = {
'Authorization': "Apisecret a1b2c3d4e5",
'Content-Type': "application/json",
'Accept': "application/json"
}
response = requests.request("POST", url, data=payload, headers=headers)
print(response.text)
require 'uri'
require 'net/http'
url = URI("https://dev.vdocipher.com/api/videos/{videoID}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Apisecret a1b2c3d4e5'
request["Content-Type"] = 'application/json'
request["Accept"] = 'application/json'
request.body = ({
:title => "{{newTitle}}"
}).to_json
response = http.request(request)
puts response.read_body
Sample Responseβ
{
"message": "Successfully updated"
}