Search code examples
apirestfilteringantlr4querydsl

Is there any REST API query standard / DSL to express complex filters in GET URL?


I am currently researching for an elegant way, for my REST API under development, to express filters for GET requests returning collections. I'd like to express queries as "http://[...]?filter=expressions", where I am going to evaluate the expressions part. I have a feeling, that a flexible approach would trigger the need for a simple Query DSL? The closest to a good formal specification I found so far is

http://www.juniper.net/techpubs/en_US/junos-space-sdk/13.1/apiref/com.juniper.junos_space.sdk.help/html/reference/Commonbehav.html#step8

I was wondering, if ANTLR is the tool to look at? But since this should be such a common necessity, I was wondering, if there is some REST API query standard DSL something available?

A bit confused greetings and thx for your input :)


Solution

  • I just stumbled upon QueryDSL which provides fluent builders for queries on a number of backend technologies.

    I am not sure I like the idea of mapping the fluent builders directly to the query parameters but this approach is discussed in two blog posts referenced by the QueryDSL site.