Clearing Order(s)

Clearing active orders manually.

DELETE /api/v2/activeorders [SECURED]

Clear all active orders.

Example Request

// Clear all orders (DELETE http://[TT LAN IP]:8000/api/v1/activeorders)
// Using jQuery

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

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

// 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 "DELETE" "http://[TT LAN IP]:8000/api/v2/activeorders" \
	-H "Authorization: Bearer 2f1f4339c7b77fa3474bf8ba8852349273e928bb8ad9d186" \
	-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/130)

    try:
        r = requests.delete(
            url="http://[TT LAN IP]:8000/api/v2/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": "cleared",
      "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": "cleared",
      "created": "2016-09-22T19:08:56",
      "stateChanged": "2016-09-22T19:08:56",
      "paged": false,
      "elapsedTime": 0
    }
  ]
}

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

Clear an active order by its name.

URI Parameters

NameDescriptionDetails
nameThe active order number.integer
UUIDThe active order unique identifier (UUID)string

Example Request (By Order Name)

// Clear Order 130 (DELETE http://[TT LAN IP]:8000/api/v2/activeorders/130)
// Using jQuery

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

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

// 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 "DELETE" "http://[TT LAN IP]:8000/api/v2/activeorders/130" \
	-H "Authorization: Bearer 2f1f4339c7b77fa3474bf8ba8852349273e928bb8ad9d186" \
	-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/v2/activeorders/130)

    try:
        r = requests.delete(
            url="http://[TT LAN IP]:8000/api/v2/activeorders/130",
            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": 6,
          "activeorder": {
            "uuid": "02bb9174-c9ea-4889-8464-30f1d5ebd01d",
            "created": "2016-09-08T17:19:52",
            "orderType": "ON_PREMISE",
            "locationName": "",
            "state": "cleared",
            "stateChanged": "2016-11-03T12:23:00",
            "name": "130",
            "paged": false,
            "elapsedTime": 0
          }
        }

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

Returned when active order not found.

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