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; }
}