Get Channel
Get a single channel
This endpoint will return a single channel with the provided Id.
GET
https://api.dyntube.com/v1/channels/{id}
Path Parameters
Name
Type
Description
id
String
Channel id
{
"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"
}
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 channelId = "Yy95faA";
string url = $"https://api.dyntube.com/v1/channels/{channelId}";
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);
Console.WriteLine("Channel ID: " + responseData.id);
Console.WriteLine("Channel Name: " + responseData.name);
Console.WriteLine("Channel Description: " + responseData.description);
Console.WriteLine("Channel Account ID: " + responseData.accountId);
Console.WriteLine("Channel Created: " + responseData.created);
Console.WriteLine("Channel Updated: " + responseData.updated);
}
else
{
Console.WriteLine("GET request failed with status code: " + response.StatusCode);
}
}
}
}
}
Node
const fetch = require('node-fetch');
const channelId = 'Yy95faA';
const url = `https://api.dyntube.com/v1/channels/${channelId}`;
const options = {
method: 'GET',
};
fetch(url, options)
.then(res => res.json())
.then(data => {
console.log('Channel ID:', data.id);
console.log('Channel Name:', data.name);
console.log('Channel Description:', data.description);
console.log('Channel Account ID:', data.accountId);
console.log('Channel Created:', data.created);
console.log('Channel Updated:', data.updated);
})
.catch(err => console.error('GET request failed with error:', err));
ja
Python
import requests
channel_id = 'Yy95faA'
url = f'https://api.dyntube.com/v1/channels/{channel_id}'
headers = {'Content-Type': 'application/json'}
response = requests.get(url, headers=headers)
if response.status_code == 200:
data = response.json()
print('Channel ID:', data['id'])
print('Channel Name:', data['name'])
print('Channel Description:', data['description'])
print('Channel Account ID:', data['accountId'])
print('Channel Created:', data['created'])
print('Channel Updated:', data['updated'])
else:
print(f'GET 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_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);
echo 'Channel ID: ' . $data['id'] . PHP_EOL;
echo 'Channel Name: ' . $data['name'] . PHP_EOL;
echo 'Channel Description: ' . $data['description'] . PHP_EOL;
echo 'Channel Account ID: ' . $data['accountId'] . PHP_EOL;
echo 'Channel Created: ' . $data['created'] . PHP_EOL;
echo 'Channel Updated: ' . $data['updated'] . PHP_EOL;
} else {
echo 'GET request failed with status code: ' . $httpStatus;
}
}
curl_close($ch);
Last updated