Error 404 when consuming a REST API

Good morning,

I'm trying to implement a GET method when consuming a REST API and the issue I'm facing is the following:

This is a simple GET method using a baseUrl that is constant and the rest of the endpoint (let's call it resourcePath) is dynamic.

That "resourcePath" is generated by an external API and we retrieve it after other interactions.


When trying to use that resourcePath in this GET, the issue I'm facing is with the encoding, as seen below.

 Example Wanted URL: https://outsystems.com/v1/example/RandomGeneratedToken/oranges

So, with that, the process I'm following is:

Define the GET endpoint as - https://outsystems.com/{resourcePath}

In the call, I pass the resourcePath:/v1/example/RandomGeneratedToken/oranges


Problem: After the call is made, an Error 404 is returned because the resourcePath, due to some Enconding changes not actively done by me, changes... Making my URL look like this:

https://outsystems.com%2Fv1%2Fexample%2FRandomGeneratedToken%2Foranges


How can I stop this from happening, or if it is not possible: How do I deal with it?


Solution

Hi André,


I had this problem in the past and what I did to solve it was creating a function which through regex would resolve the encoding problems like on the image below:


 

Then, on the OnBeforeRequest, I would "fix" the URL and it worked (see image below):



Hope it helps.

João

Solution