41
Views
4
Comments
Solved
API requests not working

Hello,
I'm working on ODC. I created a new library, the purpose of this to connecto to an API and do POST and GET requests. The API is on Flask and Python, on a docker of a server.

I add the API at Logic<REST<Add single method, the base URL like "http://192....", in the case it's just a GET I paste the JSON response on Body Response text area, on Headers I use authentication so I select it, then at the "Test" I try it and everything is correct, the docker receive it and execute. If is a POST  the same but with the body Request and do the same, all nice.

The problem is when I callthem from code using a Server Action to consume the implemented API methods. All data is correct, but it gives me an error and is not from the server's docker, it does not receive the request. Looking for information at "Logs" and "Traces" on ODC Portal I saw it's return me a 205 error. I'll post an image of the errors.

Please someone could help me? I don't know where the problem could be.

Thanks u all!!



error1.jpg
error2.jpg
Solution

Unfortunately I am not working with ODC at the moment, so I cannot try things out. Probably the "Test" button is performing the test locally. For O11 I tested this but the test seams to use the server environment.

If you try to access local resources from your ODC instance, I guess this article could be helpful for you: Configure a private gateway to your network - ODC Documentation (outsystems.com)

My question probably seems a bit silly, but I'm wondering if you are trying to connect from your app hosted in ODC to an API hosted at "http://192...." (as you wrote). In case you are trying to connect to an IP address starting with 192.168.xxx.xxx: these addresses belong to a reserved address range for private networks. Traffic to these addresses must not be forwarded to public networks such as the Internet. Perhaps you need to use a different interface of your external API host or have you configured a VPN connection for your ODC app?

Hey there!

It could be an idea for a solution, but in that case when I test the call on the "Test" window, the error should be the same, isn't it?


Thanks for helping me!!

Solution

Unfortunately I am not working with ODC at the moment, so I cannot try things out. Probably the "Test" button is performing the test locally. For O11 I tested this but the test seams to use the server environment.

If you try to access local resources from your ODC instance, I guess this article could be helpful for you: Configure a private gateway to your network - ODC Documentation (outsystems.com)

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