Retrieving Order(s)

View single or all available active orders.

GET /api/v2/activeorders [SECURED]

Retrieve all active orders.

Example Request

// Get Active Orders (GET http://[TT LAN IP]:8000/api/v1/activeorders)
// Using jQuery

$.ajax({
    url: "http://[TT LAN IP]:8000/api/v1/activeorders",
    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 Active Orders (GET )
    
    try {
      
      // Create request
      Content content = Request.Get("http://[TT LAN IP]:8000/api/v1/activeorders")
      
      // 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 Active Orders (GET http://[TT LAN IP]:8000/api/v1/activeorders)

NSURL* URL = [NSURL URLWithString:@"http://[TT LAN IP]:8000/api/v1/activeorders"];
NSMutableURLRequest* request = [NSMutableURLRequest requestWithURL:URL];
request.HTTPMethod = @"GET";

// Headers
[request.addValue:@"Bearer 2f1f4339c7b77fa3474bf8ba8852349273e928bb8ad9d186" for HTTPHeaderField:@"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/v1/activeorders" \
    -H "Content-Type: application/json" -H "Authorization: Bearer 2f1f4339c7b77fa3474bf8ba8852349273e928bb8ad9d186"
# Install the Python Requests library:
# `pip install requests`

import requests

def send_request():
    # Get Active Orders (GET http://[TT LAN IP]:8000/api/v1/activeorders)

    try:
        r = requests.get(
            url="http://[TT LAN IP]:8000/api/v1/activeorders",
            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": 5,
  "count": 2,
  "items": [
    {
      "name": "102",
      "uuid": "f8853c42-3c10-4636-81e3-a3aeb65d9219",
      "orderType": "ON_PREMISE",
      "locationName": "",
      "state": "started",
      "created": "2016-09-22T19:08:52",
      "stateChanged": "2016-09-22T19:08:52",
      "paged": false,
      "elapsedTime": 0
    },
    {
      "name": "6",
      "uuid": "98a3c77c-9aa0-4eea-a17a-93b2f905a6f1",
      "orderType": "ON_PREMISE",
      "locationName": "",
      "state": "started",
      "created": "2016-09-22T19:08:56",
      "stateChanged": "2016-09-22T19:08:56",
      "paged": false,
      "elapsedTime": 0
    }
  ]
}

GET /api/v2/activeorders/{number or UUID} [SECURED]

Request active order by order number or UUID.

Example Request (By order number)

// Get Active Orders (GET http://[TT LAN IP]:8000/api/v1/activeorders)
// Using jQuery

$.ajax({
    url: "http://[TT LAN IP]:8000/api/v1/activeorders/27",
    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 Active Orders (GET )
    
    try {
      
      // Create request
      Content content = Request.Get("http://[TT LAN IP]:8000/api/v1/activeorders/27")
      
      // Add headers
      .addHeader("Content-Type", "application/json")
      .addHeader("Authorization",  "Basic 2f1f4339c7b77fa3474bf8ba8852349273e928bb8ad9d186")
      
      // Fetch request and return content
      .execute().returnContent();
      
      // Print content
      System.out.println(content);
    }
    catch (IOException e) { System.out.println(e); }
  }
}
// Get Active Orders (GET http://[TT LAN IP]:8000/api/v1/activeorders/27)

NSURL* URL = [NSURL URLWithString:@"http://[TT LAN IP]:8000/api/v1/activeorders/27"];
NSMutableURLRequest* request = [NSMutableURLRequest requestWithURL:URL];
request.HTTPMethod = @"GET";

// Headers

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

// Connection

NSURLConnection* connection = [NSURLConnection connectionWithRequest:request delegate:nil];
[connection start];
curl -X "GET" "http://[TT LAN IP]:8000/api/v1/activeorders/66" \
    -H "Content-Type: application/json" -H "Authorization: Bearer 2f1f4339c7b77fa3474bf8ba8852349273e928bb8ad9d186"
# Install the Python Requests library:
# `pip install requests`

import requests

def send_request():
    # Get Active Orders (GET http://[TT LAN IP]:8000/api/v1/activeorders)

    try:
        r = requests.get(
            url="http://[TT LAN IP]:8000/api/v1/activeorders/27",
            headers = {
                "Content-Type":"application/json",
                    "Authorization": "Bearer 2f1f4339c7b77fa3474bf8ba8852349273e928bb8ad9d186"
            },
        )
        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

Returned order found is a ON_PREMISE order where the customer is awaiting his food at table 207.

{
  "status": 200,
  "returnCode": 6,
  "activeorder": {
    "name": "27",
    "uuid": "66565bd2-5c3e-4b2d-80ff-82cfc1dd2f76",
    "orderType": "ON_PREMISE",
    "locationName": "207",
    "state": "located",
    "stateChanged": "2016-06-10T15:10:08",
    "created": "2016-06-10T15:08:43",
    "paged": false,
    "elapsedTime": 0
  }
}

400 Bad Request

Invalid Order ID (Neither UUID or number)

{
  "status": 400,
  "message": "Invalid order id. Must be an integer or a valid UUID.",
  "returnCode": -7
}

404 Not Found

Active order not found. Suggests that an order may have been cleared and is in the order history.

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