Upload new captions file for a video
#
Request- Method:
POST
- URL:
https://dev.vdocipher.com/api/videos/{videoId}/files/
- Content-type:
multipart/form-data
- Input params:
type | name | description |
---|---|---|
query | language | ISO 639-1 representation of the language |
http-form | file | vtt file packaged as a multipart-formdata |
- Nodejs
const fs = require("fs");const rp = require("request-promise-native");
// replace with your valuesconst videoId = "_______";const filePath = "./path/to/file.vtt";
const authHeader = { authorization: `Apisecret ${process.env.apisecret}`,};
const uploadSubtitle = (videoId, filePath, language) => { return rp({ url: `https://dev.vdocipher.com/api/videos/${videoId}/files/`, method: "POST", qs: { language: language }, headers: { "Content-type": "multipart/form-data", ...authHeader, }, formData: { file: { value: fs.createReadStream(filePath), options: {}, }, }, json: true, });};
uploadSubtitle(videoId, filePath, "en") .then(console.log) .catch((e) => { if (!e.statusCode) { throw e; } console.error(e.message); });
#
Response#
SuccessContent-type: application/json
key | type | description |
---|---|---|
id | integer | unique id of this uploaded file |
time | string | ISO8601 representation of upload time in UTC |
size | string | human readable format of size |
lang | string | ISO-639-1 representation of language |
{ "id": 12090067, "time": "2021-04-04T09:06:26.925Z", "size": "5 kB", "lang": "en"}