Get Members

Get a List of Members

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

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

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": 7,
        "totalResults": 7,
        "sort": "Created:-1"
    },
    "members": [
        {
            "id": "OIFTl6w",
            "key": "rtGP2Vkqg",
            "name": "",
            "username": "demo@demo.com",
            "password": "",
            "storePlanType": 1,
            "status": 1,
            "created": "2020-08-05T10:24:05.128192+00:00",
            "updated": "2020-01-04T11:21:17.7811342+00:00"
        }
    ]
}

Filtering of results

You can filter the results like this:

The following URL will get 20 members, with username containing the provided 'keywords'.

https://api.dyntube.com/v1/members?size=20&keywords=dev&sort=Created:-1

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/members?sort=Created:-1

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

Code Samples

C#

using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text.Json;
using System.Threading.Tasks;

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

        using (var httpClient = new HttpClient())
        {
            httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", "your_access_token_here");

            var response = await httpClient.GetAsync(url);

            if (response.IsSuccessStatusCode)
            {
                var responseBody = await response.Content.ReadAsStringAsync();

                var json = JsonSerializer.Deserialize<MembersResponse>(responseBody);

                foreach (var member in json.Members)
                {
                    Console.WriteLine($"Member ID: {member.Id}");
                    Console.WriteLine($"Username: {member.Username}");
                    Console.WriteLine($"Status: {member.Status}");
                    Console.WriteLine();
                }
            }
            else
            {
                Console.WriteLine($"Failed to get members. Status code: {response.StatusCode}");
            }
        }
    }
}

public class MembersResponse
{
    public Pager Pager { get; set; }
    public Member[] Members { get; set; }
}

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

public class Member
{
    public string Id { get; set; }
    public string Key { get; set; }
    public string Name { get; set; }
    public string Username { get; set; }
    public string Password { get; set; }
    public int StorePlanType { get; set; }
    public int Status { get; set; }
    public DateTime Created { get; set; }
    public DateTime Updated { get; set; }
}

Node.js

const axios = require('axios');

const getMembers = async () => {
  try {
    const response = await axios.get('https://api.dyntube.com/v1/members');
    const members = response.data.members;
    console.log(members);
  } catch (error) {
    console.error(error);
  }
};

getMembers();
j

Python

import requests

url = "https://api.dyntube.com/v1/members"
response = requests.get(url)

if response.status_code == 200:
    data = response.json()
    members = data["members"]
    for member in members:
        print(member)
else:
    print("Failed to get members. Status code:", response.status_code)

PHP

$url = "https://api.dyntube.com/v1/members";
$response = file_get_contents($url);

if ($response) {
    $data = json_decode($response, true);
    $members = $data["members"];
    foreach ($members as $member) {
        print_r($member);
    }
} else {
    echo "Failed to get members.";
}

Last updated