on 2024 Aug 12 5:01 PM
Hi,
I'm trying to use HttpRequestViaScript to execute a POST request to get a bearer token for an API using Automation Pilot but I'm having issues populating the Parameters correctly.
As an example, if the authorization is Basic Auth, what should go in "authorizationHeader"?
Also, in "headers", I would like to populate things like the Content-Type and (if necessary), the grant_type.
Examples of using HttpRequestViaScript that I've seen don't really show how to populate those parameters.
Any specific examples would be greatly appreciated.
My end goal is to create a command that not only retrieves the Bearer Token for the API but then passes it to another HttpRequestViaScript for another HTTP request.
If any more information is needed from me, please let me know.
Thanks in advance!
Ron
Hi Ron!
First, thanks for looking into SAP Automation Pilot and I hope you like the tool!
Some context: to speed up the onboarding into SAP Automation Pilot we have created a public Github repo with sample end-to-end use cases and ready to import commands plus a detailed explanation on trigger these. Please find a link to this repo here: https://github.com/SAP-samples/automation-pilot-examples/tree/main?tab=readme-ov-file#sap-automation...
You can find out more details on how import any of these sample end-to-end commands here: https://github.com/SAP-samples/automation-pilot-examples?tab=readme-ov-file#how-to-use
Having said that, going to your specific question . How I get it - you want to generate a token and then use the token already generated in your next executor within the Automation Pilot command. You are checking the provided command about "HTTP Request via Script" which is used when working with synchronous HTTP APIs and request to such APIs might take minutes to complete. However, I think HttpRequest provided command will be fine for your use case. To explore a similar use case where exact these steps are covered (generating a token and using it within the next executor) , please see this example: https://github.com/SAP-samples/automation-pilot-examples/tree/main/check-hana-cloud-availability#che...
Note: you can import this example in your Automation Pilot tenant and explore it, as an expected result you should get this end to end automation flow:
As you will see, more interesting for you should be these two executors:
For both executors the method is "GET" but you can change it to "POST" as per your specific needs. Moreover, to modify the request, simply click on the "edit" link and then you can change / add more parameters, see below:
I have described this use case in details in this blogpost as well: https://community.sap.com/t5/technology-blogs-by-sap/automated-availability-check-for-sap-hana-cloud...
I hope also these details will help you to setup the needed automation flow. In case you face any troubles please reach out to me directly at biser.simeonov@sap.com and if I can help will do so (if not - I can schedule a deep dive with our support team).
Kind regards,
Biser
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
79 | |
10 | |
10 | |
10 | |
10 | |
9 | |
8 | |
7 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.