Update Poster images of videos
To use this API, send an HTTP POST request to https://dev.vdocipher.com/api/videos/{{videoID}}/files
, with the file as part of form-data
Sample Code to Update Poster Imageβ
The sample video ID is written as {{videoID}}. Replace this with your video ID.
The sample API Secret Key is a1b2c3d4e5
.
- CURL
- NODE
- PHP
- C#
- Python
- Ruby
curl -X POST \
https://dev.vdocipher.com/api/videos/{{videoID}}/files \
-H 'Accept: application/json' \
-H 'Authorization: Apisecret a1b2c3d4e5' \
-H 'Content-Type: multipart/form-data' \
-F file=@/filePath/fileName.png
const fs = require('fs');
const request = require('request');
const options = {
method: 'POST',
url: 'https://dev.vdocipher.com/api/videos/___video_id___/files',
headers: {
'Accept': 'application/json',
'Content-Type': 'multipart/form-data',
'Authorization': 'Apisecret _____________',
},
formData: {
file: {
value: fs.createReadStream('./test/Aspect_ratio_16_9_example.jpg'),
options: {
filename: '/filePath/fileName.png',
contentType: null,
},
},
},
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://dev.vdocipher.com/api/videos/____video_id___/files",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_MAXREDIRS => 10,
CURLOPT_POSTFIELDS => [
'file' => curl_file_create('./../file.jpg', 'image/jpeg'),
],
CURLOPT_HTTPHEADER => array(
"Content-Type: multipart/form-data",
"Accept: application/json",
"Authorization: Apisecret ____________",
),
));
$response = curl_exec($curl);
$err = curl_error($curl);
$httpCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
echo "HTTP status code: $httpCode\n";
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $httpCode . " - " . $err;
} else {
echo $response;
}
The variable imageFilePath
is the path to the file on the web server.
var options = new RestClientOptions("https://dev.vdocipher.com");
var client = new RestClient(options);
var request = new RestRequest("/api/videos/{{videoId}}/files", Method.Post);
request.AddHeader("Content-Type", "multipart/form-data");
request.AddHeader("Authorization", "Apisecret a1b2c3d4e5");
request.AlwaysMultipartFormData = true;
request.AddFile("file", imageFilePath);
RestResponse response = await client.ExecuteAsync(request);
Console.WriteLine(response.Content);
import requests
url = "https://dev.vdocipher.com/api/videos/{{videoID}}/files"
payload = "------WebKitFormBoundary7MA4YWxkTrZu0gW\r\nContent-Disposition: form-data; name=\"file\"; filename=\"fileName.png\"\r\nContent-Type: image/png\r\n\r\n\r\n------WebKitFormBoundary7MA4YWxkTrZu0gW--"
headers = {
'content-type': "multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW",
'Authorization': "Apisecret a1b2c3d4e5",
'Content-Type': "multipart/form-data",
'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}}/files")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW'
request["Authorization"] = 'Apisecret a1b2c3d4e5'
request["Content-Type"] = 'multipart/form-data'
request["Accept"] = 'application/json'
request.body = "------WebKitFormBoundary7MA4YWxkTrZu0gW\r\nContent-Disposition: form-data; name=\"file\"; filename=\"fileName.png\"\r\nContent-Type: image/png\r\n\r\n\r\n------WebKitFormBoundary7MA4YWxkTrZu0gW--"
response = http.request(request)
puts response.read_body