Coupa Authenticate an Element Instance

You can authenticate with Coupa to create your own instance of the Coupa element through the UI or through APIs. Once authenticated, you can use the element instance to access the different functionalities offered by the Coupa platform.

Authenticate Through the UI

Use the UI to authenticate with Coupa and create an element instance as described in Authenticate an Element Instance (UI). In addition to the base authentication parameters, you will need the credentials that you identified in the API Provider Setup article.

After successfully authenticating, we give you several options for next steps. Make requests using the API docs associated with the instance, map the instance to a virtual data resource, or use it in a formula template.

Authenticate Through API

Authenticating through API is as simple as providing the necessary authentication parameters in the request body in order to provision an instance.

Authenticating the Element Instance

Use the /instances endpoint to authenticate with Coupa and create an element instance. If you are configuring events, see the Events section.

Note: The endpoint returns an element token upon successful completion. Retain the token for all subsequent requests involving this element instance.

To create an element instance:

  1. Construct a JSON body as shown below (see Parameters):

    {
      "element": {
        "key": "coupa"
      },
      "configuration": {
        "filter.response.nulls": "true",
        "api.key": "<API_KEY>",
        "siteAddress": "<SITEADDRESS>"
      },
      "tags": [
        "<Add_Your_Tag>"
      ],
      "name": "<INSTANCE_NAME>"
    }
    
  2. Call the following, including the JSON body you constructed in the previous step:

    POST /instances
    
    Note: Make sure that you include the User and Organization keys in the header. For more information, see Authorization Headers, Organization Secret, and User Secret.
  3. Locate the token and id in the response and save them for all future requests using the element instance.

Example cURL

curl -X POST \
  https://api.cloud-elements.com/elements/api-v2/instances \
  -H 'authorization: User <USER_SECRET>, Organization <ORGANIZATION_SECRET>' \
  -H 'content-type: application/json' \
  -d '{
  "element": {
    "key": "coupa"
  },
  "configuration": {
    "filter.response.nulls": "true",
    "api.key": "<API_KEY>",
    "siteAddress": "<SITEADDRESS>"
  },
  "tags": [
    "Coupa"
  ],
  "name": "INSTANCE_NAME"
}'

Parameters

API parameters not shown in Cloud Elements are in code formatting.

Note: Event related parameters are described in the Events article.
ParameterDescriptionData Type
Key
key
The element key.
coupa
string
Name
name
The name for the element instance created during authentication.Body
Configured Application Name
api.key
The API Key that you recorded in the API Provider Setup article.string
Site Address
siteAddress
The site address for Coupa - https://cloudelements-coupalink-demo.coupacloud.com/string
Filter null values from the response
filter.response.nulls
Optional. Determines if null values in the response JSON should be filtered from the response. Yes or true indicates that Cloud Elements will filter null values.
Default: true.
boolean
tagsOptional. User-defined tags to further identify the instance.string

Example Response

{
  "id": 123456,
  "name": "<Instance_name>",
  "createdDate": "2020-01-15T10:36:40Z",
  "token": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
  "elementId": 12345,
  "tags": [...],
  "valid": true,
  "disabled": false,
  "maxCacheSize": 0,
  "cacheTimeToLive": 0,
  "configuration": {
    "base.url": "https://{siteAddress}/api/",
    "event.notification.subscription.id": null,
    "default.select.fields.map": null,
    "event.notification.basic.username": null,
    "pagination.max": "50",
    "event.notification.basic.password": "********",
    "siteAddress": "xxxxxxxxxxxxxxxxxxxxx",
    "event.vendor.type": "polling",
    "filter.response.nulls": "true",
    "api.key": "xxxxxxxxxxxxxxxxxxxxxxxxxxxx",
    "event.notification.instance.finder": null,
    "pagination.type": "offset",
    "event.poller.refresh_interval": "15",
    "event.notification.callback.url": null,
    "event.notification.signature.key": null,
    "authentication.time": null,
    "event.poller.configuration":{...},
    "event.notification.enabled": "false"
  },
  "authenticationType": "custom",
  "eventsEnabled": false,
  "cachingEnabled": false,
  "traceLoggingEnabled": false,
  "organizationId": 1234,
  "accountId": 12345,
  "externalAuthentication": "none",
  "userId": 123456,
  "element": {
   "id": 12345,
    "name": "Coupa",
    "hookName": "Coupa",
    "key": "coupa",
    "description": "Add a Coupa Instance to connect your existing Coupa account to the Business Spend Management Hub, allowing you to manage requisitions/orders, approvals, invoices, payments conforming to a procure to pay scenario. You will need to create Coupa Apikey from application to use it for instance creation.",
    "image": "elements/custom-element-default-logo.png",
    "logo": "coupa",
    "active": true,
    "deleted": false,
    "typeOauth": false,
    "trialAccount": false,
    "resources":[...]
  },
  "user": {
    "id": 12345
  }
}