treflehq / trefle-api

🍀 Trefle is a botanical JSON REST API for plants species, allowing you to search and query over all the registered species, and build the next gardening apps and farming robots.
https://trefle.io
GNU Affero General Public License v3.0
501 stars 51 forks source link

Add a `search` like filter #39

Open lambda2 opened 4 years ago

lambda2 commented 4 years ago

From the discord channel (#help):

When retrieving plants in a given distribution, I'm trying to use the filter functionality on the common_name field, but it appears that this has to be an exact name in order for it to return results. Is it possible to make this return values based upon a 'like' operator? So, if for example I used the word 'tulip' at the end, it would return plants where the common_name contained words 'like' tulip. Is that possible?

/api/v1/distributions/{zone_id}/plants?token={token}&filter[common_name]=tulip

I'm just trying to return plants on a given search name based upon a selected distribution but I couldn't make it work in the way I wanted/hoped.