What alternative solutions exist within the OutSystems platform for handling APIs that use parameters in the URL of REST GET requests, such as https://example.com/data/main-data?id={id}&value={value}, as OutSystems sometimes fails to assemble them correctly? Is manual manipulation via the OnBeforeRequest event, constructing the URLPath with the values at hand, the only viable solution? Additionally, how can one address the discrepancy where the REST call works within the testing tool of OutSystems but fails when invoked in Server Actions or Service Actions?
Hi,
Not sure what you mean with that OutSystems fails sometimes. The options you have is to specifies if the value of the input parameter is to be received in the URL, the Header or Body of the HTTP request.
-- Daniel
"Additionally, how can one address the discrepancy where the REST call works within the testing tool of OutSystems but fails when invoked in Server Actions or Service Actions?"
Set the "Logging level" to "Full" for the selected integration. This will enables logging of the complete request and response. You can then download the "HTTP Trace" for detailed insights, helping you identify and correct any errors related to the data being sent, which might not have been apparent within Service Studio.
When this error occurs, it simply generates a Response with a 400 Bad Request, indicating that the parameter is not recognized. The solution I needed to create was to concatenate the URLPath with the list of UrlParameters from the Request variable in the OnBeforeRequest event. It's as if the pattern doesn't assemble correctly when the API in question uses the GET protocol with parameters in the URL.
Late to the party, but I wanted to add that the only instances that I've encountered that cause problems is when:
In all other cases, i.e. with normal, unique parameter names, I've never seen any problems.
@Kilian Hekhuis How do you solve the issue with '&' in your inputparameter? When you put this sing in the inputparameter, it just rejects the entire inputparameter from the url, while I'm doing it intentional to create dynamic URL.
Note: It does work when you 'Test' the api, but not at runtime.
@Yannick Mussche : You can use the URLEncode function from the HTTPRequestHandler extension to encode your data. For example, passing "A & B" to URLEncode will return A+%26+B, which should work as expected in your request.
By the way, I recommend creating a new post, as this one is over a year old.