Documentation

Videos API

Videos API responsible for all manipulations with videos.

Get Videos

/videos

Returns list of videos in accordance with search parameters. If several search parameters (tags, metadata or ids) are specified API will return videos that match to all of them.

Query params:

tags [String] - List of video tags (format: tags[]=tag1,tag2).

meta_data [String: String] - Dictionary of metadata (format: meta_data[key1]=value1&meta_data[key2]=value2).

ids [String] - List of video ids (format: ids[]=id1,id2).

sort_order String - Sorting order (asc or desc). Default is asc.

from_date String - Request videos created after this date (format iso8601: 2016-10-12T12:12:28.543450Z).

to_date String - Request videos created before this date (format iso8601: 2016-10-12T12:12:28.543450Z).

page Int - Requested page. Default is 1.

per_page Int -Amount of videos per page. Max is 50.

Response:

{
    "videos": [{
        "id": "768f8567-fa37-4750-90ff-21a2141c3951",
        "title": "",
        "lat": 53.2145646995903,
        "lng": 50.2545124028018,
        "width": null,
        "height": null,
        "meta_data": {
            "item_id": "9473612401247"
        },
        "created_at": "2019-09-30T15:52:04.821197Z",
        "shot_on": "2019-09-30T15:52:04.574000Z",
        "tags": ["review"],
        "thumb_url": "https://content.video.io/upload/app/c97ab35b-c000-4038-9266-a2977ee686e5/video/39ddf400-a77b-4990-a1f2-86c10126d1cd/thumb.jpg",
        "mp4_url": {
            "720p": "https://content.video.io/upload/app/c97ab35b-c000-4038-9266-a2977ee686e5/video/39ddf400-a77b-4990-a1f2-86c10126d1cd/720p.mp4",
            "480p": "https://content.video.io/upload/app/c97ab35b-c000-4038-9266-a2977ee686e5/video/39ddf400-a77b-4990-a1f2-86c10126d1cd/480p.mp4",
            "360p": "https://content.video.io/upload/app/c97ab35b-c000-4038-9266-a2977ee686e5/video/39ddf400-a77b-4990-a1f2-86c10126d1cd/360p.mp4"
        },
        "hls_url": null
    }],
    "meta": {
        "count": 1
    }
}

Example:

curl --request GET \
  --url https://api.video.io/v1/videos?meta_data[item_id]=9473612401247&tags[]=review&sort_order=desc \
  --header 'accept: application/json; charset=utf-8' \
  --header 'authorization: App token=YOUR_SECRET_TOKEN'
var request = require('request');

var options = {
  method: 'GET',
  url: 'https://api.video.io/v1/videos?meta_data[item_id]=9473612401247&tags[]=review&sort_order=desc',
  headers: {
    accept: 'application/json; charset=utf-8',
    authorization: 'App token=YOUR_SECRET_TOKEN'
  }};

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
require 'uri'
require 'net/http'
require 'openssl'

url = URI("https://api.video.io/v1/videos?meta_data[item_id]=9473612401247&tags[]=review&sort_order=desc")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Get.new(url)
request["accept"] = 'application/json; charset=utf-8'
request["authorization"] = 'App token=YOUR_SECRET_TOKEN'
response = http.request(request)
puts response.read_body
import requests

url = "https://api.video.io/v1/videos?meta_data[item_id]=9473612401247&tags[]=review&sort_order=desc"

headers = {
  'accept': 'application/json; charset=utf-8',
  'authorization': 'App token=YOUR_SECRET_TOKEN'
}
response = requests.request("GET", url, headers=headers)

print(response.text)

Get Video

/videos/:videoId

Returns single video by id.

Path params:

videoId* String - Id of video you want to request.

Response:

{
    "video": {
        "id": "768f8567-fa37-4750-90ff-21a2141c3951",
        "title": "",
        "lat": 53.2145646995903,
        "lng": 50.2545124028018,
        "width": null,
        "height": null,
        "meta_data": {
            "item_id": "9473612401247"
        },
        "created_at": "2019-09-30T15:52:04.821197Z",
        "shot_on": "2019-09-30T15:52:04.574000Z",
        "tags": ["review"],
        "thumb_url": "https://content.video.io/upload/app/c97ab35b-c000-4038-9266-a2977ee686e5/video/39ddf400-a77b-4990-a1f2-86c10126d1cd/thumb.jpg",
        "mp4_url": {
            "720p": "https://content.video.io/upload/app/c97ab35b-c000-4038-9266-a2977ee686e5/video/39ddf400-a77b-4990-a1f2-86c10126d1cd/720p.mp4",
            "480p": "https://content.video.io/upload/app/c97ab35b-c000-4038-9266-a2977ee686e5/video/39ddf400-a77b-4990-a1f2-86c10126d1cd/480p.mp4",
            "360p": "https://content.video.io/upload/app/c97ab35b-c000-4038-9266-a2977ee686e5/video/39ddf400-a77b-4990-a1f2-86c10126d1cd/360p.mp4"
        },
        "hls_url": null
    }
}

Example:

Video id you want to request.

curl --request GET \
  --url https://api.video.io/v1/videos/768f8567-fa37-4750-90ff-21a2141c3951 \
  --header 'accept: application/json; charset=utf-8' \
  --header 'authorization: App token=YOUR_SECRET_TOKEN'
var request = require('request');

var options = {
  method: 'GET',
  url: 'https://api.video.io/v1/videos/768f8567-fa37-4750-90ff-21a2141c3951',
  headers: {
    accept: 'application/json; charset=utf-8',
    authorization: 'App token=YOUR_SECRET_TOKEN'
  }};

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
require 'uri'
require 'net/http'
require 'openssl'

url = URI("https://api.video.io/v1/videos/768f8567-fa37-4750-90ff-21a2141c3951")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Get.new(url)
request["accept"] = 'application/json; charset=utf-8'
request["authorization"] = 'App token=YOUR_SECRET_TOKEN'
response = http.request(request)
puts response.read_body
import requests

url = "https://api.video.io/v1/videos/768f8567-fa37-4750-90ff-21a2141c3951"

headers = {
  'accept': 'application/json; charset=utf-8',
  'authorization': 'App token=YOUR_SECRET_TOKEN'
}
response = requests.request("GET", url, headers=headers)

print(response.text)

Create Video

/videos

Creates new video.

Body params:

title String - Title of the video.

tags [String] - List of video tags.

meta_data [String: String] - Dictionary of video metadata.

lat Double - Latitude of video location.

lng Double - Longitude of video location.

shot_on String - Date when the video was shot.

Response:

{
    "video": {
        "id": "6d688b9f-e95c-4a7d-b19d-6bbae2ed72bb",
        "title": "Video title",
        "lat": null,
        "lng": null,
        "width": null,
        "height": null,
        "meta_data": null,
        "created_at": "2019-11-11T21:37:50.478551Z",
        "shot_on": "2019-11-11T21:37:50.470528Z",
        "tags": null,
        "thumb_url": null,
        "mp4_url": {
            "720p": null,
            "480p": null,
            "360p": null
        },
        "hls_url": null
    }
}

Example:

curl --request POST \
  --url https://api.video.io/v1/videos \
  --header 'accept: application/json; charset=utf-8' \
  --header 'authorization: App token=YOUR_SECRET_TOKEN' \
  --data 'title=Video title'
var request = require('request');

var options = {
  method: 'POST',
  url: 'https://api.video.io/v1/videos',
  headers: {
    accept: 'application/json; charset=utf-8',
    authorization: 'App token=YOUR_SECRET_TOKEN'
  },
  body: {
    title: 'Video title'
  },
  json: true
};

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
require 'uri'
require 'net/http'
require 'openssl'

url = URI("https://api.video.io/v1/videos")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Post.new(url)
request["accept"] = 'application/json; charset=utf-8'
request["authorization"] = 'App token=YOUR_SECRET_TOKEN'
request.set_form_data({"title" => "Video title"})

response = http.request(request)
puts response.read_body
import requests

url = "https://api.video.io/v1/videos"

headers = {
  'accept': 'application/json; charset=utf-8',
  'authorization': 'App token=YOUR_SECRET_TOKEN'
}
body = {
  'title': 'Video title'
}

response = requests.request("POST", url, data=json.dumps(body), headers=headers)

print(response.text)

Update Video

/videos/:videoId

Updates video data.

Path params:

videoId* String - Id of video you want to update.

Body params:

title String - Title of the video.

tags [String] - List of video tags.

meta_data [String: String] - Dictionary of video metadata.

lat Double - Latitude of video location.

lng Double - Longitude of video location.

shot_on String - Date when the video was shot.

Response:

{
    "video": {
        "id": "6d688b9f-e95c-4a7d-b19d-6bbae2ed72bb",
        "title": "New title",
        "lat": null,
        "lng": null,
        "width": null,
        "height": null,
        "meta_data": null,
        "created_at": "2019-11-11T21:37:50.478551Z",
        "shot_on": "2019-11-11T21:37:50.470528Z",
        "tags": null,
        "thumb_url": null,
        "mp4_url": {
            "720p": null,
            "480p": null,
            "360p": null
        },
        "hls_url": null
    }
}

Example:

curl --request PUT \
  --url https://api.video.io/v1/videos/6d688b9f-e95c-4a7d-b19d-6bbae2ed72bb \
  --header 'accept: application/json; charset=utf-8' \
  --header 'authorization: App token=YOUR_SECRET_TOKEN' \
  --data 'title=New title'
var request = require('request');

var options = {
  method: 'PUT',
  url: 'https://api.video.io/v1/videos/6d688b9f-e95c-4a7d-b19d-6bbae2ed72bb',
  headers: {
    accept: 'application/json; charset=utf-8',
    authorization: 'App token=YOUR_SECRET_TOKEN'
  },
  body: {
    title: 'New title'
  },
  json: true
};

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
require 'uri'
require 'net/http'
require 'openssl'

url = URI("https://api.video.io/v1/videos/6d688b9f-e95c-4a7d-b19d-6bbae2ed72bb")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Put.new(url)
request["accept"] = 'application/json; charset=utf-8'
request["authorization"] = 'App token=YOUR_SECRET_TOKEN'
request.set_form_data({"title" => "New title"})

response = http.request(request)
puts response.read_body
import requests

url = "https://api.video.io/v1/videos/6d688b9f-e95c-4a7d-b19d-6bbae2ed72bb"

headers = {
  'accept': 'application/json; charset=utf-8',
  'authorization': 'App token=YOUR_SECRET_TOKEN'
}
body = {
  'title': 'New title'
}

response = requests.request("PUT", url, data=json.dumps(body), headers=headers)

print(response.text)

Delete Video

/videos/:videoId

Deletes video.

Path params:

videoId* String - Id of video you want to delete.

curl --request DELETE \
  --url https://api.video.io/v1/videos/6d688b9f-e95c-4a7d-b19d-6bbae2ed72bb \
  --header 'accept: application/json; charset=utf-8' \
  --header 'authorization: App token=YOUR_SECRET_TOKEN'
var request = require('request');

var options = {
  method: 'DELETE',
  url: 'https://api.video.io/v1/videos/6d688b9f-e95c-4a7d-b19d-6bbae2ed72bb',
  headers: {
    accept: 'application/json; charset=utf-8',
    authorization: 'App token=YOUR_SECRET_TOKEN'
  }};

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
require 'uri'
require 'net/http'
require 'openssl'

url = URI("https://api.video.io/v1/videos/6d688b9f-e95c-4a7d-b19d-6bbae2ed72bb")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Delete.new(url)
request["accept"] = 'application/json; charset=utf-8'
request["authorization"] = 'App token=YOUR_SECRET_TOKEN'
response = http.request(request)
puts response.read_body
import requests

url = "https://api.video.io/v1/videos/6d688b9f-e95c-4a7d-b19d-6bbae2ed72bb"

headers = {
  'accept': 'application/json; charset=utf-8',
  'authorization': 'App token=YOUR_SECRET_TOKEN'
}
response = requests.request("DELETE", url, headers=headers)

print(response.text)

Video notifications

You could also subscribe on MQTT notifications with video changes for more convenient handling of video creation, update and deletion. To do so you need to subscribe on MQTT video topic /app/YOUR_APP_ID/videos, where YOUR_APP_ID is your application id that you can find on http://dashboard.video.io in your application info section. Once you subscribed on that channel you will start receive notifications for all videos within specified app.

Notification types:

mp4_created

Sent when new mp4 url was added to video object. This notification is good place where you can treat video as being created and playable by all SDKs for all clients. Normally this notification will be sent 4 times for each video, first time when uploading of new video is finished, server will sent this notification with original video file and then 3 notifications for each rendition (720p, 480p and 360p) as them will be transcoded and added to video object. So if you want to play video on other clients as soon as possible, you can do that after first notification and if you prefer to have all video renditions available, so it can be played smooth in bad network conditions you can wait for all notifications and mark video as created after that.

Example of first notification:

{
    "event": "mp4_created",
    "id": "46be6a61-2031-40fa-a5e4-0d28c378f870",
    "changes": {
        "mp4_url": {
            "720p": "https://content.video.io/upload/app/c97ab35b-c000-4038-9266-a2977ee686e5/video/46be6a61-2031-40fa-a5e4-0d28c378f870/raw/video_000000.mp4"
        }
    }
}

Example of last notification:

{
    "event": "mp4_created",
    "id": "46be6a61-2031-40fa-a5e4-0d28c378f870",
    "changes": {
        "mp4_url": {
            "720p": "https://content.video.io/upload/app/c97ab35b-c000-4038-9266-a2977ee686e5/video/46be6a61-2031-40fa-a5e4-0d28c378f870/720p.mp4",
            "480p": "https://content.video.io/upload/app/c97ab35b-c000-4038-9266-a2977ee686e5/video/46be6a61-2031-40fa-a5e4-0d28c378f870/480p.mp4",
            "360p": "https://content.video.io/upload/app/c97ab35b-c000-4038-9266-a2977ee686e5/video/46be6a61-2031-40fa-a5e4-0d28c378f870/360p.mp4"
        }
    }
}


updated

Sent when video object was updated.

Example:

{
    "event": "updated",
    "id": "46be6a61-2031-40fa-a5e4-0d28c378f870",
    "changes": {
        "title": "New title"
    }
}


deleted

Sent when video object was deleted.

Example:

{
    "event": "deleted",
    "id": "46be6a61-2031-40fa-a5e4-0d28c378f870",
}