Skip to main content

Courier Tracking Event Create

Creating Courier Tracking Events

When couriers are out for delivery, it is important to understand exactly where the courier is so that the appropriate parties have an accurate idea of how the delivery is progressing. This information can be used to provide a tracking status and also give us insight into delivery events that are taking place event if an explicit event has not been provided.

If you already had a courier assigned to a delivery and are now assigning a new courier, we automatically take care of un-assigning the previous courier

Mutation

Mutation

mutation CourierTrackingEventCreate($input: CourierTrackingEventCreateInput!) {
courierTrackingEventCreate(input: $input) {
clientMutationId
userErrors {
... on DeliveryValidationError {
message
path
}
}
}
}

Variables

Variables

{
"input": {
"clientMutationId": "your-mutation-id",
"coordinates": {
"latitude": 42.360081,
"longitude": -71.058884
},
"courier": {
"id": "your-courier-id",
"firstName": "Test",
"lastName": "Courier",
"phone": "+15555555555",
"vehicle": {
"make": "Your Vehicle Make",
"model": "Your Vehicle Model",
"color": "Your Vehicle Color"
}
},
"deliveryId": "ezcater-delivery-id",
"occurredAt": "2024-02-05T17:27:55+0000"
}
}

Arguments

Argument Name

Description

The Input object for creating a new menu.

Return Type

Success Responses

When the courierTrackingEventCreate mutation succeeds you can expect the response payload to look like:

Response

{
"data": {
"courierTrackingEventCreate": {
"clientMutationId": "your-mutation-id",
"userErrors": []
}
}
}

Failure Responses

User Errors

When the courierTrackingEventCreate mutation fails because it is too early to add courier events you can expect the response payload to look like:

Response - Too Early

{
"data": {
"courierTrackingEventCreate": {
"clientMutationId": "your-mutation-id",
"userErrors": [
{
"message": "It's too early to add the event for courier en route to pickup",
"path": [
"input",
"occurredAt"
]
}
]
}
}
}

Response - Too Late

{
"data": {
"courierTrackingEventCreate": {
"clientMutationId": "your-mutation-id",
"userErrors": [
{
"message": "Delivery cannot receive updates 2 hours past its event time",
"path": [
"input",
"deliveryId"
]
}
]
}
}
}

400 Bad Request

When the courierTrackingEventCreate mutation fails due to bad user input, such as an invalid field, you can expect a HTTP 400 Bad Request and the response payload to look like:

Response

{
"errors": [
{
"message": "Variable \"$input\" got invalid value { clientMutationId: \"your-mutation-id\", coordinates: { latitude: 42.360081, longitude: -71.058884 }, courier: { id: \"your-courier-id\", firstName: \"Test\", lastName: \"Courier\", phone: \"+15555555555\", vehicle: [Object] }, deliveryId: \"your-ezcater-delivery-id\", eventType: \"PICKED_UP\", occurredAt: \"2025-05-07T19:52:32.841Z\" }; Field \"eventType\" is not defined by type \"CourierTrackingEventCreateInput\".",
"extensions": {
"code": "BAD_USER_INPUT"
}
}
]
}
Did this answer your question?