Skip to main content

 

 

Coupa Success Portal

Changing the 'exported' flag of an Invoice using the API

Overview

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 

Goal

By using the API we can easily change this flag on the Invoice header to 'true' or 'false' depending on our needs.

First Step

We will need one Rest client like Advanced Rest Client for Chrome or we can also use some Unix commands like curl.

Second Step

Now we need two headers in the HTTP call

  1. Accept: application/xml
  2. 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. 

Third Step

The payload in cXML will look like this 

  <invoice-header>
    <exported type="boolean">false</exported>
  </invoice-header>

Where the 'exported' value can be 'false' or 'true'.

We now send this HTTP call by doing a PUT request to the following URL

https://{instance_name}.coupahost.com/api/invoices/:id

      where we replace instance_name with the name of our instance and :id with the id of the invoice. 

What's Next

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. 

  • Was this article helpful?