Delete Video

Delete the Video

Delete a video

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

Request Body

Name
Type
Description

id*

String

video Id in the URL

C# Sample

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

namespace DeleteVideoExample
{
    class Program
    {
        static async System.Threading.Tasks.Task Main(string[] args)
        {
            string videoId = "your_video_id";
            string bearerToken = "your_bearer_token";
            string url = $"https://api.dyntube.com/v1/videos/{videoId}";

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

                var response = await client.DeleteAsync(url);

                if (response.IsSuccessStatusCode)
                {
                    Console.WriteLine("Video deleted successfully.");
                }
                else
                {
                    Console.WriteLine($"Error deleting video. Status code: {response.StatusCode}");
                }
            }
        }
    }
}

Node.js Sample

const axios = require('axios');

const videoId = 'your_video_id';
const bearerToken = 'your_bearer_token';
const url = `https://api.dyntube.com/v1/videos/${videoId}`;

const config = {
    headers: {
        Authorization: `Bearer ${bearerToken}`
    }
};

axios.delete(url, config)
    .then(response => {
        if (response.status === 200) {
            console.log('Video deleted successfully.');
        } else {
            console.log(`Error deleting video. Status code: ${response.status}`);
        }
    })
    .catch(error => {
        console.log(`Error deleting video. ${error}`);
    });

Python Sample

import requests

video_id = 'your_video_id'
bearer_token = 'your_bearer_token'
url = f'https://api.dyntube.com/v1/videos/{video_id}'

headers = {
    'Authorization': f'Bearer {bearer_token}'
}

response = requests.delete(url, headers=headers)

if response.status_code == 200:
    print('Video deleted successfully.')
else:
    print(f'Error deleting video. Status code: {response.status_code}')

PHP Sample

<?php

$video_id = 'your_video_id';
$bearer_token = 'your_bearer_token';
$url = "https://api.dyntube.com/v1/videos/{$video_id}";

$headers = array(
    'Authorization: Bearer ' . $bearer_token
);

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);

if ($response === false) {
    echo "Error deleting video: " . curl_error($ch);
} else {
    $httpStatus = curl_getinfo($ch, CURLINFO_HTTP_CODE);
    if ($httpStatus == 200) {
        echo "Video deleted successfully.";
    } else {
        echo "Error deleting video. Status code: " . $httpStatus;
    }
}

curl_close($ch);

Last updated