1. Home
  2. Knowledge Base
  3. Integrations
  4. ERP REST interfaces – Authentication

ERP REST interfaces – Authentication

Access token must be obtained to successfully call API methods. Result of successful authentication and authorization is received access token. Validity of the token is 1 minute; afterwards new token must be obtained. Ways how to get the access token are described in this article.

Authentication via API key

For successful authorization/authentication, API key could be used. There can be unlimited number of API keys which could be shared with third party integration projects. API key grants access to API only (including BI interfaces) and do not grant access to any other part of application.

Manage API keys

To create or get API key, navigate to Integration option of Administration menu. From available integration options, select API Keys.

 

If user is not granted with AP permission Manage integrations, the Integration option is not available in the Administration menu.

 

In opened list, open detail of existing key or create a new key. All keys provides the same access level for:

  • batch operations API (like vendor or purchase order creation) and
  • BI interfaces.

Each key can have limited validity set. After that date, key will not be authorized to get a new access token. To renew expired key, new expiration date can be set for that key, allowing the key to be valid again until the new date. If key has no date set, it will be valid forever.

 

To get the key, open key detail and copy Key value from the opened detail.

Get access token

Authorization of the key is performed by calling dedicated API method as described bellow. Result of the authorization is an access token, which can then be used to authorize API calls.

 

URL

{url}/adminportalidentity/connect/token

 

Type

POST

 

Header parameters

Key Value
Content-Type
application/x-www-form-urlencoded

 

Body parameters

 

 

Key Value
client_id
erp_client
client_secret
{API key}
grant_type
client_credentials
scope
erp_api

 

Parts marked in {bold} must be replaced with following information:

 

 

Placeholder Information to be provided Description
{url} Base URL of the solution If AP is accessed on address https://solutionaddress.com/adminportal/customerShortName, base URL will be https://solutionaddress.com
{API key} API key Valid (i.e. not expired) API key

 

 

Response example

{
\"access_token\": \"{access_token}\",
\"expires_in\": 3600,
\"token_type\": \"Bearer\"
}

 

Result of the call is {access_token}, which is used for calling of API methods. For each API call, {access_token} must be added to a header of the call as:

 

Key Value
Authorization
Bearer {access_token}

Authentication via user [obsolete]

This type of authentication utilizes user with role “API users” to obtain access token. Username and password must be provided and the user must have role “API users” assigned in order to pass authorization. Result of successful authentication and authorization is received access token. Validity of the token is 1 minute; afterwards new token must be obtained.

 

Authentication is performed by calling dedicated API method as described bellow.

 

URL

{url}/adminportalidentity/connect/token

 

Type

POST

 

Header parameters

Key Value
Content-Type
application/x-www-form-urlencoded

 

Body parameters

Key Value
client_id
erp_client
client_secret
{secret}
grant_type
password
scope
erp_api
username
{customerShortName}\\{userName}. Example dummy\\user
password
{password}
acr_values
Customer shortname passed in format tenant:{customerShortName}. Example tenant:dummy

 

Parts marked in {bold} must be replaced with following information:

 

Placeholder Information to be provided Description
{url} Base URL of the solution If AP is accessed on address https://solutionaddress.com/adminportal/customerShortName, base URL will be https://solutionaddress.com
{secret} Customer’s secret Secret, together with customer id and customer short name, is provided by solution administrator
{userName} User name of user with ”API users” role User with ”API users” role must be created in AP
{password} Password of the API user
{customerShortName} Shortname of the customer Shortname can be obtained from solution administrator or URL address where AP can be accessed – https://solutionaddress.com/adminportal/customerShortName

 

 

Response example

{
\"access_token\": \"{access_token}\",
\"expires_in\": 3600,
\"token_type\": \"Bearer\"
}

 

Result of the call is {access_token}, which is used for calling of API methods. For each API call, {access_token} must be added to a header of the call:

 

Key Value
Authorization
Bearer {access_token}
Was this article helpful?

Related Articles