cancel
Showing results for 
Search instead for 
Did you mean: 

Odata Service

yogesh_pathak
Participant
0 Kudos

Dear Sir,

I am going through the video By JustToShare: OData Service CURD Operations & HTTP method and creating the OData Service in S/4 HANA On Prim. Dev. Server.

I have redefine the CREATE_ENTITY, GET_ENTITY & GET_ENTITYSET Methods.

While GET Operation the break point in the GET_ENTITY Method is working but for POST Operation it is not working and returns with HTTP Error 403 Forbidden.

If there is an authorization issue, If yes then how to grant the authorization.

Have to pass the CSRF Token? If Yes then how?

I have browse the content on the internet for the issue but did not find the one.

Please revert.

Thank you.

Yogesh

View Entire Topic
BhargavaReddy
Active Participant
0 Kudos

Hi, CSRF token is required to POST/PUT. for that, you need to fetch the CSRF token before the POST call.
go through following blog
https://blogs.sap.com/2021/06/04/how-does-csrf-token-work-sap-gateway/

yogesh_pathak
Participant
0 Kudos

Dear Sir,

Thank you for your quick reply.

I have passed the x-csrf-token as well as cookie and I found success.

My silly mistake was, In Request URI, I was not passing https://server_name:port_number and was only passing /sap/opu/odata/sap/service_name/entity_name.

Thank you once again for your prompt answer.

Regards.

Yogesh