Orders provides a list of all orders which can filtered based on provided parameters.

🚧

Make sure to replace [TT LAN IP]!

[TT LAN IP] in the example code provided is what should be replaced by what the local area network (LAN) assigned address of the Table Tracker gateway. (e.g. 192.168.1.232, 10.0.1.13, 192.168.0.324)

Please note that the code examples provided are only meant to provide an idea of what making a HTTP request to the API looks like.

GET /api/v2/orders?{&offset,limit,created_after,created_before,order_type,location_name}

Retrieve a list of orders in the system, starting at offset and returning a maximum limit of orders.

Query Parameters

NameDescriptionDetails
offsetThe starting point of the list.positive number, optional
default: 0
limitThe max number of orders to retrieve.positive number, optional
default: 25
max: 100
created_afterA query parameter to limit search to orders created after a specific datetime.datetime, optional
Date should be in ISO8601 format:
YYYY-MM-DDTHH:MM:SS
created_beforeA query parameter to limit search to orders created before a specific datetime.datetime, optional
Date should be in ISO8601 format:
YYYY-MM-DDTHH:MM:SS
order_typeA query parameter to limit search to orders of a particular type.string, optional
Valid values:
TO_GO
ON_PREMISE
location_nameA query parameter to limit search to orders at a particular location.positive number, optional

Example Request

// Order Query Example 1 (GET http://[TT LAN IP]:8000/api/v1/orders)

$.ajax({
    url: "http://[TT LAN IP]:8000/api/v2/orders",
    type: "GET",
    data:{
        "created_after":"2014-09-23T15:56:08",
    },
    headers:{
        "Authorization":"Bearer 2f1f4339c7b77fa3474bf8ba8852349273e928bb8ad9d186",
        "Content-Type":"application/json",
    },
})
.done(function(data, textStatus, jqXHR) {
    console.log("HTTP Request Succeeded: " + jqXHR.status);
    console.log(data);
})
.fail(function(jqXHR, textStatus, errorThrown) {
    console.log("HTTP Request Failed");
})
.always(function() {
    /* ... */
});
import java.io.IOException;
import org.apache.http.client.fluent.*;

public class SendRequest
{
  public static void main(String[] args) {
    sendRequest();
  }
  
  private static void sendRequest() {
    
    // Order Query Example 1 (GET )
    
    try {
      
      // Create request
      Content content = Request.Get("http://[TT LAN IP]:8000/api/v2/orders?created_after=2014-09-23T15%3A56%3A08")
      
      // Add headers
      .addHeader("Authorization", "Bearer 2f1f4339c7b77fa3474bf8ba8852349273e928bb8ad9d186")
      .addHeader("Content-Type", "application/json")
      
      // Fetch request and return content
      .execute().returnContent();
      
      // Print content
      System.out.println(content);
    }
    catch (IOException e) { System.out.println(e); }
  }
}
// Order Query Example 1 (GET http://[TT LAN IP]:8000/api/v1/orders)

NSURL* URL = [NSURL URLWithString:@"http://[TT LAN IP]:8000/api/v2/orders"];
NSDictionary* URLParams = @{
    @"created_after": @"2014-09-23T15:56:08",
};
URL = NSURLByAppendingQueryParameters(URL, URLParams);
NSMutableURLRequest* request = [NSMutableURLRequest requestWithURL:URL];
request.HTTPMethod = @"GET";

// Headers

[request addValue:@"Bearer 2f1f4339c7b77fa3474bf8ba8852349273e928bb8ad9d186" forHTTPHeaderField:@"Authorization"];
[request addValue:@"application/json" forHTTPHeaderField:@"Content-Type"];

// Connection

NSURLConnection* connection = [NSURLConnection connectionWithRequest:request delegate:nil];
[connection start];

/*
 * Utils: Add this section before your class implementation
 */

/**
 This creates a new query parameters string from the given NSDictionary. For
 example, if the input is @{@"day":@"Tuesday", @"month":@"January"}, the output
 string will be @"day=Tuesday&month=January".
 @param queryParameters The input dictionary.
 @return The created parameters string.
*/
static NSString* NSStringFromQueryParameters(NSDictionary* queryParameters)
{
    NSMutableArray* parts = [NSMutableArray array];
    [queryParameters enumerateKeysAndObjectsUsingBlock:^(id key, id value, BOOL *stop) {
        NSString *part = [NSString stringWithFormat: @"%@=%@",
            [key stringByAddingPercentEscapesUsingEncoding: NSUTF8StringEncoding],
            [value stringByAddingPercentEscapesUsingEncoding: NSUTF8StringEncoding]
        ];
        [parts addObject:part];
    }];
    return [parts componentsJoinedByString: @"&"];
}

/**
 Creates a new URL by adding the given query parameters.
 @param URL The input URL.
 @param queryParameters The query parameter dictionary to add.
 @return A new NSURL.
*/
static NSURL* NSURLByAppendingQueryParameters(NSURL* URL, NSDictionary* queryParameters)
{
    NSString* URLString = [NSString stringWithFormat:@"%@?%@",
        [URL absoluteString],
        NSStringFromQueryParameters(queryParameters),
    ];
    return [NSURL URLWithString:URLString];
}
curl -X "GET" "http://[TT LAN IP]:8000/api/v2/orders?created_after=2014-09-23T15%3A56%3A08" \
	-H "Authorization: Bearer 2f1f4339c7b77fa3474bf8ba8852349273e928bb8ad9d186" \
	-H "Content-Type: application/json"
# Install the Python Requests library:
# `pip install requests`

import requests

def send_request():
    # Order Query Example 1 (GET http://[TT LAN IP]:8000/api/v2/orders)

    try:
        r = requests.get(
            url="http://[TT LAN IP]:8000/api/v1/orders",
            params = {
                "created_after":"2014-09-23T15:56:08",
            },
            headers = {
                "Authorization":"Bearer 2f1f4339c7b77fa3474bf8ba8852349273e928bb8ad9d186",
                "Content-Type":"application/json",
            },
        )
        print('Response HTTP Status Code : {status_code}'.format(status_code=r.status_code))
        print('Response HTTP Response Body : {content}'.format(content=r.content))
    except requests.exceptions.RequestException as e:
        print('HTTP Request failed')

Responses

200 OK

{
  "status": 200,
  "returnCode": 8,
  "count": "7",
  "items": [
    {
      "locationName": null,
      "orderLocated": null,
      "uuid": "9e1da5eb-59ea-4003-9c1c-15160879c88d",
      "orderCleared": "2014-08-21T10:00:41+00:00",
      "orderType": "ON_PREMISE",
      "orderStarted": "2014-08-21T10:00:36+00:00",
      "type": "ORDER_SUMMARY",
      "name": "66"
    },
    {
      "locationName": null,
      "orderLocated": null,
      "uuid": "5d968a9c-77ec-41fd-aae8-54ef025b0f0d",
      "orderCleared": "2014-08-21T10:00:47+00:00",
      "orderType": "ON_PREMISE",
      "orderStarted": "2014-08-21T10:00:43+00:00",
      "type": "ORDER_SUMMARY",
      "name": "87"
    },
    {
      "locationName": "10",
      "orderLocated": "2014-08-21T10:05:55+00:00",
      "uuid": "85717acb-a36c-4cd1-847c-f3675f70f2e1",
      "orderCleared": "2014-08-21T10:06:04+00:00",
      "orderType": "ON_PREMISE",
      "orderStarted": "2014-08-21T10:05:27+00:00",
      "type": "ORDER_SUMMARY",
      "name": "66"
    },
    {
      "locationName": null,
      "orderLocated": null,
      "uuid": "57d5ad34-9977-44dc-8406-c1ece92ff85c",
      "orderCleared": "2014-08-21T13:13:57+00:00",
      "orderType": "ON_PREMISE",
      "orderStarted": "2014-08-21T13:13:35+00:00",
      "type": "ORDER_SUMMARY",
      "name": "87"
    },
    {
      "locationName": null,
      "orderLocated": null,
      "uuid": "27db2828-aa6d-44ab-8015-ac5b142be4e7",
      "orderCleared": "2014-08-21T13:13:46+00:00",
      "orderType": "ON_PREMISE",
      "orderStarted": "2014-08-21T13:13:33+00:00",
      "type": "ORDER_SUMMARY",
      "name": "66"
    },
    {
      "locationName": null,
      "orderLocated": null,
      "uuid": "f73e89fe-c32c-4595-9b8a-ad8dcf9791c6",
      "orderCleared": "2014-08-25T07:57:56+00:00",
      "orderType": "ON_PREMISE",
      "orderStarted": "2014-08-25T06:57:45+00:00",
      "type": "ORDER_SUMMARY",
      "name": "66"
    },
    {
      "locationName": "10",
      "orderLocated": "2014-08-21T10:05:59+00:00",
      "uuid": "a677aae2-d064-47d8-9ee3-8232da559b38",
      "orderCleared": "2014-08-21T10:06:01+00:00",
      "orderType": "ON_PREMISE",
      "orderStarted": "2014-08-21T10:05:19+00:00",
      "type": "ORDER_SUMMARY",
      "name": "87"
    }
  ]
}

400 Bad Request (Invalid Limit)

Returns if limit is not a valid positive integer.

{
  "status": 400,
  "message": "Invalid value for limit. Must be a positive integer.",
  "returnCode": -23
}

400 Bad Request (Invalid Offset)

Returns if offset is not a valid positive integer.

{
  "status": 400,
  "message": "Invalid value for offset. Must be a positive integer.",
  "returnCode": -24
}

400 Bad Request (Limit Over 100)

Returns if limit is greater than the maximum limit: 100

{
  "status": 400,
  "message": "Number of orders to return is over maximum limit of 100.",
  "returnCode": -26
}

400 Bad Request (Invalid Datetime Filters)

Returns if created_before or created_after is not in the correct format: YYYY-MM-DD HH:MM:SS

{
  "status": 400,
  "message": "Invalid date(s). Provided dates do not match format YYYY-MM-DDTHH:MM:SS.",
  "returnCode": -25
}

400 Bad Request (Invalid Location Name)

Returns if locationName provided is not a valid positive integer.

{
  "status": 400,
  "message": "Invalid location name. Must be a positive integer.",
  "returnCode": -10
}

400 Bad Request (Invalid Order Type)

Returns if orderType is not either TO_GO or ON_PREMISES

{
  "status": 400,
  "message": "Order type invalid. Must be either TO_GO or ON_PREMISES.",
  "returnCode": -12
}

GET /api/v2/orders/{UUID}

Retrieve a single order by its UUID.

📘

Single orders can only be retrieved by UUID.

Since there can be orders within the history of the gateway that has the same order number, it is not possible to retrieve a single order by number.

URI Parameters

NameDescriptionType
UUIDThe UUID of the order to retrieve.string, required

Example Request

// Get Order by UUID (GET http://10.0.1.2:8000/api/v1/orders/4d033706-a736-459e-9db0-3727b89c198b)

$.ajax({
    url: "http://[TT LAN IP]:8000/api/v2/orders/4d033706-a736-459e-9db0-3727b89c198b",
    type: "GET",
    headers:{
        "Authorization":"Bearer 2f1f4339c7b77fa3474bf8ba8852349273e928bb8ad9d186",
        "Content-Type":"application/json",
    },
})
.done(function(data, textStatus, jqXHR) {
    console.log("HTTP Request Succeeded: " + jqXHR.status);
    console.log(data);
})
.fail(function(jqXHR, textStatus, errorThrown) {
    console.log("HTTP Request Failed");
})
.always(function() {
    /* ... */
});
import java.io.IOException;
import org.apache.http.client.fluent.*;

public class SendRequest
{
  public static void main(String[] args) {
    sendRequest();
  }
  
  private static void sendRequest() {
    
    // Get Order by UUID (GET )
    
    try {
      
      // Create request
      Content content = Request.Get("http://[TT LAN IP]:8000/api/v2/orders/4d033706-a736-459e-9db0-3727b89c198b")
      
      // Add headers
      .addHeader("Authorization", "Bearer 2f1f4339c7b77fa3474bf8ba8852349273e928bb8ad9d186")
      .addHeader("Content-Type", "application/json")
      
      // Fetch request and return content
      .execute().returnContent();
      
      // Print content
      System.out.println(content);
    }
    catch (IOException e) { System.out.println(e); }
  }
}
// Get Order by UUID (GET http://10.0.1.2:8000/api/v1/orders/4d033706-a736-459e-9db0-3727b89c198b)

NSURL* URL = [NSURL URLWithString:@"http://[TT LAN IP]:8000/api/v2/orders/4d033706-a736-459e-9db0-3727b89c198b"];
NSMutableURLRequest* request = [NSMutableURLRequest requestWithURL:URL];
request.HTTPMethod = @"GET";

// Headers

[request addValue:@"Bearer 2f1f4339c7b77fa3474bf8ba8852349273e928bb8ad9d186" forHTTPHeaderField:@"Authorization"];
[request addValue:@"application/json" forHTTPHeaderField:@"Content-Type"];

// Connection

NSURLConnection* connection = [NSURLConnection connectionWithRequest:request delegate:nil];
[connection start];
curl -X "GET" "http://[TT LAN IP]:8000/api/v2/orders/4d033706-a736-459e-9db0-3727b89c198b" \
	-H "Authorization: Bearer 2f1f4339c7b77fa3474bf8ba8852349273e928bb8ad9d186" \
	-H "Content-Type: application/json"
# Install the Python Requests library:
# `pip install requests`

import requests

def send_request():
    # Get Order by UUID (GET http://[TT LAN IP]:8000/api/v1/orders/4d033706-a736-459e-9db0-3727b89c198b)

    try:
        r = requests.get(
            url="http://[TT LAN IP]:8000/api/v2/orders/4d033706-a736-459e-9db0-3727b89c198b",
            headers = {
                "Authorization":"Bearer 2f1f4339c7b77fa3474bf8ba8852349273e928bb8ad9d186",
                "Content-Type":"application/json",
            },
        )
        print('Response HTTP Status Code : {status_code}'.format(status_code=r.status_code))
        print('Response HTTP Response Body : {content}'.format(content=r.content))
    except requests.exceptions.RequestException as e:
        print('HTTP Request failed')

Responses

200 OK

{
  "status": 200,
  "returnCode": 9,
  "order": {
    "locationName": null,
    "orderLocated": null,
    "uuid": "9e1da5eb-59ea-4003-9c1c-15160879c88d",
    "orderCleared": "2014-08-21T10:00:41+00:00",
    "orderType": "ON_PREMISE",
    "orderStarted": "2014-08-21T10:00:36+00:00",
    "type": "ORDER_SUMMARY",
    "name": "66"
  }
}

400 Bad Request (UUID is Invalid)

Returns if UUID is invalid.

{
  "status": 400,
  "message": "Invalid UUID. Must be in the format XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX.",
  "returnCode": -27
}

404 Not Found (Order with UUID does not exist)

Returns if order cannot be found with provided UUID.

{
  "status": 404,
  "message": "Order not found.",
  "returnCode": -6
}