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

NameTypeDescription

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"
        }
    ]
}

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);

Last updated