401 error which I do not understand

Hello, 


I have added a new fetch from the external api but since then I see a 401 error. 

I find it the wierdest that if I make the rest api call on the  logic tab everything works fine. 


On the service center I see this error message which also do not make any sense to me. 


Error Detail
Back to Log
Id:
4f46756c-7553-4af1-aee9-cf58ec4b6da2
Time of Log:
2019-11-04 07:26:34
Request Key:40b0cd12-920e-4a28-85fd-cdc0ef7ca20a
Module:
Filmdatabase
Tenant:
Users
User:

Session Id:
aHlNhCak2U+1+0wYIjD0UA==
Server:
S6EX3-LT85NL
Module:
REST (Consume)
Message:


401 Unauthorized


Environment InformationeSpaceVer: Id=72, PubId=0, CompiledWith=11.0.606.0
RequestUrl: https://roelof-wobben5.outsystemscloud.com/Filmdatabase/screenservices/Filmdatabase/MainFlow/MovieData/DataActionGetMovieDetails2 (Method: POST)
AppDomain: /LM/W3SVC/36/ROOT/Filmdatabase-11-132172498165590558
FilePath: C:\OutSystems\Sandboxes\SPJPYI033\Platform Server\running\Filmdatabase\
ClientIp: 82.74.147.203
Locale: en-US
DateFormat: yyyy-MM-dd
PID: 10128 ('w3wp', Started='11/2/2019 8:01:29 PM', Priv=508Mb, Virt=2115207Mb)
TID: 21
Thread Name:
.NET: 4.0.30319.42000
Stack:
401 Unauthorized
   at ssFilmdatabase.CcThemoviedb2.ActionGetMovieDetails(HeContext heContext, ICcThemoviedb2Callbacks _callbacks, String inParammovie_id, String inParamAPIKey, STGetMovieDetails3ResponseStructure& outParamResponse)


Anyone a idea what can be the cause of this.


Roelof


Solution

Hi Roelof,

Thanks for providing the .oml file which made it easier to see what was wrong.  So the 401 Unauthorized would point to an invalid web request, and in this case this was the API call you made.

Look at the GetMovieDetails2 data fetch action, it has an unspecified APIKey value.  It was empty so I added used the ApiKey site property as the value and now it works.

I suggest also making the APIKey parameter in your REST methods mandatory to prevent this from happening in similar instances.

Hope this works for you.

Regards,

Dylan

Solution

Thanks, I overlooked 4 days this stupid one. 

Hi,

I'm getting the same error when selecting new application on the Service Studio. Can someone help me, please?

Best regards,

Maria Eduarda Varandas