Permalink
Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
1052 lines (861 sloc) 30 KB

GET /Joinbox/RESTful/Style/Guide

This styleguide describes how RESTful services should be designed @joinbox. All services should make use of the same custom and standard headers, status codes and request methods so that all services can interact without any custom code.

Most of the functionality will be handled by the ee framework.

Contents

  1. Naming
  2. URLs
  3. Headers
    1. Request Headers
      1. Accept
      2. Accept-Language
      3. Content-Language
      4. Range
      5. Content-Type
      6. Select
      7. Filter
      8. Order
      9. API-Version
    2. Response Headers
      1. Content-Type
      2. Content-Range / Accept-Range
      3. Content-Language
      4. Location
  4. Methods on Collections
    1. GET
    2. POST
  5. Methods on Resources
    1. GET
    2. DELETE
    3. PUT
    4. PATCH
  6. OPTIONS Method
  7. Filters
    1. Numbers
    2. Strings
    3. Booleans
    4. Date
  8. LICENCE

Naming

  • Collection: A collection is a collection of resources like users, events or venues
  • Resource: A resource is a single item of a collection, like one event or one user
  • Request Method: A HTTP request method: GET, POST, DELETE, OPTIONS, HEAD, PUT, PATCH
  • Headers: Stadard HTTP request / response headers
  • Body: HTTP request / response body
  • Status: HTTP response status code like 200, 400 or 500

[⬆]

URLs

Every entity is a collection and can be accessed through an URL. The URL consits of a descriptive name of the entity. You should always use the singular form for a collection name.

Bad

  • /Users
  • /EventboosterUsers

Good

  • /user

Resources must be made available throught an URL consisting of the collection, a slash and a unique resource identifier.

Bad

  • /Users/byId/1
  • /User1

Good

  • /user/1
  • /user/michael%40joinbox.com

A resource may have as many subresources / subcollections as required, the URL for the subresource must follow the same rules as the collection / resource it depends on. Since subresources are basically mappings they can be made available as subresource or a separate resource or as both.

Bad

  • /user/1/usercomments/3

Good

  • /user/1/comment
  • /user/1/comment/34

[⬆]

Headers

Request Haders

The following list of headers should automatically be generated by the application framework you are using on both side of the connection:

  • Content-Length: actual payload length
  • Connection: keep alive / close
  • Accept-Encoding: compression

[⬆]

Accept

The content type that can be accepted, will be «Application/JSON» most of the time. If the server cannot satisfy the request he will respond with the 406 - Not Acceptable status.

GET /user HTTP/1.1
Accept: Application/JSON

[⬆]

Accept-Language

The requested content language. Most of the time this will be one of en, de, fr, it. If the server cannot satisfy the request he will respond with the 406 - Not Acceptable status.

Since all language specific data is stored in mapping tables between the entity and the language entity it is not required to submit the header. You can instead use the «Select» and «Filter» header for selecting the language data. If you use the «Accept-Language» header the service will return the resource in that specific language with the locale data included into the entity. If you use the «Select» header without the «Filter» header the service will return all locale records. Without the «Accept-Language» header the locale data will be returned, if selected, like all mappings inside an array.

GET /user HTTP/1.1
Accept-Language: de, fr;q=0.9, en;q=0.8

[⬆]

Content-Language

Used for POST / PATCH & PUT request. Specifies the language in which the content is delivered in.

GET /user HTTP/1.1
Content-Language: de

[⬆]

Range

0 based range index, supported by most collections. Only available if the options request did return the «Accept-Ranges: resources» header If the server cannot satisfy the request he will respond with the 416 - Requested Range Not Satisfiable status.

GET /user HTTP/1.1
Range: 0-10

Example: 10 entries on page:

  • page1: range: 0-10
  • page2: range: 10-20

[⬆]

Content-Type

The content type of the payload on requests with body ( POST, PATCH, PUT ). Will most of the time be «Multipart/Form-Data»

POST /user HTTP/1.1
Content-Type: Multipart/Form-Data

[⬆]

Select

Custom headers for selecting data from resources / sub resources. The headers content must be delivered as comma separated list. Fields of sub entities may be selected using the «.» ( dot ). If the server cannot satisfy the request he will respond with the 460 - Select Not Satisfiable status.

GET /user HTTP/1.1
Select: id, name, tenant.id, tenant.name, friend.name, friend.id

[⬆]

Filter

Custom header used for filtering collections. The filters consist of a comma separated list of keys and values. String values in the value part of the key-value pairs must be url encoded. This must not include the function name or operator. Strings must be enclosed in quotation marks. If the server cannot satisfy the request he will respond with the 461 - Filter Not Satisfiable status.

GET /user HTTP/1.1
Filter: id=in(3,4), firstName=like('mich%25'), (startdate>2014-08-15|(startdate<2014-08-15,enddate>2014-08-15))

[⬆]

Order

Custom header for defining the order in which the results must be returned. The complete collection is ordered before a range from it is returned in the requested order. If the server cannot satisfy the request he will respond with the 462 - Ordering Not Satisfiable status.

GET /user HTTP/1.1
Order: name, friends.name DESC

[⬆]

API-Version

The API version to use to respond to requests If the server cannot satisfy the request he will respond with the 463 - Unsupported API Version status.

GET /user HTTP/1.1
API-Version: 0.0.1

[⬆]

Response Headers

Content-Type

The Content Type of the response, will almost always be «Application/JSON».

HTTP/1.1 200 OK
Content-Type: Application/JSON

[⬆]

Range

Zero based resource range index. Describes the offset and length of the resources returned to the client. If the client did not specify a range the starting page of the range will be returned.

The range & accept-range header must be sent in response to all GET & HEAD requests on a collection. If the server cannot satisfy the request he will respond with the 416 - Requested Range Not Satisfiable status.

HTTP/1.1 200 OK
Accept-Ranges: resources
Content-Range: 0-9/5604

[⬆]

Content-Language

If the request contained an «Accept-Language» header the resource(s) will be returned using the selected language an the «Content-Language» header will be set.

HTTP/1.1 200 OK
Content-Language: en

[⬆]

Location

If a new resource was created, the Location-Response-Header locates the new created resource

HTTP/1.1 200 OK
Location: /user/1

[⬆]

Methods available on collections

The following methods may be made available on collections

  • OPTIONS
  • GET
  • HEAD
  • POST
  • DELETE

[⬆]

GET

The GET method is used to get an optional filtered, paged set of resources.

Mandatory Request Headers

  • Accept
  • API-Version

Optional Request Headers

  • Accept-Language
  • Range
  • Select
  • Order
  • Filter

Mandatory Response Headers

  • Accept-Ranges
  • Content-Range
  • Content-Length
  • Date

Optional Response Headers

  • Content-Language

Status Codes

  • 200 OK
  • 301 Moved Permanently: the resource was permanently moved to another location
  • 302 Found: The resource was moved temporarily
  • 304 Not Modified: In response to a «If-Not-Modified» headers
  • 400 Bad Request: Syntax error in request, don't try the same request again!
  • 401 Unauthorized: Authentication required, see the «WWW-Authenticate» header
  • 403 Forbidden: Access is forbidden for the current user
  • 404 Not Found
  • 405 Method Not Allowed: The request method is not supported on that resource
  • 406 Not Acceptable: The requested content type could not be accepted. Try another content type
  • 410 Gone: the resource is gone and will not be availabel again ( deleted resource )
  • 416 Requested Range Not Satisfiable
  • 429 Too Many Requests: you hit the request rate limit
  • 431 Request Header Fields Too Large: The server is unwilling to process the request because either an individual header field, or all the header fields collectively, are too large
  • 460 Select Not Satisfiable: The select statment could not be satisified, one or more of the slected fields do not exist
  • 461 Filter Not Satisfiable: The filter statment could not be satisified, one or more of the filtered fields does not exist or a filter method does not exist
  • 462 Ordering Not Satisfiable: The select statment could not be satisified, one or more of the slected fields do not exist
  • 463 Unsupported API Version: The API Version requested is not supported by the server
  • 500 Internal Server Error

Example

The example request does the following

  • return the users property «id», the related tenants properties «id» and «name» and the related friends properties «id» and «name»
  • filter the user by id ( in 3, 4 ) and name ( like micha% ), see filters
  • limit the result count to 10, starting at offset 0
  • return the data in german

Request Headers

GET /user HTTP/1.1
Host: somehost:12001
Accept: Application/JSON
Accept-Language: de, fr;q=0.9, en;q=0.8
Range: 0-9
Select: id, tenant.id, tenant.name, friends.id, friends.name
Order: name DESC, firends.name DESC
Filter: id=in(3,4), firstName=like('mich%25')
API-Version: 0.0.1

Response Headers

HTTP/1.1 200 OK
Content-Type: Application/JSON
Date: Fri, 15 Nov 2013 12:12:14 GMT
Content-Language: de
Accept-Ranges: 0-9
Content-Range 0-2

Response Body

[
	{
		  id: 4
		, name: "michael"
		, tenant: {
			  id: 1
			, name: "default tenant"
			, _rel: {
				  _self: 		"/tenant/1"
				, _collection: 	"/tenant"
				, _mapping: 	"/user/4/tenant/1"
			}
		}
		, friend: [
			{
				  id: 5 
				, name: "pereg"
				, _rel: {
					  _self: 		"/user/5"
					, _collection: 	"/user"
					, _mapping: 		"/user/4/friend/5"
				}
			}
			, {
				  id: 4
				, name: "fabian"
				, _rel: {
					  _self: 		"/user/4"
					, _collection: 	"/user"
					, _mapping: 		"/user/4/friend/4"
				}
			}
		]
		, _rel: {
			  _self: 		"/user/4"
			, _collection: 	"/user"
			, friend: 		"/user/4/friend"
			, tenant: 		"/user/4/tenant"
			, city: 		"/user/4/city"
		}
	}
	, {
		  id: 3
		, name: "micha"
		, tenant: {
			  id: 4
			, name: "events.ch"
			, _rel: {
				  _self: 		"/tenant/4"
				, _collection: 	"/tenant"
				, _mapping: 	"/user/3/tenant/4"
			}
		}
		, friends: []
		, _rel: {
			  _self: 		"/user/3"
			, _collection: 	"/user"
			, friend: 		"/user/3/friend"
			, tenant: 		"/user/3/tenant"
			, city: 		"/user/3/city"
		}
	}
]

[⬆]

POST

Adds a new item to the collection automatically creating an id for the new resource. The created resource will be returned.

Mandatory Request Headers

  • Accept
  • Content-Language
  • API-Version
  • Content-Type

Optional Request Headers

  • Select

Mandatory Response Headers

  • Content-Language
  • Content-Length
  • Date
  • Location

Status Codes

  • 200 OK
  • 201 Created
  • 400 Bad Request: Syntax error in request, don't try the same request again!
  • 401 Unauthorized: Authentication required, see the «WWW-Authenticate» header
  • 403 Forbidden: Access is forbidden for the current user
  • 404 Not Found
  • 405 Method Not Allowed: The request method is not supported on that resource
  • 406 Not Acceptable: The requested content type could not be accepted. Try another content type
  • 410 Gone: the resource is gone and will not be availabel again ( deleted resource )
  • 411 Length Required: The request did not specify the length of its content, which is required by the requested resource.
  • 413 Request Entity Too Large: The request is larger than the server is willing or able to process
  • 415 Usupported Media Type: The request entity has a media type which the server or resource does not support
  • 429 Too Many Requests: you hit the request rate limit
  • 431 Request Header Fields Too Large: The server is unwilling to process the request because either an individual header field, or all the header fields collectively, are too large
  • 460 Select Not Satisfiable: The select statment could not be satisified, one or more of the slected fields do not exist
  • 463 Unsupported API Version: The API Version requested is not supported by the server
  • 500 Internal Server Error

Example

The example request does the following

  • insert a new item in the colelction «user» with a new automatically created id
  • return the resource with the sub resources according to the «Select» header

Request Headers

POST /user HTTP/1.1
Host: somehost:12001
Accept: Application/JSON
Content-Type: Multipart/Form-Data
Content-Language: en
Select: id, tenant.id, tenant.name, friends.id, friends.name
API-Version: 0.0.1

Response Headers

HTTP/1.1 201 OK
Content-Type: Application/JSON
Date: Fri, 15 Nov 2013 12:12:14 GMT
Content-Language: en
Location: /user/7

Response Body

{
	  id: 7
	, name: "tobias"
	, tenant: {
		  id: 4
		, name: "events.ch"
		, _rel: {
			  _self: 		"/tenant/4"
			, _collection: 	"/tenant"
			, _mapping: 	"/user/7/tenant/4"
		}
	}
	, friends: []
	, _rel: {
		  _self: 		"/user/7"
		, _collection: 	"/user"
		, friend: 		"/user/7/friend"
		, tenant: 		"/user/7/tenant"
		, city: 		"/user/7/city"
	}
}

[⬆]

Methods available on resources

The following methods may be made available on resources

  • GET
  • HEAD
  • PUT
  • PATCH
  • DELETE

[⬆]

GET

Mandatory Request Headers

  • Accept
  • API-Version

Optional Request Headers

  • Accept-Language
  • Select

Mandatory Response Headers

  • Content-Length
  • Date

Optional Response Headers

  • Content-Language

Status Codes

  • 200 OK
  • 301 Moved Permanently: the resource was permanently moved to another location
  • 302 Found: The resource was moved temporarily
  • 304 Not Modified: In response to a «If-Not-Modified» headers
  • 400 Bad Request: Syntax error in request, don't try the same request again!
  • 401 Unauthorized: Authentication required, see the «WWW-Authenticate» header
  • 403 Forbidden: Access is forbidden for the current user
  • 404 Not Found
  • 405 Method Not Allowed: The request method is not supported on that resource
  • 406 Not Acceptable: The requested content type could not be accepted. Try another content type
  • 410 Gone: the resource is gone and will not be availabel again ( deleted resource )
  • 429 Too Many Requests: you hit the request rate limit
  • 431 Request Header Fields Too Large: The server is unwilling to process the request because either an individual header field, or all the header fields collectively, are too large
  • 460 Select Not Satisfiable: The select statment could not be satisified, one or more of the slected fields do not exist
  • 463 Unsupported API Version: The API Version requested is not supported by the server
  • 500 Internal Server Error

Example The example request will do the following:

  • return the users property «id», the related tenants properties «id» and «name» and the related friends properties «id» and «name»
  • return the data in all languages

Request Headers

GET /user HTTP/1.1
Host: somehost:12001
Accept: Application/JSON
Select: id, tenant.id, tenant.name, friends.id, friends.name, city.zip, city.name
API-Version: 0.0.1

Response Headers

HTTP/1.1 200 OK
Content-Type: Application/JSON
Date: Fri, 15 Nov 2013 12:12:14 GMT

Response Body

{
	  id: 3
	, name: "micha"
	, city: {
		  zip: 3011
		, name: [
			{ 
			  	  language: "de"
			  	, name: "Bern" 
			  	, _rel: {
					  _self: 		"/language/48"
					, _collection: 	"/language"
					, _mapping: 	"/city/3847/language/2"
				}
			}
			, { 
			  	  language: "en"
			  	, name: "Bern" 
			  	, _rel: {
					  _self: 		"/language/48"
					, _collection: 	"/language"
					, _mapping: 	"/city/3847/language/1"
				}
			}
			, { 
			  	  language: "it"
			  	, name: "Berna" 
			  	, _rel: {
					  _self: 		"/language/48"
					, _collection: 	"/language"
					, _mapping: 	"/city/3847/language/4"
				}
			}
			, { 
			  	  language: "fr"
			  	, name: "Berne" 
			  	, _rel: {
					  _self: 		"/language/48"
					, _collection: 	"/language"
					, _mapping: 	"/city/3847/language/3"
				}
			}
		]
		, _rel: {
			  _self: 		"/city/48"
			, _collection: 	"/city"
			, _mapping: 	"/user/3/city/48"
		}
	}
	, tenant: {
		  id: 4
		, name: "events.ch"
		, _rel: {
			  _self: 		"/tenant/4"
			, _collection: 	"/tenant"
			, _mapping: 	"/user/3/tenant/4"
		}
	}
	, friends: []
	, _rel: {
		  _self: 		"/user/3"
		, _collection: 	"/user"
		, friend: 		"/user/3/friend"
		, tenant: 		"/user/3/tenant"
		, city: 		"/user/3/city"
	}
}

[⬆]

DELETE

Mandatory Request Headers

  • API-Version
  • Accept
  • Select

Optional Request Headers

  • Content-Language

Mandatory Response Headers

  • Content-Length
  • Date

Optional Response Headers

  • Content-Language

Status Codes

  • 200 OK
  • 400 Bad Request: Syntax error in request, don't try the same request again!
  • 401 Unauthorized: Authentication required, see the «WWW-Authenticate» header
  • 403 Forbidden: Access is forbidden for the current user
  • 404 Not Found
  • 405 Method Not Allowed: The request method is not supported on that resource
  • 406 Not Acceptable: The requested content type could not be accepted. Try another content type
  • 410 Gone: the resource is gone and will not be availabel again ( deleted resource )
  • 429 Too Many Requests: you hit the request rate limit
  • 431 Request Header Fields Too Large: The server is unwilling to process the request because either an individual header field, or all the header fields collectively, are too large
  • 463 Unsupported API Version: The API Version requested is not supported by the server
  • 500 Internal Server Error

Example

Deletes an user, returns the deleted user

Request Headers

DELETE /user HTTP/1.1
Host: somehost:12001
Accept: Application/JSON
Select: id, name
API-Version: 0.0.1

Response Headers

HTTP/1.1 200 OK
Content-Type: Application/JSON
Date: Fri, 15 Nov 2013 12:12:14 GMT

Response Body

{
	  id: 3
	, name: "micha"
	, _rel: {
		  _self: 		"/user/3"
		, _collection: 	"/user"
		, friend: 		"/user/3/friend"
		, tenant: 		"/user/3/tenant"
		, city: 		"/user/3/city"
	}
}

[⬆]

PUT

Adds a new item to the collection or overwrites an existing one. The created resource will be returned.

Mandatory Request Headers

  • Accept
  • Content-Language
  • API-Version
  • Content-Type

Optional Request Headers

  • Select

Mandatory Response Headers

  • Content-Language
  • Content-Length
  • Date
  • Location

Status Codes

  • 200 OK
  • 400 Bad Request: Syntax error in request, don't try the same request again!
  • 401 Unauthorized: Authentication required, see the «WWW-Authenticate» header
  • 403 Forbidden: Access is forbidden for the current user
  • 404 Not Found
  • 405 Method Not Allowed: The request method is not supported on that resource
  • 406 Not Acceptable: The requested content type could not be accepted. Try another content type
  • 410 Gone: the resource is gone and will not be availabel again ( deleted resource )
  • 411 Length Required: The request did not specify the length of its content, which is required by the requested resource.
  • 413 Request Entity Too Large: The request is larger than the server is willing or able to process
  • 415 Usupported Media Type: The request entity has a media type which the server or resource does not support
  • 429 Too Many Requests: you hit the request rate limit
  • 431 Request Header Fields Too Large: The server is unwilling to process the request because either an individual header field, or all the header fields collectively, are too large
  • 460 Select Not Satisfiable: The select statment could not be satisified, one or more of the slected fields do not exist
  • 463 Unsupported API Version: The API Version requested is not supported by the server
  • 500 Internal Server Error

Example

The example request does the following

  • insert a new item in the collection «user». Overwriting an existing resource if there is one with the same id
  • return the resource with the sub resources according to the «Select» header

Request Headers

PUT /user/7 HTTP/1.1
Host: somehost:12001
Accept: Application/JSON
Content-Type: Multipart/Form-Data
Content-Language: en
Select: id, tenant.id, tenant.name, friends.id, friends.name
API-Version: 0.0.1

Response Headers

HTTP/1.1 201 OK
Content-Type: Application/JSON
Date: Fri, 15 Nov 2013 12:12:14 GMT
Content-Language: en
Location: /user/7

Response Body

{
	  id: 7
	, name: "tobias"
	, tenant: {
		  id: 4
		, name: "events.ch"
		, _rel: {
			  _self: 		"/tenant/4"
			, _collection: 	"/tenant"
			, _mapping: 	"/user/7/tenant/4"
		}
	}
	, friends: []
	, _rel: {
		  _self: 		"/user/7"
		, _collection: 	"/user"
		, friend: 		"/user/7/friend"
		, tenant: 		"/user/7/tenant"
		, city: 		"/user/7/city"
	}
}

[⬆]

PATCH

Updates an existing item.

Mandatory Request Headers

  • Accept
  • Content-Language
  • API-Version
  • Content-Type

Optional Request Headers

  • Select

Mandatory Response Headers

  • Content-Language
  • Content-Length
  • Date
  • Location

Status Codes

  • 200 OK
  • 400 Bad Request: Syntax error in request, don't try the same request again!
  • 401 Unauthorized: Authentication required, see the «WWW-Authenticate» header
  • 403 Forbidden: Access is forbidden for the current user
  • 404 Not Found
  • 405 Method Not Allowed: The request method is not supported on that resource
  • 406 Not Acceptable: The requested content type could not be accepted. Try another content type
  • 411 Length Required: The request did not specify the length of its content, which is required by the requested resource.
  • 413 Request Entity Too Large: The request is larger than the server is willing or able to process
  • 415 Usupported Media Type: The request entity has a media type which the server or resource does not support
  • 416 Requested Range Not Satisfiable
  • 429 Too Many Requests: you hit the request rate limit
  • 431 Request Header Fields Too Large: The server is unwilling to process the request because either an individual header field, or all the header fields collectively, are too large
  • 460 Select Not Satisfiable: The select statment could not be satisified, one or more of the slected fields do not exist
  • 461 Filter Not Satisfiable: The filter statment could not be satisified, one or more of the filtered fields does not exist or a filter method does not exist
  • 462 Ordering Not Satisfiable: The select statment could not be satisified, one or more of the slected fields do not exist
  • 463 Unsupported API Version: The API Version requested is not supported by the server
  • 500 Internal Server Error

Example

The example request does the following

  • updates an existing resource.
  • return the resource with the sub resources according to the «Select» header

Request Headers

PATCH /user/7 HTTP/1.1
Host: somehost:12001
Accept: Application/JSON
Content-Type: Multipart/Form-Data
Content-Language: en
Select: id, tenant.id, tenant.name, friends.id, friends.name
API-Version: 0.0.1

Response Headers

HTTP/1.1 201 OK
Content-Type: Application/JSON
Date: Fri, 15 Nov 2013 12:12:14 GMT
Content-Language: en
Location: /user/7

Response Body

{
	  id: 7
	, name: "tobias"
	, tenant: {
		  id: 4
		, name: "events.ch"
		, _rel: {
			  _self: 		"/tenant/4"
			, _collection: 	"/tenant"
			, _mapping: 	"/user/7/tenant/4"
		}
	}
	, friends: []
	, _rel: {
		  _self: 		"/user/7"
		, _collection: 	"/user"
		, friend: 		"/user/7/friend"
		, tenant: 		"/user/7/tenant"
		, city: 		"/user/7/city"
	}
}

[⬆]

The OPTIONS Method

The options request returns information about methods and headers that can be used on the given collection / resource.

Status Codes

  • 200 OK
  • 301 Moved Permanently: the resource was permanently moved to another location
  • 302 Found: The resource was moved temporarily
  • 400 Bad Request: Syntax error in request, don't try the same request again!
  • 401 Unauthorized: Authentication required, see the «WWW-Authenticate» header
  • 403 Forbidden: Access is forbidden for the current user
  • 404 Not Found
  • 405 Method Not Allowed: The request method is not supported on that resource
  • 406 Not Acceptable: The requested content type could not be accepted. Try another content type
  • 410 Gone: the resource is gone and will not be availabel again ( deleted resource )
  • 429 Too Many Requests: you hit the request rate limit
  • 463 Unsupported API Version: The API Version requested is not supported by the server
  • 500 Internal Server Error

Request Headers

OPTIONS /user HTTP/1.1
Host: somehost:12001
Accept: Application/JSON

Response Headers

HTTP/1.1 200 OK
Content-Type: Application/JSON
Date: Fri, 15 Nov 2013 12:12:14 GMT
Allow: OPTIONS,GET,POST
Accept-Ranges: resources
Accept-Select: *, tenant.*, friends.*
Accept-Order: *
Accept-Filter: id, tenant.id

Response Body

The data in the response body describes the collection / resource and the subresources of the collection / resource

{
	  allow: ['OPTIONS','GET','POST']
	, resource: {
		id: { 
		  	  primary: 	true
		  	, type: 	'int'
		  	, filters: 	'numbers'
		}
		, tenant: {
			id: { 
			  	  primary: 	true
			  	, type: 	'int'
			  	, filters: 	'numbers'
			}
			, name: {
				  unique: 	true
			  	, type: 	'string'
			  	, filters: 	'strings'
			}
		}
	}
	, filters: {
		  numbers: ['<', '>', '=', '!=', '>=', '<=', 'notNull', 'null', 'in']
		, strings: ['=', '!=', 'like', 'notNull', 'null', 'in']
	}
}

[⬆]

Filters

The filter described below may be supported by any collection. You may combine as many filters as you like. If you filter one property with mutliple filters the filters will be evaluated using the logical «and» oberator. If you want to use multiple filters using the «or» operator you must define them in multiple «Filter» headers.

[⬆]

Numbers

Filter: id=1
Filter: id!=1
Filter: id>=1
Filter: id<=1
Filter: id>1
Filter: id<1
Filter: id=in(1,2,3,4)
Filter: id=null
Filter: id=notNull

[⬆]

Strings

Filter: name=fabian
Filter: name!=felix
Filter: name=in('fabian, 'michael')
Filter: name=like('fabi*')
Filter: name=null
Filter: name=notNull

[⬆]

Booleans

Filter: deleted=false
Filter: deleted=true
Filter: deleted=null
Filter: name=notNull

[⬆]

Date

Date properties may be filtered using the following format: «YYYY-MM-DD HH:MM:SS». The time is always bound to the resource location. If the resource i snot bound to a location the timezone of the server is used ( see date header ). You may omit any part of the date beginning at the right, so «YYYY-MM-YY» is interpreted as «YYYY-MM-YY 00:00:00» and «YYYY» is interpreted as «YYYY-01-01 00:00:00».

Filter: created=2013-11-18 
Filter: created!=2013-11-18
Filter: created>=2013-11-18 20:00:02
Filter: created<=2013-11-18
Filter: created>2013-11-18
Filter: created<2013-11-18
Filter: created=in(2013,2014)
Filter: created=null
Filter: created=notNull

LICENCE

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE..