956
Views
7
Comments
Solved
Rest API returning 404 at runtime

Hi,


I'm setting up a simple integration with a google api https://developers.google.com/knowledge-graph/:

It's a get operation with URL parameters. Something like this: https://kgsearch.googleapis.com/v1/entities:search?query={INPUT}&key={KEY}


I'm able to call it successfully on:

  • Service Studio "Consume API" pop up (and use the response to create the output struct).
  • In my laptop's browser/postman
  • Inside my on-premises machine where outsystems server is running


When I call the api operation from a screen action I'm getting a 404 Not Found error.

If I go to service center - monitor - integration and copy the URL from the log it works when I call it as described above.




Also tested on my personal cloud and have the same problem so it doesn't look like an infrastructure issue.


Any ideas?


Thank you and best regards

UserImage.jpg
Hugo Meira
Solution

Hi all


Thank you for your replies.


I found the issue and was able to workaround it.


The API URL path contains a ":" - /v1/entities:search

It was being replaced by the HEX code %3A that wasn't being recognized by the API. For now I'm replacing it in onBeforeRequest action with the ":" and I'm getting the expected response,


Best regards

2018-09-27 18-20-33
Swatantra Kumar
Champion

Hi Hugo,

404 is resource not found. It has nothing to do with infrastructure/server.

Check the formation of URL from screen action. Most likely the dynamically generated URL is malformed.

Regards,

Swatantra

UserImage.jpg
Hugo Meira

Swatantra Kumar wrote:

Hi Hugo,

404 is resource not found. It has nothing to do with infrastructure/server.

Check the formation of URL from screen action. Most likely the dynamically generated URL is malformed.

Regards,

Swatantra

Thank you.


If I use the url from the logs outside the flow it works.

I've also tested removing the parameters and hardcode them in the URL in the operation definition and I get the same error.


2024-06-26 06-49-09
Dileep Kumar Verma

Hi Hugo,

Can you try Base64 encoding url and check. Hope It will help.


Thanks

Dileep

2020-02-28 09-46-54
Eduardo Jauch

Hi, 

Could be that the search is not returning anything and the Api is using the 404 to indicate it? This is very common in Rest services. 

You can increase log level or add an OnAfterResponse so you can check the answer in runtime. 

Cheers 

2018-09-27 18-20-33
Swatantra Kumar
Champion

Hugo, increase the logging verbosity and indicate the response headers.

Also, check the API treatment towards CORS possibility, that also returns 404. 

UserImage.jpg
Hugo Meira
Solution

Hi all


Thank you for your replies.


I found the issue and was able to workaround it.


The API URL path contains a ":" - /v1/entities:search

It was being replaced by the HEX code %3A that wasn't being recognized by the API. For now I'm replacing it in onBeforeRequest action with the ":" and I'm getting the expected response,


Best regards

2018-09-27 18-20-33
Swatantra Kumar
Champion

Hugo, that's malformation of URL. Special chars manipulated the original URL, hence 404.

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