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
  • Get Channel List
  • Get a list of channels. You can filter or sort channels based on optional query string.
  • Sorting of results
  • Code Samples
  • C#
  • Node
  • Python
  • PHP
  1. Reference
  2. Channels

Get Channels

Get Channel List

Get a list of channels. You can filter or sort channels based on optional query string.

GET https://api.dyntube.com/v1/channels

Query Parameters

Name
Type
Description

page

Integer

Page number

size

Integer

Page size

planType

Integer

Type of the plan

sort

String

Sort order of the results. See details below.

{
    "pager": {
        "page": 1,
        "totalPages": 25,
        "totalResults": 25,
        "sort": "Created:-1"
    },
    "channels": [
        {
            "id": "WbuG0e4aJJgudbA",
            "key": "Tz6NAPOhVgTGX6A",
            "name": "demo.dyntube.io",
            "description": "",
            "accountId": "bG4bUdcNASQ",
            "version": 1,
            "planType": 1,
            "templateKey": "62828610006",
            "status": 1,
            "created": "2020-05-19T10:05:48.2496031+00:00",
            "updated": "2020-05-19T10:05:48.2496036+00:00"
        }
    ]
}
{
    // Response
}
{
    // Response
}

Sorting of results

The sorting order of the channels would be a query parameter 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 by "Created" date.

#Sort by date created descending:
https://api.dyntube.com/v1/channels?sort=Created:-1

#Sort by date created ascending:
https://api.dyntube.com/v1/channels?sort=Created:1

Code Samples

C#

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

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

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

                if (response.IsSuccessStatusCode)
                {
                    var responseContent = await response.Content.ReadAsStringAsync();
                    var responseData = JsonConvert.DeserializeObject<dynamic>(responseContent);

                    foreach (var channel in responseData.channels)
                    {
                        Console.WriteLine("Channel ID: " + channel.id);
                        Console.WriteLine("Channel Name: " + channel.name);
                        Console.WriteLine("Channel Description: " + channel.description);
                        Console.WriteLine("Channel Account ID: " + channel.accountId);
                        Console.WriteLine("Channel Created: " + channel.created);
                        Console.WriteLine("Channel Updated: " + channel.updated);
                        Console.WriteLine();
                    }
                }
                else
                {
                    Console.WriteLine("GET request failed with status code: " + response.StatusCode);
                }
            }
        }
    }
}

Node

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

const url = 'https://api.dyntube.com/v1/channels';
const options = {
  method: 'GET',
};

fetch(url, options)
  .then(res => res.json())
  .then(data => {
    const channels = data.channels;
    channels.forEach(channel => {
      console.log('Channel ID:', channel.id);
      console.log('Channel Name:', channel.name);
      console.log('Channel Description:', channel.description);
      console.log('Channel Account ID:', channel.accountId);
      console.log('Channel Created:', channel.created);
      console.log('Channel Updated:', channel.updated);
      console.log();
    });
  })
  .catch(err => console.error('GET request failed with error:', err));

Python

import requests

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

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

if response.status_code == 200:
    data = response.json()
    channels = data['channels']
    for channel in channels:
        print('Channel ID:', channel['id'])
        print('Channel Name:', channel['name'])
        print('Channel Description:', channel['description'])
        print('Channel Account ID:', channel['accountId'])
        print('Channel Created:', channel['created'])
        print('Channel Updated:', channel['updated'])
        print()
else:
    print(f'GET request failed with status code: {response.status_code}')

PHP

<?php

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

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

if ($response === false) {
    echo 'GET request failed: ' . curl_error($ch);
} else {
    $httpStatus = curl_getinfo($ch, CURLINFO_HTTP_CODE);
    if ($httpStatus == 200) {
        $data = json_decode($response, true);
        $channels = $data['channels'];
        foreach ($channels as $channel) {
            echo 'Channel ID: ' . $channel['id'] . PHP_EOL;
            echo 'Channel Name: ' . $channel['name'] . PHP_EOL;
            echo 'Channel Description: ' . $channel['description'] . PHP_EOL;
            echo 'Channel Account ID: ' . $channel['accountId'] . PHP_EOL;
            echo 'Channel Created: ' . $channel['created'] . PHP_EOL;
            echo 'Channel Updated: ' . $channel['updated'] . PHP_EOL;
            echo PHP_EOL;
        }
    } else {
        echo 'GET request failed with status code: ' . $httpStatus;
    }
}

curl_close($ch);
PreviousChannelsNextGet Channel

Last updated 2 years ago