Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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 :)

like image 525
Marius Schmidt Avatar asked Feb 19 '15 23:02

Marius Schmidt


1 Answers

OData 4 (http://www.odata.org/) has a very complete query syntax and supports the E-R data model with navigation, filtering, expressions, etc. The MSFT Azure AD Graph API is based on OData. The only downside is that the complete spec is pretty deep. There are a few open source implementations, Apache Olingo (http://olingo.apache.org/) being one with support for Java clients and servers. There are others as well.

like image 162
Gil Avatar answered Nov 04 '22 21:11

Gil