I wrote a web service providing some HTTP routes, one of which is structured like so:
/grid/get-foos?filters={"type": ["bar"], "status": ["baz", "qux"]}
The filters
parameter is a serialized JSON object. There is a set of acceptable keys, and each of those keys' values should be an array, as above. I'm trying to filter get-foos
, returning only foos
which suit the criteria in filters. The above reads "give me foos with type bar AND with status baz OR qux".
Somebody on my team told me that serializing JSON this way and sticking it in the query string is non-standard. Is it? I'm new at this.
What is the most idiomatic way (or even just a good way) to structure API calls that filter a "getter" like this?
edit: should have mentioned, this is written in clojure with ring and compojure.