cancel
Showing results for 
Search instead for 
Did you mean: 

​SAP C4C OData Service URL Authorization Problem

former_member758001
Discoverer
0 Kudos

Dear Community,

For an integration project I need to connect SAP C4C with a preconfigured SAP Connector of an iPaaS.

The connector only needs the OData service URL, username and password to establish a connection.

Via Postman I can successfully address all endpoints like "/sap/c4c/odata/v1/c4codataapi/LeadCollection".

When I enter "/sap/c4c/odata/v1/c4codataapi/" as the OData Service URL, I get an error with both Postman and the Connector.

The error message at Postman is: "Unauthorized: The service 'c4codataapi' is not assigned to you."

In this case, is the service URL to be entered a different one or am I just missing an authorization here?

If it is an authorization problem, how do I enable the authorization specifically for "/sap/c4c/odata/v1/c4codataapi/"?

pvsbprasad
Active Contributor
0 Kudos

Hi,

May be cache issue.check the url in browser

Accepted Solutions (0)

Answers (3)

Answers (3)

former_member226
Employee
Employee

Hi Mikail,

First of all which user are you using to trigger endpoints https://myxxxxxx.crm.ondemand.com/sap/c4c/odata/v1/c4codataapi? Is it a Technical User that is generated via communication arrangement or is it a business user?

If it is a technical user then you are not allowed to use endpoint "/sap/c4c/odata/v1/c4codataapi" because you cannot assign the authorisation for this via communication arrangement. Here then you need to use specific endpoints like follow(can be copied from communication arrangement)

https://my3XXXXX.crm.ondemand.com/sap/c4c/odata/v1/c4codataapi/$metadata

https://my3XXXXX.crm.ondemand.com/sap/c4c/odata/v1/c4codataapi/$metadata?$filter=Visit

https://my3XXXXX.crm.ondemand.com/sap/c4c/odata/v1/activity/$metadata

Further why you need to access /sap/c4c/odata/v1/c4codataapi endpoint?

BR

Saurabh

smithshah
Explorer
0 Kudos

Hi @Saurabh Kabra

How do we get the csrf token required for post requests when using technical user, generated via Communication System?

former_member226
Employee
Employee
0 Kudos

Hi smith06,

There is no need to fetch CSRF token, when authenticating with technical user generated via comm arrangement. You can simply make a post call 🙂

palu
Employee
Employee
0 Kudos

Hi Mikail,

Technical users are used for Integration Purposes. These users are created internally by the system when you create a communication scenario between C4C and external system.
Business users can be used for testing purposes. Example: You can use Business users in tools like Google Chrome or Postman to test the Odata Calls.

I have executed the URL given by you in Google Chrome with my user and it was working for me.

So, this should be an issue either with the user or the tool you are using to make this call.

But, this url just gives you the list of entity collection under the c4codataapi.

Response for this URL :


Regards,

Palani.

palu
Employee
Employee
0 Kudos

Hi Mikail,

Kindly check whether the Business user which you are using is having unrestricted access to the Odata Service Explorer.

Also, the URL should be https://myXXXXXX.crm.ondemand.com/sap/c4c/odata/v1/c4codataapi/

Where XXXXXX is the tenant ID.

Regards,

Palani.

former_member758001
Discoverer
0 Kudos

Hello Palani,

thank you very much for the answer.

As I know the user that I use for the API connection has no limitations.

I get a successful response for all endpoints like ".../sap/c4c/odata/v1/c4codataapi/LeadCollection" or ".../sap/c4c/odata/v1/c4codataapi/OpportunityCollection".

But as already communicated in my first question, specifically for the address "https://myXXXXXX.crm.ondemand.com/sap/c4c/odata/v1/c4codataapi/" I get the following response:

--> "Unauthorized: The service 'c4codataapi' is not assigned to you."

Where exactly is the setting to be made explicitly for ".../sap/c4c/odata/v1/c4codataapi/"?

And is it necessary to use a technical user instead of a business user?

Kind regards,

Mikail