Quantcast
Channel: Active questions tagged rest - Stack Overflow
Viewing all articles
Browse latest Browse all 4066

REST API filter operator best practice

$
0
0

I am building a REST API that uses a filter parameter to control search results. E.g., one could search for a user by calling:

GET /users/?filter=name%3Dfoo

Now, my API should allow many different filter operators. Numeric operators such as equals, greater than, less than, string operators like contains, begins with or ends with and date operators such as year of or timediff. Moreover, AND and OR combinations should be possible.Basically, I want to support a subset of the underlying MySQL database operators.

I found a lot of different implementations (two good examples are Google Analytics and LongJump) that seem to use custom syntax.Looking at my requirements, I would probably design a custom syntax pretty similar to the MySQL operator syntax.

However, I was wondering if there are any best practices established that I should follow and whether I should consider anything else.


Viewing all articles
Browse latest Browse all 4066

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>