Get Started with the API (2024)

Authentication

All data is stored as a business object orResource,and each resource has aResource URL, just like a webpage, where each resource is in the form/api/{resource_name}. Make sure to access the url usinghttps://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 usingOpenID Connect.

Note

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 argumentsto 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 aJSON or XMLdocument 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 aJSON or XMLpayload will attempt to create a new resource. If successful, the resource is returned with the new id, which is generated by Coupa.

Note

Deleting datais not supportedfor any resource via the API.Users can inactivate a subset of resources using a PUT request.

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

Note

Regardless of which method you choose, the Coupa API requires that you set both your content-type and content-accept headers to the same type. Don't mix and match.

Using GraphQL

GraphQL is an open specificification for an API query language that allows you 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:

  • OAuth 2.0 Getting Started with Coupa API
  • Postman Collection for Coupa APIs

Get Started with the API (2024)
Top Articles
Latest Posts
Article information

Author: The Hon. Margery Christiansen

Last Updated:

Views: 5909

Rating: 5 / 5 (70 voted)

Reviews: 93% of readers found this page helpful

Author information

Name: The Hon. Margery Christiansen

Birthday: 2000-07-07

Address: 5050 Breitenberg Knoll, New Robert, MI 45409

Phone: +2556892639372

Job: Investor Mining Engineer

Hobby: Sketching, Cosplaying, Glassblowing, Genealogy, Crocheting, Archery, Skateboarding

Introduction: My name is The Hon. Margery Christiansen, I am a bright, adorable, precious, inexpensive, gorgeous, comfortable, happy person who loves writing and wants to share my knowledge and understanding with you.