In this article we will explore the following:
• Connecting to Adobe custom APIs from webMethods.io, using access and refresh token
The following should be set up in order to achieve the functionality:
• Adobe Experience Platform account
• Adobe developer account access
• webMethods.io Tenant
• Any REST Client (Postman, ARC)
We cover the below steps in this topic:
• Create a project through Adobe Developer Console
• Test Adobe API from Rest Client (ex: postman, soap ui, etc)
• Invoke Adobe API from webMethods.io
• Login to “Loading... | Adobe Developer Console ”
• Go to Projects tab, Create new project
• Click on “Add API” and select “Adobe Analytics”
• On the next screen select authentication type as “OAuth”
• Select platform type as “Web” and provide the redirect URI as needed.
Note: For Redirect URI pattern, you must escape “.” using " \ "
• Once the project is created and the Adobe Analytics API is linked to the project, the CLIENT ID and CLIENT SECRET will get generated.
• Generate Adobe Auth Token by using the parameters as mentioned below on postman:
Grant Type :- Authorization Code Callback URL :- project's REDIRECT URI Auth URL - https://ims-na1.adobelogin.com/ims/authorize/v1 Access Token URL - https://ims-na1.adobelogin.com/ims/token/v1 Client ID :- Project's CLIENT_ID [Obtained in previous step] Client Secret :- Project's CLIENT_SECRET[Obtained in previous step] Scope :- openid,AdobeID,read_organizations,additional_info.projectedProductContext,additional_info.job_function Client Authentication :- Send Client credentials in body
Once you click on the Get New Access Token, it should prompt you to authenticate using the username and password for Adobe.
• Once you authenticate using Adobe Credentials, the access token will be generated.
Note: Access tokens will have a validity of 24 hours and will expire after that.
• Once you receive the token, this can be used to invoke any of Adobe Analytic APIs.
3. Invoke Adobe API from webMethods.io
If the API needs to be invoked on a regular basis or after the token is expired, then a mechanism to re-generate a fresh access token needs to be set up.
This can be done using many ways and below are a few among them:
- Getting the initial access token from the REST client and saving this token on the Account/Flow Store in webMethods.io
- Checking for 401 error during the normal execution of the API and then invoking the token generation service followed by re-trying the API invoke with the newly generated token
One such example of using the account store mechanism is as follows:
Step 1 – Generate Access/Refresh token from Rest Client (Postman). Once this is done, create a workflow and add an account store from the connectors panel.
Step 2 – Configure the account store to set the refresh_token (used in value field in below snapshot).
Step 3 – Create a sample workflow to re-generate access token at a regular interval.
- Get refresh token from store
- Get fresh access token using the refresh token using the following rest call –
Method - POST
URL - https://ims-na1.adobelogin.com/ims/token/v3
client_id - project clientID refresh_token - fetched from account store grant_type - refresh_token client_secret - project clientSecret Set Body Type - x-www-form-urlencoded
- Set the newly fetched access token and refresh token to the Store
• Once the token generation mechanism is setup, we can proceed towards invoking Adobe Analytics APIs.
In order to connect to the API, open a new workflow and then select HTTP Request from the connectors list panel.
• Configure the HTTP action as below :
Note: URL should be the Adobe API URL that needs to be invoked.
• Under the Headers section fill the values as needed to invoke the API
- x-api-key in above screenshot is the Client ID of the Project.
- For Authorization, the access token needs to be passed in the same format as above – Bearer(OAuth token)
• Once the configuration is completed, run the workflow and check for successful response (Status code 200) from Adobe Analytics API.