2021 Oct 25 5:45 PM - edited 2024 Feb 04 2:22 AM
Hi,
I have created IRPA bot to update the custom business object data via API through IRPA after business process execution. We have custom script that makes dummy call to the S4 HANA cloud API. From the error response, we will retrieve csrf token however after IRPA Core SDK update the below codes stopped working. Please suggest if you have any other alternative to retrieve csrf token to do post/patch operation to S4 API.
const options = { resolveBodyOnly: true, responseType: 'json', url: vURL, method: 'GET', headers: { 'x-csrf-token': 'fetch', 'Accept': 'application/json', 'Content-Type': 'application/json', 'Authorization': auth }};var token = '';try { const response = await irpa_core.request.call(options);} catch (error) { token = error.response.headers['x-csrf-token'];Request clarification before answering.
Hi Muthu,
If I remember correctly, the timeout is set to 30 minutes and I believe it is tied to the session timeout. Please check if you suspect there is a timeout issue.
I would recommend you look into the cause of why the token stops working.
One question that comes to mind is why you are only getting the token on error conditions?
Please be sure to also always log out after sending your message, or at least be sure that you are properly handling the sessions so they are never "left open". The system limits the number of open active sessions - this could be a cause of the failed messages if you reach the upper limit. (100)
Please see the note: 2760552 - Limitation of generation of HTTP security sessions
A couple of other interesting links:
(this is for successfactors, but still some good information): 2735876 - Odata API Best Practices [Query Modified Records, Pagination - Batch Size, Timeouts, etc.,...
https://answers.sap.com/questions/13244563/what-is-the-odata-api-timeout-on-s4hana-clould.html
App you may find helpful (Display Connectivity Trace)
Thank you
Jerry
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Issue here is different. I'm trying to call the S4 API in the IRPA bot using custom script. API call works fine. I have to perform an update operation for that I need CSRF token. Code used to get the token from error response based on the blog https://blogs.sap.com/2021/02/17/use-sap-analytics-cloud-rest-api-with-sap-intelligent-rpa-automatio...
In the example from SAC, the reason why this is done with the error.response is just, that the request is searching for a SAC group which doesn't exist.
If your request works fine, you should get it directly from the response response.headers['x-csrf-token']; and of course not in the catch but directly after the await irpa_core.request.call().
antoraja
As you had mentioned the code was working with earlier Core SDK.
Can you tell me which version of core SDK the code works and version of SDK where the code not to work.You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You can check the Webservices Sample BOT from BOT store(Learning Content)
User | Count |
---|---|
75 | |
30 | |
9 | |
8 | |
7 | |
6 | |
6 | |
5 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.