简体   繁体   中英

Like parameter in REST api url endpoint

Is it possible to pass parameters with 'like' keyword in REST api endpoints. Basically I'm trying to create an endpoint wherein I would query a db to get list of items based on '%name%'. The corresponding query in DB would be like:

SELECT * FROM users WHERE user_id like "%arjun%"

So I would need to add parameters to my REST endpoint wherein i can fetch teh data based on name=%arjun% Is that really possible?

Thanks Arjun

I would recommend to user name=value and then create your sql with %%. You can put % into your GET call but it can cause bugs because % is special character which is used to encode other special characters.

But if you really want to go with name=%value% then you can put %25 instead of %. So something like this name=%25value%25

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM