REST Service input string misformating

REST Service input string misformating

  





Hello,

I have a question regarding inputs on rest services.

When I send a string to the input of a rest service, as part of the request url

ex.: localhost:9200/_search{querystring}

querystring="?sort=account_number:desc"

I always get a misformat when creating the endpoint

like this:
_search%3Fsort%3Daccount_number%3Adesc

should be:
_search?sort=account_number:desc

how can I solve this?


Thank you.



Solution

Hi Henrique,

What do you mean bu "send[ing] a string to the input of a rest service"? Are you consuming the REST service from OutSystems? 

Assuming you are, the format of query parameters is given in the REST Method pop-up:

You are trying to send the complete query string as parameter, but that doesn't work. You need to specify only the variable part. So in your case the URL should be "_search?sort={sortstring}", and have an Input Parameter sortstring with the "Send In" Property set to "URL". As for the ":" being converted to %3A, this is correct: all characters not allowed in a URL are converted this way, and should be converted back by the receiver (in case of consuming a REST API in OutSystems, this is done automatically).

Solution