HTTP/1.1 401 Unauthorized error while trying to consume odata service
Question
Service Studio Version
11.11.8 (Build 45664)

My requirement is to consume an odata service in Outsystems.

What error did i face?

  • When consuming REST API with single method and test it, I am getting an authorization error. Please see in screenshot attached

Can anyone suggest me what I need to do in order to fetch the response. 

2021070615h3341.png

mvp_badge
MVP

Hi Ram,

Given that error, I would expect you are missing some header parameter for authentication. "SPNego" is an ancient protocol for negotiating security protocols, and not used by modern browsers.

Hello Kilian,

Thank you for your response. I am connecting with an SAP S/4 HANA system, trying to consume the odata service. I tried with Basic Auth but couldn't receive any response. Could you please elaborate what other information i could enter in authorisation to achieve the desired result

2021070617h4714.png

mvp_badge
MVP

Hi Ram,

That should be in the API documentation for SAP, right? I have no knowledge of SAP HANA, but if it provides an API, the API documentation should give you all the details.

Hi ram, 

401 unauthorized error will be due to cookies check you are passing cookie or not if you pass cookie value it will be work fine.

For confirmation you also check on postman as well. 

Hope this will solve your issue.


Thanks and regards,

Akshay Deshpande.

mvp_badge
MVP

401 just means you don't pass the right authorization, I don't think cookies have anything to do with it.

Hello killan,

Actual I had also face this issue and that is solved using cookie because they were give authorization using cookie.

I had solved that issue using cookie that's y I have suggested same to him 

And somewhere in header part cookie also need as per my scenario.

Thanks and regards,

Akshay Deshpande.

mvp_badge
MVP

I guess that depends on the authentication mechanism. Could as well use basic authentication, or bearer authentication, etc.

Hello Akshay,

Thank you for your response. I am not sure i understood how to check the cookies is available in the header. could you please tell me in more detail how to add?

Thanks,

Ram

mvp_badge
MVP

Hi Ram,

You need to understand what kind of authorization the REST API is requesting. It seems you don't know that, but it is absolutely very important to figure it out!

Hello ram 

Actual I would like to suggest you that you will hit that API in the postman so from that you will get header,cookie all the part because in the postman it is automatically set so first check on the postman if it's working then pass same parameters in the outsystems as well 

Thanks and Regards,

Akshay Deshpande.

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.