Skip to content
This repository has been archived by the owner on Jun 24, 2021. It is now read-only.

GetOrders()

hitmanpt edited this page Feb 8, 2017 · 2 revisions

Through this explanation we assume that you have using WHMCS_API; on the begining of the file
And the API() class initialized as _api
If needed check the Getting Started page

Contents


Function Overview

Prototype: public GetOrders.GetOrders GetOrders(int LimitStart = 0, int LimitNumber = 25, int OrderID = -1, int UserID = -1, string Status = "")

Input:

  • LimitStart: The offset for the returned log data (optional [default: 0])
  • LimitNumber: The number of records to return (optional [default: 25])
  • OrderID: The specific order id to obtain the details for (optional)
  • UserID: The client id to obtain the details for (optional)
  • Status: Find orders for a specific status (optional)

Output: GetOrders Model


Function Details

To call it just use GetOrders.GetOrders orders = _api.GetOrders(UserID: 1);

This call to the function will ignore all arguments except ClientID

The GetClientsProducts model is inside it's own namespace (more info)

View all details about GetOrders Model

WHMCS API Reference: https://developers.whmcs.com/api-reference/getorders/

Donate


Full example

using WHMCS_API;

namespace YourApp
{
  class YourClass
  {
    public void YourFunction()
    {
       API _api = new API("username", "password", "accesskey", "url");
       GetOrders.GetOrders orders = _api.GetOrders(OrderID: 1);
       Console.WriteLine("There are {0} items in this order", orders.Orders.Order.FirstOrDefault().LineItems.LineItems.Count());
       foreach(GetOrders.Lineitem item in orders.Orders.Order.FirstOrDefault().LineItems.LineItem)
       {
         Console.WriteLine("Item Name: {0}", item.Product);
       }
    }
  }
}