Boolean URL language of request-parameter

I am creating a REST API that can handle a dynamic set of filters (send as queryparams). In some cases, the client wants to have a filter combination applicable to a list of collections. It can be nested and combined with AND / OR.

I wonder if there is any standard or open language definition for these operators that is specialized for use as URL request parameters.

+3


source to share


2 answers


Looking at Google I decided to do it like this:

By default, multiple query patterns are logical ANDs together. Any associated values ​​are considered OR. eg.



GET / users? filter = field1: value1, value2, value2 & filter = fieldFoo = bar

+2


source


Below is the easiest way to do it.

GET / users? parameter1 = value1 & parameter2 = value2 & parameter3 = value3



Easy to understand and easy to use.

-1


source







All Articles