We’ve established the destination as below and when we check connection response is successful:
Connection to “C4C_ODATA” established. Response returned: “307: Temporary Redirect”
URL: https://myXXXXXX.crm.ondemand.com/sap/c4c/odata/v1/c4codataapi
I can see the destination, but when I click I receive the error below:
Here’s the request details:
Request URL: https://btp-XXXXXXXXXX-platform.appgyver.black/destinations_api/v1/destination/C4C_ODATA
Request Payload: {url: "", headers: {Accept: "application/json, text/plain, */*"}, method: "get"}
Response: {"status": 500, "statusText": "Internal Server Error", "headers": {"content-type":"application/json; charset=utf-8","etag":"W/\"7c-juHELD4z/abrcq/AO4ayZhQVISo\""}, "responseText": "{\"error\":{\"code\":\"ERROR\",\"message\":{\"lang\":\"en\",\"value\":\"Unauthorized: The service 'c4codataapi' is not assigned to you.\"}}}"}
When I checked the C4C OData Monitor I saw the request as below:
The issue here is that when using a technical user (as BTP Destination recommends) C4C does not accept requests without a valid path. To get a successful response a collection needs to be added.
What I mean by that:
/sap/c4c/odata/v1/c4codataapi/ActivityCollection is OK
/sap/c4c/odata/v1/c4codataapi/$metada is OK
/sap/c4c/odata/v1/c4codataapi/ not OK
When doing the test call for C4C OData (myXXXXXX.crm.ondemand.com), AppGyver should include $metadata to then so the call could be successfully authorized.