DynTube API
  • Welcome!
  • Key Concepts
  • Quick Start
  • Reference
    • Videos
      • Video Upload via File (Server Side)
      • Video Upload via URL (server side)
      • HTML-Form Client Side Video Uploads
      • Get Video Status
      • Get Videos
      • Get Video
      • Update Video
      • Delete Video
      • Download Original Video
      • Get Video for Mobile App/Custom Player
      • Update Video Image
      • Add Video Captions/Chapters/Subtitles
      • Delete Video Captions/Subtitles/Chapters
      • Create Expirable Links
      • Get Collected Emails
      • Setting Up Webhooks
      • Copy call-to-action (CTA) to Videos
      • Token Authentication
    • Projects
      • Create Project
      • Update a Project
      • Get Projects
      • Get a Project
      • Delete a Project
      • Set default CTA for Project
    • Live Streaming
      • Create a Live Stream
      • Update a Live Stream
      • Get Live Streams
      • Get a Live Stream
      • Count Live Streams
      • Live Streams Limit
      • Get Live Streaming Recording
      • Delete a Live Stream
      • Service and Regions for live streams
    • Channels
      • Get Channels
      • Get Channel
      • Delete Channel
    • Subscriptions
      • Create a Plan
      • Create a Member
      • Attach Plan To Member
      • Get Plans
      • Get Members
      • Get Member's Plans
      • Delete a Plan
    • Analytics
      • Use your User Ids in Analytics
      • Get Video Analytics
    • Javascript Events Methods
      • Plain Javascript Events & Methods
      • Control the Player using React
      • Control the Player in Vue.js
    • Developer Resources
      • How to embed DynTube player in Next.Js
      • How to embed the video player in React
      • How to play DynTube videos in React Native
      • ExoPlayer app to play HLS videos
      • How to embed videos & channels dynamically
      • How to Import Vimeo Videos into DynTube
Powered by GitBook
On this page
  • Delete the Video
  • Delete a video
  • C# Sample
  • Node.js Sample
  • Python Sample
  • PHP Sample
  1. Reference
  2. Videos

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);
PreviousUpdate VideoNextDownload Original Video

Last updated 9 months ago