Delete Channel

Delete the Channel

Delete a video channel

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

Request Body

NameTypeDescription

id

String

Channel Id.

Code Samples

C#

using System;
using System.Net.Http;
using System.Threading.Tasks;

namespace HttpClientExample
{
    class Program
    {
        static async Task Main(string[] args)
        {
            string channelId = "Yy95faA";
            string url = $"https://api.dyntube.com/v1/channels/{channelId}";

            using (var httpClient = new HttpClient())
            {
                var response = await httpClient.DeleteAsync(url);

                if (response.IsSuccessStatusCode)
                {
                    Console.WriteLine("Channel deleted successfully.");
                }
                else
                {
                    Console.WriteLine("DELETE request failed with status code: " + response.StatusCode);
                }
            }
        }
    }
}

Node.js

const fetch = require('node-fetch');

const channelId = 'Yy95faA';
const url = `https://api.dyntube.com/v1/channels/${channelId}`;
const options = {
  method: 'DELETE',
};

fetch(url, options)
  .then(res => {
    if (res.ok) {
      console.log('Channel deleted successfully.');
    } else {
      console.error(`DELETE request failed with status code: ${res.status}`);
    }
  })
  .catch(err => console.error('DELETE request failed with error:', err));

Python

import requests

channel_id = 'Yy95faA'
url = f'https://api.dyntube.com/v1/channels/{channel_id}'
headers = {'Content-Type': 'application/json'}

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

if response.status_code == 200:
    print('Channel deleted successfully.')
else:
    print(f'DELETE request failed with status code: {response.status_code}')

PHP

<?php

$channel_id = 'Yy95faA';
$url = "https://api.dyntube.com/v1/channels/{$channel_id}";
$headers = array('Content-Type: application/json');

$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 'DELETE request failed: ' . curl_error($ch);
} else {
    $httpStatus = curl_getinfo($ch, CURLINFO_HTTP_CODE);
    if ($httpStatus == 200) {
        echo 'Channel deleted successfully.';
    } else {
        echo 'DELETE request failed with status code: ' . $httpStatus;
    }
}

curl_close($ch);

Last updated