401- Unauthorized error on calling rest api

Hi,

I am getting 401 error on calling rest api, while i am using rest api on  the page its working fine .But if i am using the same rest api inside the popup i am getting 401 error. Can anyone help me with  the solution.

Regards,

Koushik

Hi Koushik,

While calling API from popup, can you check if you are getting CORS (cross-origin) error?
Also check you are calling correct API with http or https as per your requirements.

Regards,
Palak Patel

Hi Palak,

I am not getting the CORS error and its not the problem with http or https.

Regards,

Koushik

Hi Koushik,

If possible share your oml or screenshot from which we can replicate the issue to better assist you.

Regards,
Palak Patel

Hi Koushik,

The error you are getting is on the load of popup or when you call the API ? 

Did yo specify any role on the popup ?


Regards,

Pramod Jain

Hi Pramod,

Inside the popup i am having the button on the button click i am calling the API, I am having set of roles in my application but i selected all those roles but i am facing the issue.

Regards,

Koushik


Hi Koushik,

Did you checked the API logs in service center , if possible can you please share the screen shot for the same.


Regards,

-PJ-

PRAMOD JAIN wrote:

Hi Koushik,

Did you checked the API logs in service center , if possible can you please share the screen shot for the same.


Regards,

-PJ-

i am getting the following error in the service center

401 Unauthorized
   at ssLOS_API_Connector_IS.CcTtavatarIifl.ActionGenericRestApiCall(HeContext heContext, ICcTtavatarIiflCallbacks _callbacks, String inParamRestUrl, String inParamRequest, String inParamContentType, String& outParamResponse)
   at ssLOS_API_Connector_IS.Actions.ActionGenericRestCall(HeContext heContext, String inParamUrl, String inParamRequest, String& outParamResponse)
   at ssLOS_API_Connector_IS.Actions.ActionFetchSelectClientHunter(HeContext heContext, STSelectClientHunterRequestStructure inParamSelectClientHunterRequest, STSelectClientHunterResponseStructure& outParamSelectClientHunterResponse)
   at ssLOS_Entity_CS.RsseSpaceLOS_API_Connector_IS.MssFetchSelectClientHunter(HeContext heContext, IRecord inParamSelectClientHunterRequest, IRecord& outParamSelectClientHunterResponse)
   at ssLOS_Entity_CS.Actions.ActionHunterCall(HeContext heContext, String inParamProspectNo, Boolean inParamIsHunterCall, STHunterDetailResponseStructure& outParamHunterDetailResponse, String& outParamHunterResponseMessage)

Hi,


The  only conclusion that can be made from the error stack is that the 401 is indeed comming from your remote service.

How is the authentication made on that call? It has authentication information in the SelectClientHunterRequest structure? What does the service on the other side check?


A bit on a side note, but that generic rest call there is a bit weird, doesn't that make it hard to maintain it? Looks like you losing most of the REST API advantages and productivity boost that the platform gives you there.


Regards,

João Rosado

Solution

I am not setting the token for the api call

Solution