Get Video Status

This endpoint will return the status of the video. The response will be a single-digit that represents the current status of the video.

GET https://api.dyntube.com/v1/videos/{id}/status

Path Parameters

Name
Type
Description

id*

String

Video Id. This is NOT the same as channelKey that is provided in the embed code. This is normally provided in the video list through API or through the dashboard.

3

A video status of 3 means that the video is published.

Value of Video Status

Below are the possible video status values:

Description of Status
Value

NA

0

Uploaded

1

Processing

2

Published

3

Error

-1

C# Sample

using System;
using System.Net.Http;
using System.Net.Http.Headers;

namespace VideoStatusCheck
{
    class Program
    {
        static void Main(string[] args)
        {
            string id = "your_video_id";
            string apiUrl = $"https://api.dyntube.com/v1/videos/{id}/status";
            string bearerToken = "your_bearer_token";

            using (var client = new HttpClient())
            {
                client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", bearerToken);

                var response = client.GetAsync(apiUrl).Result;

                if (response.IsSuccessStatusCode)
                {
                    string status = response.Content.ReadAsStringAsync().Result;
                    if (status == "3")
                    {
                        Console.WriteLine("The video has been published.");
                    }
                    else
                    {
                        Console.WriteLine("The video has not been published yet.");
                    }
                }
                else
                {
                    Console.WriteLine("Request failed: " + response.ReasonPhrase);
                }
            }
        }
    }
}

Node.js Sample

const axios = require('axios');

async function checkVideoStatus(videoId, bearerToken) {
    try {
        const response = await axios.get(`https://api.dyntube.com/v1/videos/${videoId}/status`, {
            headers: {
                Authorization: `Bearer ${bearerToken}`
            }
        });

        const status = response.data;

        if (status === '3') {
            console.log('The video has been published.');
        } else {
            console.log('The video has not been published yet.');
        }
    } catch (error) {
        console.error(error);
    }
}

checkVideoStatus('your_video_id', 'your_bearer_token');

Python Sample

const axios = require('axios');

async function checkVideoStatus(videoId, bearerToken) {
    try {
        const response = await axios.get(`https://api.dyntube.com/v1/videos/${videoId}/status`, {
            headers: {
                Authorization: `Bearer ${bearerToken}`
            }
        });

        const status = response.data;

        if (status === '3') {
            console.log('The video has been published.');
        } else {
            console.log('The video has not been published yet.');
        }
    } catch (error) {
        console.error(error);
    }
}

checkVideoStatus('your_video_id', 'your_bearer_token');

PHP Sample

function check_video_status($video_id, $bearer_token) {
  $headers = [
    "Authorization: Bearer $bearer_token"
  ];

  $ch = curl_init("https://api.dyntube.com/v1/videos/$video_id/status");
  curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  $response = curl_exec($ch);
  $http_status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
  curl_close($ch);

  if ($http_status == 200) {
    $status = json_decode($response);
    if ($status == '3') {
      echo "The video has been published.\n";
    } else {
      echo "The video has not been published yet.\n";
    }
  } else {
    echo "Error checking video status. Status code: $http_status\n";
  }
}

Last updated