Active orders
Active Orders are orders that not yet delivered to the table or waiting TO_GO
customer. "To Go" orders are often paged to let the customer know they can pickup their order. It is also possible that the "To Go" customer has sat down at a table, which also allows for food delivery.
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/v1/activeorders
Retrieve all active orders.
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:{
"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("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:@"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"
# 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 = {
"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')
Response 200 (application/json)
{
"status": 200,
"count": "4",
"items": [
{
"elapsedTime": 98,
"uuid": "692945a2-0620-4cc3-9104-ab96d5bd82f8",
"created": "2014-08-25T14:01:53",
"orderType": "ON_PREMISE",
"paged": "No",
"locationName": "10",
"state": "located",
"stateStarted": "2014-08-25T14:02:17",
"name": "87"
},
{
"elapsedTime": 96,
"uuid": "8d6e92aa-cf4d-4e1a-88e3-46e83d2458ee",
"created": "2014-08-25T14:01:55",
"orderType": "ON_PREMISE",
"paged": "No",
"locationName": "",
"state": "started",
"stateStarted": "2014-08-25T14:01:55",
"name": "79"
},
{
"elapsedTime": 91,
"uuid": "0148b499-40b8-44f0-8814-6f29c187074d",
"created": "2014-08-25T14:02:00",
"orderType": "ON_PREMISE",
"paged": "No",
"locationName": "10",
"state": "located",
"stateStarted": "2014-08-25T14:02:44",
"name": "12"
},
{
"elapsedTime": 21,
"uuid": "c49ee4d4-0118-448f-bce0-7b2c9b3a1e82",
"created": "2014-08-25T14:03:10",
"orderType": "ON_PREMISE",
"paged": "No",
"locationName": "",
"state": "started",
"stateStarted": "2014-08-25T14:03:10",
"name": "28"
}
]
}
GET /api/v1/activeorders/{name|uuid}
Request active order with name or UUID.
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/66",
type: "GET",
headers:{
"Authorization":"Basic MGE5YWViNDQtNjU0Yy00NGRjLWFhMjYtNjA5YWQzMTg2NTRkOg==",
"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/66")
// Add headers
.addHeader("Content-Type", "application/json")
.addHeader("Authorization", "Basic MGE5YWViNDQtNjU0Yy00NGRjLWFhMjYtNjA5YWQzMTg2NTRkOg==")
// 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/66"];
NSMutableURLRequest* request = [NSMutableURLRequest requestWithURL:URL];
request.HTTPMethod = @"GET";
// Headers
[request addValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
[request addValue:@"Basic MGE5YWViNDQtNjU0Yy00NGRjLWFhMjYtNjA5YWQzMTg2NTRkOg==" 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: Basic MGE5YWViNDQtNjU0Yy00NGRjLWFhMjYtNjA5YWQzMTg2NTRkOg=="
# 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 = {
"Content-Type":"application/json",
"Authorization": "Basic MGE5YWViNDQtNjU0Yy00NGRjLWFhMjYtNjA5YWQzMTg2NTRkOg=="
},
)
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')
Response 200 (application/json)
{
"status": 200,
"activeorder": {
"uuid": "54ed91e6-286b-4912-b44c-7a7a3001d715",
"created": "2014-08-25T08:09:42",
"orderType": "ON_PREMISE",
"locationName": "",
"state": "cleared",
"stateStarted": "2014-08-25T08:09:50",
"name": "66"
}
}
POST /api/v1/activeorders
Start or locate an active order. POST data should be in JSON.
POST data parameters
Name | Description | Details |
---|---|---|
name | Order identifier. | positive number, required. |
orderType | Order type. | Valid values: ON_PREMISES TO_GO |
locationName | Identifier of where the order will be located. (i.e. Usually a table number) | positive number, optional. |
Request
// Start Order 66 (POST http://[TT LAN IP]:8000/api/v1/activeorders)
// Using jQuery
$.ajax({
url: "http://[TT LAN IP]:8000/api/v1/activeorders",
type: "POST",
headers:{
"Authorization":"Basic MGE5YWViNDQtNjU0Yy00NGRjLWFhMjYtNjA5YWQzMTg2NTRkOg==",
"Content-Type":"application/json",
},
contentType:"application/json",
data:JSON.stringify({
"name": "66",
"orderType": "ON_PREMISES"
})
})
.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.*;
import org.apache.http.entity.ContentType;
public class SendRequest
{
public static void main(String[] args) {
sendRequest();
}
private static void sendRequest() {
// Start Order 66 (POST )
try {
// Create request
Content content = Request.Post("http://[TT LAN IP]:8000/api/v1/activeorders")
// Add headers
.addHeader("Authorization", "Basic MGE5YWViNDQtNjU0Yy00NGRjLWFhMjYtNjA5YWQzMTg2NTRkOg==")
.addHeader("Content-Type", "application/json")
// Add body
.bodyString("{\"name\": \"66\",\"orderType\": \"ON_PREMISES\"}", ContentType.APPLICATION_JSON)
// Fetch request and return content
.execute().returnContent();
// Print content
System.out.println(content);
}
catch (IOException e) { System.out.println(e); }
}
}
// Start Order 66 (POST 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 = @"POST";
// Headers
[request addValue:@"Basic MGE5YWViNDQtNjU0Yy00NGRjLWFhMjYtNjA5YWQzMTg2NTRkOg==" forHTTPHeaderField:@"Authorization"];
[request addValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
// JSON Body
NSDictionary* bodyObject = @{
@"name": @"66",
@"orderType": @"ON_PREMISES"
};
request.HTTPBody = [NSJSONSerialization dataWithJSONObject:bodyObject options:kNilOptions error:NULL];
// Connection
NSURLConnection* connection = [NSURLConnection connectionWithRequest:request delegate:nil];
[connection start];
curl -X "POST" "http://[TT LAN IP]:8000/api/v1/activeorders" \
-H "Authorization: Basic MGE5YWViNDQtNjU0Yy00NGRjLWFhMjYtNjA5YWQzMTg2NTRkOg==" \
-H "Content-Type: application/json" \
-d "{ \"name\":\"66\", \"orderType\":\"ON_PREMISES\"}"
# Install the Python Requests library:
# `pip install requests`
import requests
import json
def send_request():
# Start Order 66 (POST http://[TT LAN IP]:8000/api/v1/activeorders)
try:
r = requests.post(
url="http://[TT LAN IP]:8000/api/v1/activeorders",
headers = {
"Authorization":"Basic MGE5YWViNDQtNjU0Yy00NGRjLWFhMjYtNjA5YWQzMTg2NTRkOg==",
"Content-Type":"application/json",
},
data = json.dumps({
"name": "66",
"orderType": "ON_PREMISES"
})
)
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')
Response 200 (application/json)
{
"status": 200,
"activeorder": {
"uuid": "f73e89fe-c32c-4595-9b8a-ad8dcf9791c6",
"created": "2014-08-25T06:57:45",
"orderType": "ON_PREMISE",
"locationName": "",
"state": "started",
"stateStarted": "2014-08-25T06:57:45",
"name": "66"
}
}
Response 400 (application/json)
Returned when a tracker has never been started with a physical "starter" unit.
{
"status": 400,
"message": "Order Can not be Processed. Please use Tracker with Starter unit once and try again"
}
Response 400 (application/json)
Returned if required order name is omitted.
{
"status": 400,
"message": "No order number supplied in request"
}
Response 400 (application/json)
Returned if order name is not a valid positive number.
{
"status": 400,
"message": "Order name must be a positive integer."
}
Response 400 (application/json)
Returned in optional location name is not a valid number.
{
"status": 400,
"message": "locationName must a positive integer."
}
Note:
To facilitate testing the API, a special query parameter named dummy_tracker_address can be included. Trackers have an address and it is captured when a tracker is started via a "starter" unit. Tracker addresses are saved by the gateway, so this only needs to be done once.
Example:
http://10.0.1.2:8000/api/v1/activeorders?dummy_tracker_address=true
In production, this parameter would NEVER be used.
DELETE /api/v1/activeorders/{name}
Clear an active order by its name
.
Parameters
Name | Description | Details |
---|---|---|
name | The active order number. | number, required |
Request
// Clear Order 66 (DELETE http://[TT LAN IP]:8000/api/v1/activeorders/66)
// Using jQuery
$.ajax({
url: "http://[TT LAN IP]:8000/api/v1/activeorders/66",
type: "DELETE",
headers:{
"Authorization":"Basic MGE5YWViNDQtNjU0Yy00NGRjLWFhMjYtNjA5YWQzMTg2NTRkOg==",
"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() {
// Clear Order 66 (DELETE )
try {
// Create request
Content content = Request.Delete("http://[TT LAN IP]:8000/api/v1/activeorders/66")
// Add headers
.addHeader("Authorization", "Basic MGE5YWViNDQtNjU0Yy00NGRjLWFhMjYtNjA5YWQzMTg2NTRkOg==")
.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); }
}
}
// Clear Order 66 (DELETE http://[TT LAN IP]:8000/api/v1/activeorders/66)
NSURL* URL = [NSURL URLWithString:@"http://[TT LAN IP]:8000/api/v1/activeorders/66"];
NSMutableURLRequest* request = [NSMutableURLRequest requestWithURL:URL];
request.HTTPMethod = @"DELETE";
// Headers
[request addValue:@"Basic MGE5YWViNDQtNjU0Yy00NGRjLWFhMjYtNjA5YWQzMTg2NTRkOg==" forHTTPHeaderField:@"Authorization"];
[request addValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
// Connection
NSURLConnection* connection = [NSURLConnection connectionWithRequest:request delegate:nil];
[connection start];
curl -X "DELETE" "http://[TT LAN IP]:8000/api/v1/activeorders/66" \
-H "Authorization: Basic MGE5YWViNDQtNjU0Yy00NGRjLWFhMjYtNjA5YWQzMTg2NTRkOg==" \
-H "Content-Type: application/json"
# Install the Python Requests library:
# `pip install requests`
import requests
def send_request():
# Clear Order 66 (DELETE http://[TT LAN IP]:8000/api/v1/activeorders/66)
try:
r = requests.delete(
url="http://[TT LAN IP]:8000/api/v1/activeorders/66",
headers = {
"Authorization":"Basic MGE5YWViNDQtNjU0Yy00NGRjLWFhMjYtNjA5YWQzMTg2NTRkOg==",
"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')
Response 200 (application/json)
{
"status": 200,
"activeorder": {
"uuid": "54ed91e6-286b-4912-b44c-7a7a3001d715",
"created": "2014-08-25T08:09:42",
"orderType": "ON_PREMISE",
"locationName": "",
"state": "cleared",
"stateStarted": "2014-08-25T08:09:50",
"name": "66"
}
}
Response 404 (application/json)
Returned when order is not active.
{
"status": 404,
"message": "Order [NAME] is inactive or does not exist."
}
POST /api/v1/activeorders/{name}/page
Pages an active order by its name
.
Request
// Page Order 66 (POST http://[TT LAN IP]:8000/api/v1/activeorders/66/page)
// Using jQuery
$.ajax({
url: "http://[TT LAN IP]:8000/api/v1/activeorders/66/page",
type: "POST",
headers:{
"Content-Type":"application/json",
},
contentType:"application/json",
data:JSON.stringify({
"tracking": "true"
})
})
.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.*;
import org.apache.http.entity.ContentType;
public class SendRequest
{
public static void main(String[] args) {
sendRequest();
}
private static void sendRequest() {
// Page Order 66 (POST )
try {
// Create request
Content content = Request.Post("http://[TT LAN IP]:8000/api/v1/activeorders/66/page")
// Add headers
.addHeader("Content-Type", "application/json")
// Add body
.bodyString("{\"tracking\": \"true\"}", ContentType.APPLICATION_JSON)
// Fetch request and return content
.execute().returnContent();
// Print content
System.out.println(content);
}
catch (IOException e) { System.out.println(e); }
}
}
// Page Order 66 (POST http://[TT LAN IP]:8000/api/v1/activeorders/66/page)
NSURL* URL = [NSURL URLWithString:@"http://[TT LAN IP]:8000/api/v1/activeorders/66/page"];
NSMutableURLRequest* request = [NSMutableURLRequest requestWithURL:URL];
request.HTTPMethod = @"POST";
// Headers
[request addValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
// JSON Body
NSDictionary* bodyObject = @{
@"tracking": @"true"
};
request.HTTPBody = [NSJSONSerialization dataWithJSONObject:bodyObject options:kNilOptions error:NULL];
// Connection
NSURLConnection* connection = [NSURLConnection connectionWithRequest:request delegate:nil];
[connection start];
curl -X "POST" "http://[TT LAN IP]:8000/api/v1/activeorders/66/page" \
-H "Content-Type: application/json" \
-d "{\"tracking\" : \"true\"}"
# Install the Python Requests library:
# `pip install requests`
import requests
import json
def send_request():
# Page Order 66 (POST http://[TT LAN IP]:8000/api/v1/activeorders/66/page)
try:
r = requests.post(
url="http://[TT LAN IP]:8000/api/v1/activeorders/66/page",
headers = {
"Content-Type":"application/json",
},
data = json.dumps({
"tracking": "true"
})
)
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')
Response 200 (application/json)
{
"status": 200,
"activeorder": {
"uuid": "54ed91e6-286b-4912-b44c-7a7a3001d715",
"created": "2014-08-25T08:09:42",
"orderType": "ON_PREMISE",
"locationName": "",
"state": "located",
"stateStarted": "2014-08-25T08:09:50",
"name": "66"
}
}
Response 404 (application/json)
Returned when order is not active.
{
"status": 404,
"message": "Order [NAME] is inactive or does not exist."
}
Updated less than a minute ago