Get Started with the API
General information about using the Coupa API and when you should consider using CSV.
Authentication
All data is stored as a business object or Resource, and each resource has a
Resource URL, just like a webpage, where each resource is in the form
/api/{resource_name}.
Make sure to access the url using
https://
instead of http://
when using the Coupa API.
Each Coupa customer has their own url, of the form
{instance_name}.coupahost.com
. For example:
https://companyname.coupahost.com/api/users
.
Authenicate API requests using OpenID Connect.
Always validate the presence of elements in the XML/JSON before fetching the value as Coupa payload structure can change in the future to not display certain fields which have no or null values.
What methods are supported by the API?
GET (Read Data) - A HTTP GET Request will query Coupa and return information in JSON or XML format. A request at the resource root will list the first 50 objects starting from ID 1. Use these arguments to fine tune the query.
PUT (Update Data) - A HTTP PUT Request to /api/{resource}/{id}
will
attempt update a resource. Only one resource can be updated per request and the payload
should be a JSON or XML document with the elements to be updated. Not all fields are
available through the API and any referenced data must already exist or the value will not
be changed.
POST (Create Data) - A HTTP POST Request to the resource root with a JSON or XML payload will attempt to create a new resource. If successful, the resource is returned with the new id, which is generated by Coupa.
When should I use the API?
The Coupa API allows you to create, update, and query individual entries, and will mostly be used to manage objects within Coupa. With standard RESTful actions and definitive inputs and outputs, it makes it the easy day-to-day option for non-bulk actions. These methods can be accessed at any time, and built in are tools to allow you to simply check if a call will go through successfully, or to minimize the responses output. This is primarily used to make simple individual updates, or to query data.
XML vs JSON
Coupa supports both XML and JSON. Below is some basic information about each:
Extensible Markup Language (XML) is a set of rules for encoding documents in machine-readable form. XML’s design goals emphasize simplicity, generality, and usability over the Internet.
JavaScript Object Notation (JSON) is a lightweight text-based open standard designed for human-readable data interchange. It is derived from the JavaScript programming language for representing simple data structures and associative arrays, called objects. Despite its relationship to JavaScript, it is language-independent, with parsers available for most programming languages.
JSON is less verbose than XML, because XML necessitates opening and closing tags (or in some cases less verbose self-closing tags), and JSON uses name/value pairs, concisely delineated by “{“ and “}” for objects, “[“ and “]” for arrays, “,” to separate pairs, and “:” to separate name from value.
Differences between XML and JSON in Coupa
Sample Requests/Responses - XML vs JSON
Using GraphQL
GraphQL is an open specificification for an API query language (thus the “QL” reference) that will allow you to make your integrations more responsive than ever by providing you with the ability to request the data you need and nothing more. GraphQL can also reduce the number of calls and associated round trips you are making by fetching all of the resources you need in a single or few number of calls.
See Introducing GraphQL for more info.
When should I use SFTP flat files?
Flat files allow you to load many records through a single transaction. Once an integration is set up, it will automatically run based on the parameters set. Integration runs and errors are managed within the app and provide insight on the number of entires added, error details, and who was automatically contacted about the error. This is primarily used to make mass updates or additions about key components of the product, like users or suppliers.
Additional resources
To learn more, review these pages: