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

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

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;

Last updated