on 2024 Jul 02 9:22 AM
Hello experts,
I am currently trying to make a call to the SAP CPI I-Flow via an SAP Analytics Cloud Custom Widget.
The I-Flow is triggered via REST-API and everything works so far via Postman with Basic Authentication via ClientID + ClientSecret.
Unfortunately, the REST-API call fails when I try it from the SAP Analytics Cloud/Javascript.
Here you can see my current I-Flow Settings in the REST-API:
Here you can see my current coding in SAP Analytics Cloud/Javascript:
AJAX Call:
$.ajax({
url: apiUrl,
type: "POST",
headers: {
"Authorization": "Basic " + btoa(username) + ":" + btoa(password)
}
})
.done(function (data){
$.each(data, function (key, value){
})
})
.fail(function (jqXHR, textStatus){
alert("Error: " + textStatus);
})
I get the following error when executing:
it has something to do with Cors Policy, but i dont know exactly how to handle this problem.
I also tested it with the Fetch Call but the same error appears.
Can you help me here what my error could be?
If you have any further questions, please do not hesitate to contact me.
Best regards
Chris.
Request clarification before answering.
Hi Chris,
This is the expected behavior, and the reason is that SAP Cloud Integration does not reply correctly to the HTTP OPTIONS call. You must use API Management before your SAP Cloud Integration endpoint to avoid CORS issues.
Please find the tutorial as part of the SAP Learning" https://developers.sap.com/tutorials/btp-integration-suite-integral-api-management.html
The important thing is that your policy sets the correct response to every CORS request.
I hope this helps you.
Best regards 🖖🏻
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 7 | |
| 6 | |
| 6 | |
| 6 | |
| 4 | |
| 3 | |
| 3 | |
| 3 | |
| 3 | |
| 3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.