purchase_orders.change-state
Changes the state of a purchase order.
Possible state transitions:
- draft to final – finalized
- draft to deleted – deleted
- final to second_copy – second_copy
- final to accepted – accepted
- final to refused – refused
- final to canceled – canceled
- second_copy to canceled – canceled
- accepted to refused – refused
- accepted to completed – completed
- refused to canceled – canceled
- refused to accepted – accepted
Any other transitions will fail.
When canceling an purchase order you must specify a reason.
You call this method by submitting a HTTP PUT request to the following URL :
Example xml to be submitted:
<?xml version="1.0" encoding="UTF-8"?> <purchase_order> <state>canceled</state> <message>Canceled due to amount of money</message> </purchase_order> <purchase_order> <state>finalized</state> </purchase_order>
Parameters
Parameters are the data you will pass with the call.
api_key
Your secret identifier. You find your API Key under Account Overview in the Account section.
Rules: Required
purchase-order-id
Id of the purchase_order to change state.
Rules: Required
state
State which the purchase order will be changed to. Options are:
- finalized
- second_copy
- canceled
- accepted
- rejected
- deleted
Rules: Required
message
Reason for cancelling the purchase_order.
Rules: Required when state is “canceled”, otherwise ignored.
Return Values
This is the result that will be passed back to you.
Success
Error
The API Key parameter is missing or is incorrectly entered.
No purchase_order matches the :purchase-order-id supplied.
Some of the parameters were incorrect.
Possible errors:
<?xml version="1.0" encoding="UTF-8"?> <errors> <error>No content type or wrongly specified.</error> </errors>
<?xml version="1.0" encoding="UTF-8"?> <errors> <error>Invalid state</error> </errors>
<?xml version="1.0" encoding="UTF-8"?> <errors> <error>Cancel message can't be blank</error> </errors>