Hello,
In one of our clients' use case, we are working with an external system to which we need to make two API calls.
Call 1: Will give an API token. This API token is sent in response header (not in response body)
Call 2: Using the token from call 1, we have to call another API end point to save/update some data.
I know that in AJO custom action & data source, we can get the response body. But I am not sure how to get the response header.
Please share some ideas/thoughts how approach to this problem.
Thank you and have a nice day ahead.
Solved! Go to Solution.
Topics help categorize Community content and increase your ability to discover relevant content.
Views
Replies
Total Likes
You can use it on the following lines, specifying the type of authorization as "Custom Authorization"
This will incorporate the access token in the outbound api call via custom actions https://experienceleague.adobe.com/en/docs/journey-optimizer/using/configuration/configure-journeys/...
Could you share the requirement as to why response headers are needed ?
Views
Replies
Total Likes
@dugganab thanks for your response.
The external system is designed to send API token in response header ONLY.
So, we need a way to retrieve data from response header.
Views
Replies
Total Likes
You can use it on the following lines, specifying the type of authorization as "Custom Authorization"
This will incorporate the access token in the outbound api call via custom actions https://experienceleague.adobe.com/en/docs/journey-optimizer/using/configuration/configure-journeys/...
@dugganab , I am trying but it is not successful yet.
So, to clarify, in the custom action > custom authorization > I have to put the entire request that get the API token (call 1) > then the token will be applied to call 2. So, I just need one custom action. Please confirm.
Views
Replies
Total Likes
Correct, it is just one custom action. What is the error you are running into ?
@dugganab , seems like Basic Authentication is not supported in authenticationType.
The system we are trying to access is using Basic auth (user & password) for call 1 to get the token.
Hence, the authentication is not getting successful.
Views
Replies
Total Likes
If it is basic authentication, you can switch the type to Basic.
@dugganab , in that case, how to accommodate two calls in same action & retrieve the response header?
Views
Replies
Total Likes
If the end point you are trying to hit supports basic authentication, you don't need custom authorization.
@dugganab , Yes, it's OOTB.
But the point is I have to get the security token from call 1- response header.
Then that security token needs to be applied when calling the main api (call 2)
Views
Replies
Total Likes
In the screenshot shared earlier, all of this happens in a single custom action & header ( -H "Authorization: Basic <base64 enconded username:password>") gets appended automatically when the custom action is invoked.
Just adding a little more info to @dugganab ’s suggestion
Call 2 should work with username/password as header parameters, not only with an API key (API Key is generated based on username and password). Please talk with the external system team to confirm that Call 2 works with username/password as header parameters. If confirmed by the external system team, proceed with basic authentication in AJO so that the username/password will be automatically added as header parameters to the Call 2 endpoint.
Call 2 - API key as header parameter https://abc.my.workfront.com/attask/api/v17.0/project/search?apiKey=xyz46v12vrz9snfkltyfeyefe0b0gx5h...
Call 2 - username/password as header parameter https://abc.my.workfront.com/attask/api/v17.0/project/search?username=anuhya.y@abc.com&password=hsgd...
Views
Replies
Total Likes
@Anuhya-Y , in that case, I am not getting the API token from call 1 which is required to authenticate call 2.
Views
Replies
Total Likes
@Joydeep Do NOT depend on Call1 to generate the API key. Instead, for Call2, just add the username and password details, which will internally create an API key. Could you please validate the Call2 response in Postman by passing the username and password as header parameters instead of the API key? Also, may I know the name of the external system?
Could you let me know if you're using custom authentication to generate token? If yes, the token generated from call 1 will pass as a request header parameter for call 2.
Check out these links https://medium.com/@anuhyareddy.y/ajo-jo-sending-email-delivery-via-3rd-party-marketing-automation-t...
Views
Replies
Total Likes
Views
Replies
Total Likes