Public API
Orders API
Order Reject
11min
rejecting orders rejecting an order requires a call to a mutation with the order uuid that is being rejected and some information about the reason why it is being rejecting to be automatically be infromed when an order has been submitted and can be rejected please see subscribing to order notifications docid\ rwxihcsbkow9wv238z7mh mutation mutation mutation rejectorder($orderid id!, $rejectorderinput rejectorderinput!) { rejectorder(orderid $orderid, rejectorderinput $rejectorderinput) { order { uuid lifecycle { orderiscurrently } } } } variables variables { "orderid" "your ezcater order id", "rejectorderinput" { "explanation" "this location can't accept any more orders for that delivery date", "reason" "at daily capacity" } } arguments argument name description orderid order schema reference docid\ u2uigsyo0gfpxj 5tuif0 the ezcater order uuid that is provided within the payload of order subscription notifications rejectorderinput order schema reference docid\ u2uigsyo0gfpxj 5tuif0 a object providing an explanation for the rejection and the reason return type returns a order schema reference docid\ u2uigsyo0gfpxj 5tuif0 success response when the rejectorder mutation succeeds you can expect the response payload to look like response rejected { "data" { "rejectorder" { "order" { 	 "uuid" "your ezcater order id", "lifecycle" { "orderiscurrently" "rejected" } } } } } response cancelled { "data" { "rejectorder" { "order" { "uuid" "aac3c94d d4a5 456d 82b8 bbe7b4263cd5", "lifecycle" { "orderiscurrently" "cancelled" } } } } } we have also created a new rejected order event notification which you will receive shortly afterwards, if you choose to subscribe to it via subscription create docid\ ywds1a gxebjwkne8v90s failure responses rejectorder calls may fail for a variety of reasons, such a the order not being found, or the feature not being enabled for your brand in the event that a rejectorder call fails, one of the below errors will be returned 404 couldn’t find order you will get a 404 error when the specified order couldn’t be found response { "data" { "rejectorder" null }, "errors" \[ { "message" "couldn't find order", "locations" \[ { "line" 6, "column" 3 } 	 ], "path" \[ "rejectorder" ], "extensions" { "type" "request", "statuscode" 404 } } ] } 403 unauthorized you will get a 403 error when the api user account doesn’t have permission to perform this action for this caterer location response { "data" { "rejectorder" null }, "errors" \[ { "message" "you are not authorized to access this data", "locations" \[ { "line" 6, "column" 3 } ], "path" \[ "rejectorder" ], "extensions" { "type" "request", "statuscode" 403 } } ] } feature not enabled (feature not enabled) you will get this error if this api feature has not yet been enabled for your brand response { "data" { "rejectorder" null }, "errors" \[ { "message" "feature not enabled for this caterer", "locations" \[ { "line" 6, "column" 3 } ], "path" \[ "rejectorder" ], "extensions" { "type" "summary", "code" "feature not enabled" } } ] } invalid state transition (invalid state transition) you will get this error when the order is no longer in a valid state to be rejected (the order hasn’t been submitted yet, the customer may have canceled it, it may have already been accepted or rejected by api or one of the other channels for accepting / rejecting orders) response { "data" { "rejectorder" null }, "errors" \[ { "message" "sorry, we were unable to reject this order ", "locations" \[ { "line" 6, "column" 3 } ], "path" \[ "rejectorder" ], "extensions" { "type" "summary", "code" "invalid state transition" } } ] }