Assigning a Courier
courierAssign is a legacy mutation that assigns a single courier. New integrations should use couriersAssign instead.
The courierAssign mutation tells us about the individual who has been assigned to fulfill the ezCater delivery.
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.
If you have dispatched the delivery to another 3rd party (e.g. DoorDash, Uber Direct, etc.) it is important for you to fill in the deliveryServiceProvider with the name of that delivery provider. Otherwise, you may populate the value of this field with the name of your company
Mutation
Mutation
mutation CourierAssign($input: CourierAssignInput!) {
courierAssign(input: $input) {
clientMutationId
delivery {
id
}
userErrors {
... on DeliveryValidationError {
message
path
}
}
}
}
Variables
Variables
{
"input": {
"clientMutationId": "your-mutation-id",
"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",
"deliveryServiceProvider": "Your Delivery Service Provider"
}
}
Arguments
Argument Name | Description |
| The Input object for assigning a courier. |
Return Type
Returns a CourierAssignPayload.
Success Response
When the courierAssign mutation succeeds you can expect the response payload to look like:
Response
{
"data": {
"courierAssign": {
"clientMutationId": "your-mutation-id",
"delivery": {
"id": "ezcater-delivery-id"
},
"userErrors": []
}
}
}
Failure Response
User Errors
When the courierAssign mutation fails due to user errors you can expect a HTTP 200 and the response payload to look like:
Response - Invalid Phone Number
{
"data": {
"courierAssign": {
"clientMutationId": "4cbc6b56-3636-4692-b3d8-9b9a6a4b92a1",
"delivery": null,
"userErrors": [
{
"message": "Phone 55555555 is an invalid US phone number",
"path": [
"input",
"courier",
"phone"
]
}
]
}
}
}
Response - Too Far Past Event Time
{
"data": {
"courierAssign": {
"clientMutationId": "c3c047d9-e8e4-4431-b485-60c67fab8763",
"delivery": null,
"userErrors": [
{
"message": "Delivery cannot receive updates 2 hours past its event time",
"path": [
"input",
"deliveryId"
]
}
]
}
}
}
400 Bad Request
When the courierAssign mutation fails due to an invalid deliveryId you can expect a HTTP 200 and the response payload to look like:
Response
{
"errors": [
{
"message": "Delivery not found",
"path": [
"courierAssign"
],
"extensions": {
"type": "request",
"statusCode": 404,
"serviceName": "delivery-public",
"code": "DOWNSTREAM_SERVICE_ERROR",
"exception": {
"message": "Delivery not found",
"locations": [
{
"line": 1,
"column": 72
}
],
"path": [
"courierAssign"
]
}
}
}
],
"data": {
"courierAssign": null
}
}