In Coupa, the invoice header has a flag called 'Exported'. This flag is meant to be used for an integration and will determine if an invoice has been or not exported. We can change this manually in the UI but clicking on change button
By using the API we can easily change this flag on the Invoice header to 'true' or 'false' depending on our needs.
We will need one Rest client like Advanced Rest Client for Chrome or we can also use some Unix commands like curl.
Now we need two headers in the HTTP call
- Accept: application/xml
- X-COUPA-API-KEY: API_key , that we obtain from Setup ->API Keys
Remember that we cannot use one Mobile key, but one with enough access to perform this operation.
We also need the invoice ID, not to be confused with invoice number. The ID can be easily retrieved from the UI or using the API with a GET call.
The payload in cXML will look like this
Where the 'exported' value can be 'false' or 'true'.
We now send this HTTP call by doing a PUT request to the following URL
where we replace instance_name with the name of our instance and :id with the id of the invoice.
We have seen how easy is to change the 'exported' flag using the API. By using the API we can also create a script that will mark one set of invoices (or all of them) to the value we need.