Consume REST API GET doesn't pass multiple parameters in URL

Mobile Dev - OS11.7.2

My mobile app consumes a REST API for retrieving birdsong recordings, for instance: https://www.xeno-canto.org/api/2/recordings?query=Turdus%20philomelos+q:A

When building this in outsystems, the second argument (q:A, for recording quality) isn't passed to the API, resulting in responses where q:no score

Interestingly, when testing in the query editor, I do get the correct response, shown below.

Yet when publishing this using "A" as hardcoded value for quality, It does not seem to filter on this parameter.

Can anyone guide me as to where the problem lies?

Hi Fred,

This behaviour is strange because if it is working in test it should work while consuming this web service action also. But usually one query string should be passed as one parameter. 

So instead of passing two parameter as query={query}+q:{quality} if you pass as simple query={query} and in query concatinate both of your parameter while calling the action like below. This way it is working I have checked it at my end.

Solution

Hi Fred,

Thanks for posting a very clear explanation of the problem.

The problem here lies in the way the URL parameters are specified, and the way the bird API's query parameter works.  Substituting within a query parameter does not appear to work well.  Unfortunately, I cannot explain why; probably something to do with URL encoding.

The quality in this API is actually a part of a single URL parameter, so instead of sending "Query" and "Quality" individually, with query={Query}+q:{Quality} you will need to produce the full query parameter and then substitute it like this query={BirdQuery}

Building the query will look like this:

The GetRecordings method will then look like this:

 

I hope this helps!

Kind regards,

Stuart

Solution

Nikhil, After I posted I noticed you beat me by 2 minutes! :)

Ha Ha. It happened to me too several times :)

Thanks both for a clear and workable solution, I have implemented it in this way and it works perfectly.