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 a List of Member's plans
  • Get a list of plans for a member. You can filter or sort results based on optional query string.
  • Sorting of results
  • Code Samples
  • C#
  • Node.js
  • Python
  • PHP
  1. Reference
  2. Subscriptions

Get Member's Plans

Get a List of Member's plans

Get a list of plans for a member. You can filter or sort results based on optional query string.

GET https://api.dyntube.com/v1/member-plans

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.

memberId

String

Id of a particular member

{
    "pager": {
        "page": 1,
        "totalPages": 1,
        "totalResults": 1,
        "sort": "Created:-1"
    },
    "plans": [
        {
            "id": "o8ycm3A",
            "name": " Access To Channel",
            "storePlanType": 1,
            "planId": "ggovA",
            "memberId": "gDbyQtqg",
            "status": 1,
            "created": "2022-10-29T03:40:05.0137275+00:00",
            "updated": "2022-10-29T03:40:05.0232359+00:00"
        }
    ]
}
{
    // Response
}
{
    // Response
}

Sorting of results

The sorting order of the results 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/member-plans?sort=Created:-1

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

Code Samples

C#

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

class Program
{
    static async Task Main(string[] args)
    {
        string url = "https://api.dyntube.com/v1/member-plans?sort=Created:-1";

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

            if (response.IsSuccessStatusCode)
            {
                var content = await response.Content.ReadAsStringAsync();
                var data = JsonConvert.DeserializeObject<MemberPlans>(content);

                foreach (var plan in data.Plans)
                {
                    Console.WriteLine("Plan ID: {0}", plan.Id);
                    Console.WriteLine("Name: {0}", plan.Name);
                    Console.WriteLine("Store Plan Type: {0}", plan.StorePlanType);
                    Console.WriteLine("Plan ID: {0}", plan.PlanId);
                    Console.WriteLine("Member ID: {0}", plan.MemberId);
                    Console.WriteLine("Status: {0}", plan.Status);
                    Console.WriteLine("Created: {0}", plan.Created);
                    Console.WriteLine("Updated: {0}", plan.Updated);
                    Console.WriteLine();
                }
            }
            else
            {
                Console.WriteLine($"Failed to get member's plans. Status code: {response.StatusCode}");
            }
        }
    }
}

class MemberPlans
{
    public Pager Pager { get; set; }
    public Plan[] Plans { get; set; }
}

class Pager
{
    public int Page { get; set; }
    public int TotalPages { get; set; }
    public int TotalResults { get; set; }
    public string Sort { get; set; }
}

class Plan
{
    public string Id { get; set; }
    public string Name { get; set; }
    public int StorePlanType { get; set; }
    public string PlanId { get; set; }
    public string MemberId { get; set; }
    public int Status { get; set; }
    public string Created { get; set; }
    public string Updated { get; set; }
}

Node.js

const axios = require('axios');

const memberId = 'meemberId1';
const apiUrl = `https://api.dyntube.com/v1/member-plans?memberId=${memberId}&sort=Created:-1`;

axios.get(apiUrl)
  .then(response => {
    console.log(response.data);
  })
  .catch(error => {
    console.log(error);
  });

Python

import requests

member_id = 'meemberId1'
api_url = f'https://api.dyntube.com/v1/member-plans?memberId={member_id}&sort=Created:-1'

response = requests.get(api_url)
if response.status_code == 200:
    print(response.json())
else:
    print(f'Error getting member plans: {response.status_code}')

PHP

<?php

$memberId = 'meemberId1';
$url = "https://api.dyntube.com/v1/member-plans?memberId={$memberId}&sort=Created:-1";

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => $url,
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'GET',
  CURLOPT_HTTPHEADER => array(
    'Content-Type: application/json'
  ),
));

$response = curl_exec($curl);

curl_close($curl);

echo $response;
PreviousGet MembersNextDelete a Plan

Last updated 6 months ago