Requests with Multiple API Tokens
Overview
This article introduces methods for setting multiple API Tokens in REST API requests. Examples using multiple API Tokens with Lookup and Related records fields are also introduced.
How to Set Multiple API Tokens
Separate API Tokens with commas
Specify the API Tokens in the HTTP request header with a comma in between them.
|
|
Set API Tokens in Separate Headers
Specify multiple header options in the request. Set the relative API tokens in each header.
|
|
Example Requests Using Multiple API Tokens
Example overview
This tutorial references three Apps: a Customer Database App, a Sales Leads Management App, and an Activity History App with the following relationships.
A curl command is used to perform the following two request patterns.
- Adding a new record that includes a Lookup field A new record will be added into the Sales Leads Management App, which has a Lookup field inside. Since the Lookup field accesses data from a different App, API tokens generated from the two Apps will be needed in the request.
- Getting records by querying Related Records field values Multiple records will be obtained from the Sales Leads Management App. The query for getting the records will include values in the Related Records field. Since the Related Records field is referencing data from the Activity History App, API tokens generated from the two Apps will be needed in the request.
Adding a new record that includes a Lookup field
In the Sales Leads Management App, data from the Customer Database App is retrieved with a Lookup field. The Organization Name is used as the key. The values of the Department and the Contact Name fields are also copied into the Sales Leads Management App.
In the request header specify:
- the API Token of the App to add records to
- the API Token of the App to be used as the Lookup source
|
|
The following values must be changed to match the environment.
- {subdomain}: Environment's subdomain name
- {Sales_Leads_Management_App_ID}: The App ID of the Sales Leads Management App
- {Sales_Leads_Management_App_API_Token}: The API token of the Sales Leads Management App
- {Customer_Database_App_API_Token}: The API token of the Customer Database App
Getting records by querying Related Records field values
Each record in the Activity History App has a Sales Leads Management App Record Number to denote which lead the activity is connected to. Records of the Activity History App whose Sales Leads Management App Record Number value matches the Record Number value of the current Sales Leads Management App record are displayed as Related Records.
A GET request to the Sales Leads Management App using only the API token from the Sales Leads Management App would not allow the user to use a Related Records field in the query. However, additionally specifying the API token of the Activity History App allows the Related Records fields to be used in the query.
In the request header, specify the API Tokens of App with the Related Records field and the Related Records source App.
|
|
The following values must be changed to match the environment.
- {subdomain}: Environment's subdomain name
- {Sales_Leads_Management_App_ID}: The App ID of the Sales Leads Management App
- {Sales_Leads_Management_App_API_Token}: The API token of the Sales Leads Management App
- {Activity_History_App_API_Token}: The API Token of the Activity History App
Reference
For more references on API Tokens, refer to the API Tokens article. This article covers how to generate API tokens, troubleshooting notes and limitations.