cancelPurchaseOrder
Requires permission purchase:purchase_order:update.
Cancels a purchase order. It is allowed from DRAFT, SUBMITTED, APPROVED and PARTIALLY_RECEIVED. With nothing received the order becomes CANCELLED. Once goods are received, only the quantity not yet received is cancelled: the received goods and their receipts stay, the order ends RECEIVED (short closed), no further receipt can be posted, and a reason is required. A RECEIVED, CANCELLED or CLOSED order cannot be cancelled again. Needs the purchase orders feature on your plan.
Errors: a failed call returns a GraphQL errors entry, not a field on the result, and data may be null or partial. Read the entry's extensions.code and message; every shape and code is in the Error reference.
Example:
- GraphQL
- cURL
mutation CancelPurchaseOrder($id: ID!) {
cancelPurchaseOrder(id: $id) {
id
orderNumber
supplierCode
trackingCode
creatorName
projectName
creditLimitOverride {
baseCurrency
limit
projected
}
}
}
curl -X POST "https://<api-host>/graphql" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
--data @- <<'EOF'
{
"query": "mutation CancelPurchaseOrder($id: ID!) {\n cancelPurchaseOrder(id: $id) {\n id\n orderNumber\n supplierCode\n trackingCode\n creatorName\n projectName\n creditLimitOverride {\n baseCurrency\n limit\n projected\n }\n }\n}",
"variables": {
"id": "id"
}
}
EOF
Variables:
{
"id": "id"
}
Response:
{
"data": {
"cancelPurchaseOrder": {
"id": "id",
"orderNumber": "string",
"supplierCode": "string",
"trackingCode": "string",
"creatorName": "string",
"projectName": "string",
"creditLimitOverride": {
"baseCurrency": "string",
"limit": 0,
"projected": 0
}
}
}
}
cancelPurchaseOrder(
id: ID!
reason: String
): PurchaseOrder!
Arguments
cancelPurchaseOrder.id ● ID! non-null scalar
The ID of the purchase order.
cancelPurchaseOrder.reason ● String scalar
Why the purchase order is cancelled.
Type
PurchaseOrder object
A purchase order raised with a supplier.