on 2021 Feb 15 7:53 AM
Hello,
I'm working on IRPA 2.0 based on cloud SDK. I have to call the standard S4 HANA API in my IRPA bot to get the data and post it to standard standard transaction.
I'm referring the https://help.sap.com/doc/d69213c343964f97af7829a37f4c6d4d/Cloud/en-US/modules/request.html standard documentation to call webservice however it doesn't provide any information on how to pass authorization to the API URL via header.
Please suggest how we can authorize the API while using irpa_core.request.call.
Thanks,
Muthu
Help others by sharing your knowledge.
AnswerRequest clarification before answering.
Here an example from SAP BusinessObjects application, may still be useful to guide you in the right direction:
Logon request (code snippet) to get a session token
const body = JSON.parse(parameter.body);
const options = {
resolveBodyOnly : true,
responseType: 'json',
url: JSON.parse(parameter).baseUrl + 'logon/long',
method: 'POST',
headers: {
'Accept' : 'application/json',
'Content-Type': 'application/json'
},
body : JSON.stringify({
'password': body.password,
'clientType': '',
'auth': 'secEnterprise',
'userName': body.userName
})
};
const response = await irpa_core.request.call(options);
//irpa_core.core.log(response);
parameter.logonToken = response.logonToken;
Logoff reqeust (code snippet) using the session token
const body = JSON.parse(parameter.body);
const options = {
resolveBodyOnly : true,
responseType: 'json',
url: JSON.parse(parameter).baseUrl + 'logoff',
method: 'POST',
headers: {
'Accept' : 'application/json',
'Content-Type': 'application/json',
'X-SAP-LogonToken' : parameter.logonToken
}
};
const response = await irpa_core.request.call(options);
//irpa_core.core.log(response);
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks!! it worked.
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.