Paging Order

Paging or locating an order.

📘

Paging a Tracker

To page an order means to page the tracker assigned to that order, but it is currently not possible to page a tracker by itself without any binding order.

URI Parameters

NameTypeDetails
nameintegerThe active order number to page.
UUIDstringThe active order unique identifier to page.

POST /api/v2/activeorders/{name or UUID}/page [SECURED]

Pages an active order by its name or UUID.

Body Parameters

PropertyTypeDetails
trackingbooleanSignifies whether tracker bound to order should be continuously paged.
Default: true

Example Request (Paging by Order Number)

// Page Order 26 (POST http://[TT LAN IP]:8000/api/v2/activeorders/26/page)
// Using jQuery

$.ajax({
    url: "http://[TT LAN IP]:8000/api/v2/activeorders/26/page",
    type: "POST",
    headers:{
        "Content-Type":"application/json",
    },
    contentType:"application/json",
    data:JSON.stringify({
        "tracking": "false"
    })
})
.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/v2/activeorders/26/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/v2/activeorders/26/page)

NSURL* URL = [NSURL URLWithString:@"http://[TT LAN IP]:8000/api/v2/activeorders/26/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/v2/activeorders/26/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/v2/activeorders/26/page)

    try:
        r = requests.post(
            url="http://[TT LAN IP]:8000/api/v2/activeorders/26/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')

Responses

200 OK (Order found and successfully paged)

{
          "status": 200,
          "returnCode": 7,
          "activeorder": {
            "uuid": "e88b9edd-6d14-4d1e-a533-ec61e01ba43e",
            "created": "2016-09-08T17:19:54",
            "orderType": "ON_PREMISE",
            "locationName": "203",
            "state": "located",
            "stateChanged": "2016-09-08T17:32:23",
            "name": "26",
            "paged": true,
            "elapsedTime": 0
          }
        }

400 Bad Request (Invalid Order identifier)

Order identifier is neither a order number or a UUID string in URL.

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

404 Not Found (Active Order Not Found)

Returned when active order not found.

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

404 Not Found (Tracker Not Found)

Returned when tracker for an active order does not exist.

{
	"status": 404,
  "message": "Tracker of order not found and cannot be paged.",
  "returnCode": -13
}

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

Retrieves the paging status of an order by name or UUID.

Example Request (Retrieving order by UUID)

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

$.ajax({
    url: "http://[TT LAN IP]:8000/api/v2/activeorders/c1c4dcf1-8a80-4bb9-97f9-3fd710d85125/page",
    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/v2/activeorders/c1c4dcf1-8a80-4bb9-97f9-3fd710d85125/page")
      
      // 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/v2/activeorders/c1c4dcf1-8a80-4bb9-97f9-3fd710d85125/page"];
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/v2/activeorders/c1c4dcf1-8a80-4bb9-97f9-3fd710d85125/page" \
	-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/v2/activeorders/c1c4dcf1-8a80-4bb9-97f9-3fd710d85125/page",
            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 (Active Order Found)

{
  "status": 200,
  "returnCode": 7,
  "paged": true
}

400 Bad Request (Invalid Order Identifier)

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

404 Not Found (Active Order Not Found)

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

DELETE /api/v2/activeorders/{name or UUID}/page

Cancel paging of an order. Primarily for canceling the paging of a order which is continuously tracked.

📘

Paging Cancelation

When a tracker is paging, canceling the paging will not cause the tracker to immediately stop buzzing. The tracker may buzz several seconds after the cancelation request.

Example Request (Canceling order by name)

// Cancel Paging Of Order 55 (DELETE http://[TT LAN IP]:8000/api/v2/activeorders/55/page)
// Using jQuery

$.ajax({
    url: "http://[TT LAN IP]:8000/api/v2/activeorders/55/page",
    type: "DELETE",
    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() {
    
    // Cancel Paging of Order 55 (DELETE)
    
    try {
      
      // Create request
      Content content = Request.Delete("http://[TT LAN IP]:8000/api/v2/activeorders/55/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); }
  }
}
// Cancel Paging of Order 55 (DELETE http://[TT LAN IP]:8000/api/v2/activeorders/55/page)

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

// 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 "DELETE" "http://[TT LAN IP]:8000/api/v2/activeorders/55/page" \
	-H "Content-Type: application/json" \
	-d "{\"tracking\" : \"true\"}"
# Install the Python Requests library:
# `pip install requests`

import requests
import json

def send_request():
    # Cancel Paging of Order 55 (DELETE http://[TT LAN IP]:8000/api/v2/activeorders/55/page)

    try:
        r = requests.delete(
            url="http://[TT LAN IP]:8000/api/v2/activeorders/55/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')

Responses

200 OK (Paging canceled)

Paging of order has been canceled.

{
  "status": 200,
  "returnCode": 1002,
  "message": "Paging canceled."
}

200 OK (No Paged tracker)

Order was found, but it was never paged, therefore it can't be canceled.

{
  "status": 200,
  "returnCode": 1003,
  "message": "No paged tracker to cancel."
}

400 Bad Request (Invalid Order Identifier)

Bad Order ID used in URI parameter.

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

404 Not Found (Order Not Found)

Active order does not exist.

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

404 Not Found (Tracker not found to cancel)

Active order found, but there was never a tracker assigned to order much less be paged.

{
  "status": 404,
  "message": "Unable to cancel paging of a tracker that doesn't exist.",
  "returnCode": -14
}