Consume REST Api with optional parameters


I'm trying to create a rest api call that uses a lot of parameters. The api delivers a route between 2 points.

So as an example of the optional parameters is "waypoint.1", "waypoint.2", "waypoint.3" and so on. In most cases you will only need the first 2 waypoints but in some requests you need more. To make things even better there are loads of other parameters to change the behavior of the routing engine that can be inserted if requested. And to add even more complexity, there are some optional parameters that have positional requirements (Via Waypoints). And for the cherry, the numbering of the waypoints and viawaypoints must stay intact (waypoint.1, viawaypoint.2, waypoint.3, waypoint.4, viawaypoint.5, waypoint.6. You get the idea). 

API documentation here:

Due to the flexibility of the API my approach was to construct the parameter string myself and provide that as a query parameter. Construction of the parameters goes well and tests in Postman shows that these are correct and valid information is returned. 

The problem appears when I provide the Rest function with this string. The default behavior of Outsystems is to encode all characters to make them URL safe. Nothing wrong with that normally but for me it is problematic and causing issues. The receiving end is throwing several errors that parameters are missing. I get the same error when I encode the parameter string myself in Postman.

So I have several questions because I'm currently not on the correct path to a solution;

- Is it possible to turn off the default URL encode behavior of the Rest Integration?

- Does Outsystems have a build-in method to handle optional parameters?

- Is there any native alternative? (IE, not resorting to Forge components as I want to minimize dependencies) ?

- Can I extend the Integration log so that it includes the parameters send (and not only the URL called)?

Hi Vincent,

I had the same issue with a REST API I was calling, it has a bunch of optional parameters and when I added it to the eSpace I couldn't get it to work.

One workaround I found was to include *all* the parameters when adding the REST API method, and then manually changing the Is Mandatory property of all the optional parameters. You can even define default values for any non-mandatory parameters, if you want.

You can also manually add parameters to the REST API action, and you can define them to be non-mandatory too.