Subscriptions

Create a Member

Create a New Member

Create a new member who can be granted access to subscription-protected videos or channels.

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

Send the request body as application/json. The example below shows the expected payload.

Headers

Name / Type / Description
NameTypeDescription
AuthorizationStringBearer YOUR_API_KEY
Content-TypeStringapplication/json

Sample Request Body

Here is a sample JSON request to create a member.

json
{
  "username": "[email protected]",
  "password": "Abcd1234",
  "status": 1
}

Code Samples

C#

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

namespace CreateMemberDemo
{
    class Program
    {
        static async Task Main(string[] args)
        {
            string url = "https://api.dyntube.com/v1/members";
            var member = new
            {
                username = "[email protected]",
                password = "Abcd1234",
                status = 1
            };

            using (var httpClient = new HttpClient())
            {
                httpClient.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", "YOUR_API_KEY");
                var json = JsonSerializer.Serialize(member);
                var content = new StringContent(json, Encoding.UTF8, "application/json");

                var response = await httpClient.PostAsync(url, content);

                if (response.IsSuccessStatusCode)
                {
                    Console.WriteLine("Member created successfully");
                }
                else
                {
                    Console.WriteLine($"Failed to create member. Status code: {response.StatusCode}");
                }
            }
        }
    }
}

Node.js

javascript
const https = require('https');
const axios = require('axios');

async function createMember() {
  const payload = {
    username: '[email protected]',
    password: 'Abcd1234',
    status: 1
  };

  const res = await axios.post('https://api.dyntube.com/v1/members', payload, {
    headers: { Authorization: 'Bearer YOUR_API_KEY' }
  });
  console.log(res.data);
}

createMember();

Python

python
import requests

url = "https://api.dyntube.com/v1/members"

payload = {
    "username": "[email protected]",
    "password": "Abcd1234",  # 8 characters including at least one uppercase letter, one lowercase letter, and a number
    "status": 1  # 1 for active status
}
headers = {
    "Content-Type": "application/json",
    "Authorization": "Bearer YOUR_API_KEY"
}

response = requests.post(url, headers=headers, json=payload)

if response.status_code == 200:
    print("Member created successfully.")
else:
    print("Failed to create member. Status code:", response.status_code)

PHP

php
<?php

$data = array(
    'username' => '[email protected]',
    'password' => 'Abcd1234',
    'status' => 1
);

$data_string = json_encode($data);

$ch = curl_init('https://api.dyntube.com/v1/members');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
    'Content-Type: application/json',
    'Content-Length: ' . strlen($data_string),
    'Authorization: Bearer YOUR_API_KEY'
));

$result = curl_exec($ch);

if ($result) {
    echo "Member created successfully.";
} else {
    echo "Failed to create member.";
}

curl_close($ch);
?>

Common Next Steps

After creating a member:

  • Attach plan to member to grant access.
  • Get a member to verify the member record.
  • Get member activity to review playback activity.
  • Get member's plans to confirm assigned plans.

Something missing or wrong here? Tell us and we will correct it. New to DynTube? Start with uploading and embedding.