Skip to main content

Courier Assign (Preferred)

Assigning a Courier

Use couriersAssign for new integrations; it supports assigning one or more couriers in a single call.

The couriersAssign mutation is for managing the individual(s) assigned to fulfill the ezCater delivery. That includes creating or updating couriers in the ezCater system.

The list of couriers provided to the mutation will replace any existing assigned couriers. Providing an empty list will unassign all the couriers.

The providerSource should be IN_HOUSE for all orders delivered by a restaurant’s own in-house drivers. If you have dispatched the delivery to another 3rd party (e.g. DoorDash, Uber Direct, etc.) the providerSource will be THIRD_PARTY. 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 CouriersAssign($input: CouriersAssignInput!) {
couriersAssign(input: $input) {
delivery {
id
}
userErrors {
... on UserError {
message
path
}
}
}
}

Variables

Variables

{
"input": {
"couriers": [
{
"id": "your-courier-id1",
"firstName": "Jane",
"lastName": "Doe",
"phone": "+16175551234",
"providerSource": "IN_HOUSE",
"vehicle": {
"color": "silver",
"make": "Toyota",
"model": "RAV4"
}
},
{
"id": "your-courier-id2",
"providerSource": "IN_HOUSE"
},
{
"id": "your-courier-id3",
"firstName": "John",
"lastName": "Smith",
"phone": "+16175554567",
"providerSource": "THIRD_PARTY",
"providerName": "DoorDash",
"vehicle": {
"color": "blue",
"make": "Honda",
"model": "Accord"
}
}
],
"deliveryId": "ezcater-delivery-id"
}
}

Arguments

Argument Name

Description

The Input object for assigning a courier.

Return Type

Success Response

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

Response

{
"data": {
"couriersAssign": {
"delivery": {
"id": "ezcater-delivery-id"
},
"userErrors": []
}
}
}

Failure Response

User Errors

When the couriersAssign mutation fails due to user errors you can expect a HTTP 200 and the response payload to look like:

Invalid Courier Attributes

{
"data": {
"couriersAssign": {
"delivery": null,
"userErrors": [
{
"message": "Phone can't be blank",
"path": [
"input",
"couriers",
"0",
"phone"
]
},
{
"message": "First name can't be blank",
"path": [
"input",
"couriers",
"0",
"firstName"
]
},
{
"message": "Phone is invalid for U.S.",
"path": [
"input",
"couriers",
"2",
"phone"
]
},
{
"message": "Last name can't be blank",
"path": [
"input",
"couriers",
"2",
"lastName"
]
}
]
}
}
}

Past Event Time

{
"data": {
"couriersAssign": {
"delivery": null,
"userErrors": [
{
"message": "Delivery cannot receive updates 2 hours past its event time",
"path": [
"input",
"deliveryId"
]
}
]
}
}
}

Delivery Completed

{
"data": {
"couriersAssign": {
"delivery": null,
"userErrors": [
{
"message": "Delivery is finalized and cannot receive any more updates",
"path": [
"input",
"deliveryId"
]
}
]
}
}
}

Delivery Cancelled

{
"data": {
"couriersAssign": {
"delivery": null,
"userErrors": [
{
"message": "Delivery is inactive and cannot receive any more updates",
"path": [
"input",
"deliveryId"
]
}
]
}
}
}

404 Not Found Request

When a Delivery is not found for the provided deliveryId you can expect a HTTP 200 and the response payload to look like:

{
"errors": [
{
"message": "Delivery not found",
"path": [
"couriersAssign"
],
"extensions": {
"type": "request",
"statusCode": 404,
"serviceName": "delivery-public",
"code": "DOWNSTREAM_SERVICE_ERROR",
"exception": {
"message": "Delivery not found",
"locations": [
{
"line": 1,
"column": 72
}
],
"path": [
"couriersAssign"
]
}
}
}
],
"data": {
"couriersAssign": null
}
}
Did this answer your question?