Approvals API Example Calls


In this example, we queried for a single approval with an ID of 12622. We did a GET to the URL: //<instance>[gt]=2010-01-01&created-at[lt]=2010-02-01

Approvals GET Response

<?xml version="1.0" encoding="UTF-8"?>
	 <id type="integer">12622</id>
	 <created-at type="datetime">2012-02-15T14:56:22-08:00</created-at>
	 <updated-at type="datetime">2012-04-23T11:49:25-07:00</updated-at>
	 <position type="integer">1</position>
	 <approval-chain-id nil="true" />
	 <approval-date type="datetime">2012-02-15T14:56:59-08:00</approval-date>
	 <note />
	 <approvable-id type="integer">2696</approvable-id>
			<id type="integer">3</id>
			<employee-number />
			<firstname>Victor (CFO)</firstname>
			<salesforce-id nil="true" />
			<id type="integer">9</id>
			<employee-number />
			<firstname>Bob (VP Procurement)</firstname>
			<salesforce-id nil="true" />
			<id type="integer">17</id>
			<employee-number nil="true" />
			<salesforce-id nil="true" />

Approving or Rejecting

The following describes how you can use the Coupa API to perform actions on Approvals.


<instance url>/api/approvals/<approval id>/approve


<instance url>/api/approvals/<approval id>/reject

Adding Reason

In both cases, an approval must be Pending (and not already approved or rejected) for the action to be valid. It is also possible to provide a "Reason" for the rejection through the XML request directly. For example, to reject an approval by id of 12612 and provide a reason of "Rejected by Integration", you would use the following request:

https://<instance url>/api/approvals/12612/reject?reason=Rejected%20by%20Integration

Successful requests will return HTTP 200 Response. The body of the response will include the created requisition. Unsuccessful requests will return HTTP 400 Bad Request. The body of the response will include validation errors formatted as XML.