REST API QUERY WITH LIKE OPERATOR AND a percent sign (%)

1
0
-1

Hi all,

I'm trying to do a query using the like operator with % ( a percent sign (%) that matches any sequence of zero or more characters ), example SELECT * FROM clients WHERE country = 'France' AND city LIKE '% a%'

In queries.properties I've tried:
GetClientsByLike = SELECT * FROM client WHERE country =: country AND city LIKE%: city% but did not work,
also tried ... LIKE :city and pass % sign via parameter, but also did not work.

thanks
Paulo

1 answer

1
0
-1

I found the solution with using URL Encode at form (at parameter).
Example:
quey SELECT * FROM client WHERE country LIKE :country

at form, in the input field with variable country, I put, %25a%25

it´s works, and return:

[{"first_name":"William","last_name":"Jobs","city":"Grenoble","country":"France"},{"first_name":"Walter","last_name":"Bates","city":"Paris","country":"France"},{"first_name":"Daniela","last_name":"Angelo","city":"Rio de Janeiro","country":"Brazil"}]

Notifications