Add custom event to order
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.
POST
/
v1
/
order
/
{id}
/
events
Add custom event to order
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>"
}
]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
Path Parameters
Body
application/json
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.
Was this page helpful?