Skip to Content

Consuming oData for function import using Javascript or C#

Hello Experts,

Below URL works fine from REST Client when tested but we are not able to do it in C# or Javascript.

http://115.111.213.74:8000/sap/opu/odata/sap/ZWRK_CTR_GW_SRV/ZWRK_CTR?IsNotifNo='000300000131'&IsPlant='0001'&IsWrkCtr='CENTER6'

The Get Method work fine for getting  x-csrf-token value, but using the token we are getting error for POST method.

Please provide any code snippet for using above URL which is developed using function import to POST the data using x-csrf-token value

for C# or JavaScript.

Please Suggest

Regards

Manish

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Sep 19, 2013 at 05:51 PM

    Hi Manish,

    Here you find code for Javascript.

    http://scn.sap.com/community/developer-center/front-end/blog/2012/06/06/sample-ume-application-using-sapui5-and-sap-gateway--part-ii

    You have code for

    1. Issuing Get request to fetch the csrf token

    2. Get the token value

    3. Issue a Post request.

    Thanks

    Krishna

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi Schepers, Thank you for pointing out that storing the cookies is the solution. It's inspiring and finally I solved the issue.