Links

Get Videos

Get Video List

get
https://api.dyntube.com/v1/
videos
Get a list of videos. You can filter or sort videos based on optional query string.
Parameters
Query
page
Integer
Page number
size
Integer
Page size
planType
Integer
Type of the plan
sort
String
Sort order of the results. See details below.
projectId
String
Id of the project
Responses
200: OK
Response will create a list of videos and a pager.
400: Bad Request
If there is something wrong
401: Unauthorized
If unauthorized

Sorting of results

The sorting order of the videos would be a query sort with a value. the format of the value would be field:1 for ascending order and field:-1 for descending order.
#Here are examples to sort the videos by "Created" date.
#Sort by date created descending:
https://api.dyntube.com/v1/videos?sort=Created:-1
#Sort by date created ascending:
https://api.dyntube.com/v1/videos?sort=Created:1

C# Sample

using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text.Json;
using System.Threading.Tasks;
namespace VideoList
{
class Program
{
private static readonly HttpClient client = new HttpClient();
static async Task Main(string[] args)
{
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", "your_bearer_token");
var response = await client.GetAsync("https://api.dyntube.com/v1/videos");
if (response.IsSuccessStatusCode)
{
var responseContent = await response.Content.ReadAsStringAsync();
var videosResponse = JsonSerializer.Deserialize<VideosResponse>(responseContent);
foreach (var video in videosResponse.Videos)
{
Console.WriteLine("Id: " + video.Id);
Console.WriteLine("Title: " + video.Title);
Console.WriteLine("hlsUrl: " + video.HlsUrl);
Console.WriteLine("hlsUrlWeb: " + video.HlsUrlWeb);
Console.WriteLine("mp4Url: " + video.Mp4Url);
}
}
}
}
class VideosResponse
{
public Video[] Videos { get; set; }
public Pager Pager { get; set; }
}
class Video
{
public string Id { get; set; }
public string Title { get; set; }
public string HlsUrl { get; set; }
public string HlsUrlWeb { get; set; }
public string Mp4Url { get; set; }
}
class Pager
{
public int page { get; set; }
public int totalPages { get; set; }
public int totalResults { get; set; }
public string sort { get; set; }
}
}

Node.js Sample

const axios = require('axios');
async function video_list(bearer_token) {
try {
const response = await axios.get("https://api.dyntube.com/v1/videos", {
headers: {
Authorization: `Bearer ${bearer_token}`
}
});
const videosResponse = response.data;
for (const video of videosResponse.videos) {
console.log("Id: " + video.id);
console.log("Title: " + video.title);
console.log("hlsUrl: " + video.hlsUrl);
console.log("hlsUrlWeb: " + video.hlsUrlWeb);
console.log("mp4Url: " + video.mp4Url);
}
console.log("Page: " + videosResponse.pager.page);
console.log("Total Pages: " + videosResponse.pager.totalPages);
console.log("Total Results: " + videosResponse.pager.totalResults);
console.log("Sort: " + videosResponse.pager.sort);
} catch (error) {
console.error(error);
}
}
video_list('your_bearer_token');

Python

import requests
import json
bearer_token = "your_bearer_token"
url = "https://api.dyntube.com/v1/videos"
headers = {
"Authorization": f"Bearer {bearer_token}"
}
response = requests.get(url, headers=headers)
if response.status_code == 200:
videos_response = json.loads(response.text)
for video in videos_response.videos:
print("Id:", video.id)
print("Title:", video.title)
print("hlsUrl:", video.hlsUrl)
print("hlsUrlWeb:", video.hlsUrlWeb)
print("mp4Url:", video.mp4Url)
print("Page:", videos_response.pager.page)
print("Total Pages:", videos_response.pager.totalPages)
print("Total Results:", videos_response.pager.totalResults)
print("Sort:", videos_response.pager.sort)
else:
print("Error getting videos. Status code:", response.status_code)y

PHP

<?php
$bearer_token = 'your_bearer_token';
$url = 'https://api.dyntube.com/v1/videos';
$headers = array(
'Authorization: Bearer ' . $bearer_token
);
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
if (!$response) {
echo 'Error getting videos: ' . curl_error($ch);
} else {
$videos_response = json_decode($response);
foreach ($videos_response->videos as $video) {
echo "Id: " . $video->id . "\n";
echo "Title: " . $video->title . "\n";
echo "hlsUrl: " . $video->hlsUrl . "\n";
echo "hlsUrlWeb: " . $video->hlsUrlWeb . "\n";
echo "mp4Url: " . $video->mp4Url . "\n";
}
echo "Page: " . $videos_response->pager->page . "\n";
echo "Total Pages: " . $videos_response->pager->totalPages . "\n";
echo "Total Results: " . $videos_response->pager->totalResults . "\n";
echo "Sort: " . $videos_response->pager->sort . "\n";
}
curl_close($ch);
?>
A video status 3 means that the video is published. See more details here.