curl --request POST \
--url https://api.sandbox.usenash.com/v1/order/{id}/events \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"customEventDefinitionId": "<string>",
"customEventDefinitionKey": "<string>",
"timestamp": "<string>",
"payload": {}
}
'import requests
url = "https://api.sandbox.usenash.com/v1/order/{id}/events"
payload = {
"name": "<string>",
"customEventDefinitionId": "<string>",
"customEventDefinitionKey": "<string>",
"timestamp": "<string>",
"payload": {}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
customEventDefinitionId: '<string>',
customEventDefinitionKey: '<string>',
timestamp: '<string>',
payload: {}
})
};
fetch('https://api.sandbox.usenash.com/v1/order/{id}/events', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.sandbox.usenash.com/v1/order/{id}/events",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'customEventDefinitionId' => '<string>',
'customEventDefinitionKey' => '<string>',
'timestamp' => '<string>',
'payload' => [
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.sandbox.usenash.com/v1/order/{id}/events"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"customEventDefinitionId\": \"<string>\",\n \"customEventDefinitionKey\": \"<string>\",\n \"timestamp\": \"<string>\",\n \"payload\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.sandbox.usenash.com/v1/order/{id}/events")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"customEventDefinitionId\": \"<string>\",\n \"customEventDefinitionKey\": \"<string>\",\n \"timestamp\": \"<string>\",\n \"payload\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sandbox.usenash.com/v1/order/{id}/events")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"customEventDefinitionId\": \"<string>\",\n \"customEventDefinitionKey\": \"<string>\",\n \"timestamp\": \"<string>\",\n \"payload\": {}\n}"
response = http.request(request)
puts response.read_body{
"event": {
"id": "<string>",
"eventName": "<string>",
"orderId": "<string>",
"eventCreatedAt": "<string>",
"payload": {}
}
}[
{
"error": {
"code": "<string>",
"message": "<string>",
"details": {}
},
"response_status": "<string>",
"RequestID": "<string>"
}
]Add Custom Event to Order
Adds a customizable event to an existing Nash order. Custom order events will be shown in the order events page alongside other Nash-generated events.
curl --request POST \
--url https://api.sandbox.usenash.com/v1/order/{id}/events \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"customEventDefinitionId": "<string>",
"customEventDefinitionKey": "<string>",
"timestamp": "<string>",
"payload": {}
}
'import requests
url = "https://api.sandbox.usenash.com/v1/order/{id}/events"
payload = {
"name": "<string>",
"customEventDefinitionId": "<string>",
"customEventDefinitionKey": "<string>",
"timestamp": "<string>",
"payload": {}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
customEventDefinitionId: '<string>',
customEventDefinitionKey: '<string>',
timestamp: '<string>',
payload: {}
})
};
fetch('https://api.sandbox.usenash.com/v1/order/{id}/events', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.sandbox.usenash.com/v1/order/{id}/events",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'customEventDefinitionId' => '<string>',
'customEventDefinitionKey' => '<string>',
'timestamp' => '<string>',
'payload' => [
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.sandbox.usenash.com/v1/order/{id}/events"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"customEventDefinitionId\": \"<string>\",\n \"customEventDefinitionKey\": \"<string>\",\n \"timestamp\": \"<string>\",\n \"payload\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.sandbox.usenash.com/v1/order/{id}/events")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"customEventDefinitionId\": \"<string>\",\n \"customEventDefinitionKey\": \"<string>\",\n \"timestamp\": \"<string>\",\n \"payload\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sandbox.usenash.com/v1/order/{id}/events")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"customEventDefinitionId\": \"<string>\",\n \"customEventDefinitionKey\": \"<string>\",\n \"timestamp\": \"<string>\",\n \"payload\": {}\n}"
response = http.request(request)
puts response.read_body{
"event": {
"id": "<string>",
"eventName": "<string>",
"orderId": "<string>",
"eventCreatedAt": "<string>",
"payload": {}
}
}[
{
"error": {
"code": "<string>",
"message": "<string>",
"details": {}
},
"response_status": "<string>",
"RequestID": "<string>"
}
]Limits
- Rate limits: Max 3 requests/second
- Size limit: Request body must not exceed 1kb
Identify the event
Send exactly one of these fields to say which event you’re adding:| Field | Use it when |
|---|---|
customEventDefinitionKey | The event is in your organization’s catalog. Send the Event key shown for it under Orchestrate → Custom Events in the Portal. |
customEventDefinitionId | The event is in your catalog and your system already stores the definition’s ID. |
name | The event isn’t in your catalog. Nash records the name exactly as you send it, after trimming spaces. |
curl --request POST \
--url https://api.sandbox.usenash.com/v1/order/{id}/events \
--header "Authorization: Bearer $NASH_API_KEY" \
--header "Content-Type: application/json" \
--data '{"customEventDefinitionKey": "store_ready", "payload": {"bay": "4"}}'
| Error code | When |
|---|---|
CUSTOM_EVENT_DEFINITION_REFERENCE_INVALID | The request has none of the three fields, or more than one. |
CUSTOM_EVENT_DEFINITION_NOT_FOUND | No definition in your organization matches the key or ID. |
CUSTOM_EVENT_DEFINITION_ARCHIVED | The definition, or every definition with that key, has been archived. |
Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
Unique reference number for the order: either order.id (starts with "ord_") or order.externalId
"ord_1234567890"
Body
Expected payload for the add event endpoint.
Exactly one of name / customEventDefinitionId / customEventDefinitionKey
must be supplied — none-set and more-than-one-set are rejected with
CUSTOM_EVENT_DEFINITION_REFERENCE_INVALID. None can be marked required here, so
that rule is enforced by the service layer (resolve_custom_event_reference)
rather than by this schema.
A free-form event name. Mutually exclusive with customEventDefinitionId and customEventDefinitionKey.
The id of a pre-defined custom event in your org's catalog. The definition's immutable key becomes the event name. Mutually exclusive with name and customEventDefinitionKey.
The key of a pre-defined custom event in your org's catalog (the Event key shown under Orchestrate > Custom Events in the Portal). Resolves to that definition and emits the key as the event name. Mutually exclusive with name and customEventDefinitionId.
The event time in UTC in the form 'YYYY-MM-DDTHH:MM:SSZ'. Defaults to now.
(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2}).?(\d)*Z?Response
OK
Show child attributes
Show child attributes
Was this page helpful?