Skip to content

Serve Order Run Info via API

Users can request information about an order run or many order runs using the Automation API.

Required parameters

Required parameter Description
Token A valid session token generated by username/password authentication.
Kitchen The kitchen where you want to run the order.

Optional parameters

Optional Parameter Description
OrderRun ID The ID for the order run for which the API call is gathering information. If none is passed the information for the most recent order run in the kitchen is returned.

Available information

Output item Response
OrderRunID serving_hid
Test Results testresults

Example of requesting order run info

The example Python script below gathers order run information for the last order run that occurred in the specified kitchen. Note that the payload includes a request to return the test result from the order run.

#!/usr/bin/env python
import json
import requests

# Plain text, no need to urlencode
username= "<USERNAME>",
password= "<PASSWORD>"
kitchen = "<KITCHEN_NAME>"

payload_in = {'username': username, 'password': password}
r = requests.post('https://cloud.datakitchen.io/v2/login', data=payload_in)
token = r.text

url = "https://cloud.datakitchen.io/v2/order/details/%s" % kitchen
headers = {'Content-Type': 'application/json', 'Authorization': 'Bearer ' + token}

# Define what OrderRun info to return
payload_out = {'serving_hid' : '<ORDERRUNID>', 'testresults': True}
r2 = requests.post(url, headers=headers, data=json.dumps(payload_out))

if r2.status_code == 200 or r2.status_code == 200:
   print 'response ok'

response = r2.json()
print 'response: %s' % response