316
Views
5
Comments
Solved
Receiving error 404 while loading screen using Api
Question

I am consuming a set of API for my screen. While the api are working fine when i am testing them using Postman. Also its showinng the desired output in outsystems but on the UI front it is showing error 404. Can anyone please help

Scrrenshot of UI-



Screenshot of  consuming the api and testing which shows the output is being received 


2020-09-15 13-07-23
Kilian Hekhuis
 
MVP
Solution

Hi Saif,

A 404 can mean two things: either the URL you have configured doesn't exist at all, or the resource you are trying to access doesn't exist. In the first case it's the web server "at the door" of the host that returns the error as it can't find the end point, in the second case it's a valid URL but the application running on the other side can't find the resource you specified.

Regardless, you haven't provided enough information for us to be able to see what's wrong. What you need to check:

  • In Service Center, open the detail page of the module that calls the REST method and check (on the Integration tab) whether the configured URL is correct;
  • In Service Center, check the Integration Log for details. Also make sure you increase the logging level of the REST API (also on the detail page of the module, Integration tab), set it to "Full". This will allow you to see the entire HTTP trace, which will also show you the cause of the 404 (probably you'll get an HTTP 404 error page if the URL is wrong, but a JSON response with some error message if the resource is not available).
2022-10-11 21-19-04
Fábio Miguel Ferreira Coelho

Hi Saif,


I hope you're doing well.


Regarding this issue, you can customize your response on the "OnAfterResponse" - Use to modify the information of the original response, such as the status code or the response text.

Please see these OutSystems documentation:


I hope that helps you.

Let me know if this solves your issue.


Kind regards,

FC

2024-07-05 14-16-55
Daniël Kuhlmann
 
MVP

I am confused but what you proposed, it doesn't read like an answer to the question.

The way I read the question, the API call works from Postman or when testing the API in Service Studio, but when done in OutSystems it doesn't.

So it is about exploring why he gets a 404, not changing the message returned.

@saif sheikh am I correct in what I think you are asking?


2022-10-11 21-19-04
Fábio Miguel Ferreira Coelho

I understood that the API is working in Postman and it's working in OutSystems, but when he tries to show the results on the UI receive the error 404.


Error 404 - Not Found - The specified REST API or method doesn't exist. 


So I suggested @saif sheikh change the status code to see what's happening.

Maybe can be the same issue as this.

2020-09-15 13-07-23
Kilian Hekhuis
 
MVP

Yes, you suggested it, but it's bad advise. He should first check what the source of the 404 is, changing the status code by an On After Response is really the last resort, once you know what is wrong.

2020-09-15 13-07-23
Kilian Hekhuis
 
MVP
Solution

Hi Saif,

A 404 can mean two things: either the URL you have configured doesn't exist at all, or the resource you are trying to access doesn't exist. In the first case it's the web server "at the door" of the host that returns the error as it can't find the end point, in the second case it's a valid URL but the application running on the other side can't find the resource you specified.

Regardless, you haven't provided enough information for us to be able to see what's wrong. What you need to check:

  • In Service Center, open the detail page of the module that calls the REST method and check (on the Integration tab) whether the configured URL is correct;
  • In Service Center, check the Integration Log for details. Also make sure you increase the logging level of the REST API (also on the detail page of the module, Integration tab), set it to "Full". This will allow you to see the entire HTTP trace, which will also show you the cause of the 404 (probably you'll get an HTTP 404 error page if the URL is wrong, but a JSON response with some error message if the resource is not available).
Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.