2017 © Pedro Peláez
 

library cmip-rest

Collection-Modifiers-ID-Property REST framework

image

earthit/cmip-rest

Collection-Modifiers-ID-Property REST framework

  • Monday, February 26, 2018
  • by TOGoS
  • Repository
  • 13 Watchers
  • 2 Stars
  • 10,653 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 2 Open issues
  • 100 Versions
  • 3 % Grown

The README.md

Build Status, (*1)

CMIP REST

Handles CMIP-style (see below) REST requests using a schema definition., (*2)

What the heck is CMIP

A convention for REST services., (*3)

URLs are of the form /<collection>[;<modifiers>][/<identifier>[/<property>]], hence 'CMIP'., (*4)

It also supports some other styles, mapping them to the same underlying operations., (*5)

There are five basic operations: search, get, post, put, patch, delete., (*6)

  • GET /<collection>[;<modifiers>][?<filter>] returns a list of objects in the collection. The exact subset returned is determined by the <filter> (see 'collection filters'), and the way each object is represented is determined by <modifiers> (see 'record modifiers').
  • GET /<collection>[;<modifiers>]/<id> returns a single object of the collection identified by id.
  • POST /<collection> add new records to the collection. The new records are provided as a JSON-encoded list in the request. If items POSTed include primary keys, they may conflict with existing items, in which case those items are updated as if a PATCH was done on those items.
  • PUT /<collection>/<id> replaces a record with the data given as JSON in the request content. Fields without values provided are reset to their defaults.
  • PATCH /<collection>/<id> updates a record with data given as JSON in the request content. Fields not explicitly mentioned retain their old value.
  • DELETE /<collection>/<id> deletes a record.
  • DELETE /<collection>?<filters> deletes records matching a filter.

Record modifiers

Modifiers indicate how to structure the resulting objects. The with modifier is a comma-separated list indicating what related objects should be returned with each record. A path like /authors;with=books would indicate to return a list of books with each author record, whereas a path like /books;with=author,publisher would indicate to return a single author and publisher with each book record. The set of related objects that may be requested is defined by the service, and services may provide alternate modifiers, possibly as aliases for long with= lists., (*7)

Additional levels of nesting may be requested by using a dot to separate path components. e.g. /authors;with=books.publisher.postalAddress to get a list of authors, each of which contains a list of all their books, each of which contains a 'publisher' record with a 'postalAddress' sub-record. The resulting JSON might look something like:, (*8)

[ { "id": 154, "name": "Some Author", "books": [ { "id": 301, "title": "A Book Containing Words", "publisher": { "id": 4, "name": "Some Book Publishing Company", "postalAddress": { "streetAddress1": "450 Some Street", "localityName": "Someville", "regionCode": "SC", "postalCode": "12345" "countryCode": "USA", } } }, ...more book records maybe go here... ] }, ...more author records maybe go here... ], (*9)

Collection filters

Except for a few reserved parameters, query parameters to a collection GET request correspond to fields of the items in the collection., (*10)

The reserved parameters are:, (*11)

  • orderBy=[+-]<fieldName>... - indicate sort order of results
  • limit=[<skip>,]<count> - indicate how many rows of the result set to skip and include

Field-matching parameter values may be in one of the following formats:, (*12)

  • <pattern> - match a pattern where * stands for any substring. Only valid if the pattern does not contain a colon. May be optimized as an exact match if the given pattern doesn't contain any asterisks.
  • eq:<value> - match a value exactly
  • like:<pattern> - match a string based on a pattern, where * stands for any substring
  • lt:<value> - matches values less than that given
  • gt:<value> - matches values greater than that given
  • in:<list> - matches any value that is mentioned in the comma-separated list
  • is:null - matches nulls
  • not:<expression> - negate a filter, e.g. not:is:null or not:like:*foo*

Search parameters will be automatically parsed as appropriate given the field that they are matching on (e.g. if there is a field, someNumericField that is typed as containing a number, a seach for someNumericField=eq:5 is interpreted as equals the number 5, not the string "5"), (*13)

Collection-Table mapping

When translating a database record to its REST form, all primary key values are combined into a single id, with multiple fields separated by dashes., (*14)

When interpreting an ID given in a URL or in JSON, it must be converted to its component fields. Even if there really is only a single ID field int the database record, the ID data from JSON or the URL must be converted to the correct type., (*15)

Field names may be translated between naming conventions when loading and storing. The naming convention for tables and columns in Postgres seems to be to use squishedtogetherlowercase., (*16)

In the view exposed by the REST services:, (*17)

  • collection name is dash-separated (e.g. patient-stays)
  • field names, both in the URL (modifiers and search parameters) and in request/response JSON data, are camelCase (e.g. patientAdmissionDate)

It is a goal of this project to make it simple to override these conventions and to allow special cases for different views of things. e.g. a class may be exposed as super-duper-car-washes, but the backing table actually be called x_okaycarwash., (*18)

TODO: Add example of using this library in PHP., (*19)

The Versions

26/02 2018
04/01 2018
14/04 2017
13/03 2017
26/01 2017
03/01 2017
30/12 2016
01/12 2016
12/11 2016
09/11 2016
01/11 2016
01/11 2016
01/11 2016
27/10 2016
04/10 2016
28/09 2016
23/09 2016
30/06 2016
29/06 2016
28/06 2016
21/06 2016
15/06 2016
01/06 2016
01/06 2016
31/05 2016
31/05 2016
24/05 2016
23/05 2016
27/04 2016
24/03 2016
17/03 2016
09/03 2016
18/02 2016
11/02 2016
10/02 2016
10/02 2016
07/02 2016
05/02 2016
04/02 2016
04/02 2016
04/02 2016
29/01 2016
29/01 2016
29/01 2016
28/01 2016
27/01 2016
21/01 2016

dev-jao-empty-array

dev-jao-empty-array

Collection-Modifiers-ID-Property REST framework

  Sources   Download

MIT

The Requires

 

The Development Requires

21/12 2015

0.6.23

0.6.23.0

Collection-Modifiers-ID-Property REST framework

  Sources   Download

MIT

The Requires

 

The Development Requires

21/12 2015

0.7.2

0.7.2.0

Collection-Modifiers-ID-Property REST framework

  Sources   Download

MIT

The Requires

 

The Development Requires

17/12 2015

0.7.1

0.7.1.0

Collection-Modifiers-ID-Property REST framework

  Sources   Download

MIT

The Requires

 

The Development Requires

29/10 2015

0.7.0

0.7.0.0

Collection-Modifiers-ID-Property REST framework

  Sources   Download

MIT

The Requires

 

The Development Requires

21/10 2015

0.6.22

0.6.22.0

Collection-Modifiers-ID-Property REST framework

  Sources   Download

MIT

The Requires

 

The Development Requires

07/10 2015

0.6.21

0.6.21.0

Collection-Modifiers-ID-Property REST framework

  Sources   Download

MIT

The Requires

 

The Development Requires

26/08 2015

0.6.20

0.6.20.0

Collection-Modifiers-ID-Property REST framework

  Sources   Download

MIT

The Requires

 

The Development Requires

29/07 2015

0.6.19

0.6.19.0

Collection-Modifiers-ID-Property REST framework

  Sources   Download

MIT

The Requires

 

The Development Requires

15/07 2015

0.6.18

0.6.18.0

Collection-Modifiers-ID-Property REST framework

  Sources   Download

MIT

The Requires

 

The Development Requires

02/07 2015

0.6.17

0.6.17.0

Collection-Modifiers-ID-Property REST framework

  Sources   Download

MIT

The Requires

 

The Development Requires

26/06 2015

0.6.16

0.6.16.0

Collection-Modifiers-ID-Property REST framework

  Sources   Download

MIT

The Requires

 

The Development Requires

22/06 2015

0.6.15

0.6.15.0

Collection-Modifiers-ID-Property REST framework

  Sources   Download

MIT

The Requires

 

The Development Requires

19/06 2015

0.6.14

0.6.14.0

Collection-Modifiers-ID-Property REST framework

  Sources   Download

MIT

The Requires

 

The Development Requires

16/06 2015

0.6.13

0.6.13.0

Collection-Modifiers-ID-Property REST framework

  Sources   Download

MIT

The Requires

 

The Development Requires

16/06 2015

0.6.12

0.6.12.0

Collection-Modifiers-ID-Property REST framework

  Sources   Download

MIT

The Requires

 

The Development Requires

12/06 2015

0.6.11

0.6.11.0

Collection-Modifiers-ID-Property REST framework

  Sources   Download

MIT

The Requires

 

The Development Requires

12/06 2015

0.6.10

0.6.10.0

Collection-Modifiers-ID-Property REST framework

  Sources   Download

MIT

The Requires

 

The Development Requires

12/06 2015

0.6.9

0.6.9.0

Collection-Modifiers-ID-Property REST framework

  Sources   Download

MIT

The Requires

 

The Development Requires

20/05 2015

0.6.8

0.6.8.0

Collection-Modifiers-ID-Property REST framework

  Sources   Download

MIT

The Requires

 

The Development Requires

20/05 2015

0.6.7

0.6.7.0

Collection-Modifiers-ID-Property REST framework

  Sources   Download

MIT

The Requires

 

The Development Requires

19/05 2015

0.6.6

0.6.6.0

Collection-Modifiers-ID-Property REST framework

  Sources   Download

MIT

The Requires

 

The Development Requires

18/05 2015

0.6.5

0.6.5.0

Collection-Modifiers-ID-Property REST framework

  Sources   Download

MIT

The Requires

 

The Development Requires

18/05 2015

0.6.4

0.6.4.0

Collection-Modifiers-ID-Property REST framework

  Sources   Download

MIT

The Requires

 

The Development Requires

12/05 2015

0.6.3

0.6.3.0

Collection-Modifiers-ID-Property REST framework

  Sources   Download

MIT

The Requires

 

The Development Requires

12/05 2015

0.6.2

0.6.2.0

Collection-Modifiers-ID-Property REST framework

  Sources   Download

MIT

The Requires

 

The Development Requires

12/05 2015

0.6.1

0.6.1.0

Collection-Modifiers-ID-Property REST framework

  Sources   Download

MIT

The Requires

 

The Development Requires

09/05 2015

0.6.0

0.6.0.0

Collection-Modifiers-ID-Property REST framework

  Sources   Download

MIT

The Requires

 

The Development Requires

09/05 2015

0.5.0

0.5.0.0

Collection-Modifiers-ID-Property REST framework

  Sources   Download

MIT

The Requires

 

The Development Requires

08/05 2015

0.4.0

0.4.0.0

Collection-Modifiers-ID-Property REST framework

  Sources   Download

MIT

The Requires

 

The Development Requires

08/05 2015

0.3.3

0.3.3.0

Collection-Modifiers-ID-Property REST framework

  Sources   Download

MIT

The Requires

 

The Development Requires

06/05 2015

0.3.2

0.3.2.0

Collection-Modifiers-ID-Property REST framework

  Sources   Download

MIT

The Requires

 

The Development Requires

06/05 2015

0.3.1

0.3.1.0

Collection-Modifiers-ID-Property REST framework

  Sources   Download

MIT

The Requires

 

The Development Requires

06/05 2015

0.3.0

0.3.0.0

Collection-Modifiers-ID-Property REST framework

  Sources   Download

MIT

The Requires

 

The Development Requires

05/05 2015

0.2.0

0.2.0.0

Collection-Modifiers-ID-Property REST framework

  Sources   Download

MIT

The Requires

 

The Development Requires

01/05 2015

0.1.5

0.1.5.0

Collection-Modifiers-ID-Property REST framework

  Sources   Download

MIT

The Requires

 

The Development Requires

30/04 2015

0.1.4

0.1.4.0

Collection-Modifiers-ID-Property REST framework

  Sources   Download

MIT

The Requires

 

The Development Requires

30/04 2015

0.1.3

0.1.3.0

Collection-Modifiers-ID-Property REST framework

  Sources   Download

MIT

The Requires

 

The Development Requires

29/04 2015

0.1.2

0.1.2.0

Collection-Modifiers-ID-Property REST framework

  Sources   Download

MIT

The Requires

 

The Development Requires

29/04 2015

0.1.1

0.1.1.0

Collection-Modifiers-ID-Property REST framework

  Sources   Download

MIT

The Requires

 

The Development Requires

29/04 2015

0.1.0

0.1.0.0

Collection-Modifiers-ID-Property REST framework

  Sources   Download

MIT

The Requires

 

The Development Requires

28/04 2015

0.0.103

0.0.103.0

Collection-Modifiers-ID-Property REST framework

  Sources   Download

MIT

The Requires

 

The Development Requires

27/03 2015

0.0.102

0.0.102.0

Collection-Modifiers-ID-Property REST framework

  Sources   Download

MIT

The Requires

 

The Development Requires

07/02 2015

0.0.101

0.0.101.0

Collection-Modifiers-ID-Property REST framework

  Sources   Download

MIT

The Requires

 

The Development Requires

07/02 2015

0.0.100

0.0.100.0

Collection-Modifiers-ID-Property REST framework

  Sources   Download

MIT

The Requires

 

The Development Requires

07/02 2015

0.0.94

0.0.94.0

Collection-Modifiers-ID-Property REST framework

  Sources   Download

MIT

The Requires

 

The Development Requires

30/01 2015

0.0.93

0.0.93.0

Collection-Modifiers-ID-Property REST framework

  Sources   Download

MIT

The Requires

 

The Development Requires

27/01 2015

0.0.92

0.0.92.0

Collection-Modifiers-ID-Property REST framework

  Sources   Download

MIT

The Requires

 

The Development Requires

27/01 2015

0.0.91

0.0.91.0

Collection-Modifiers-ID-Property REST framework

  Sources   Download

MIT

The Requires

 

The Development Requires

23/01 2015

0.0.90

0.0.90.0

Collection-Modifiers-ID-Property REST framework

  Sources   Download

MIT

The Requires

 

The Development Requires

09/12 2014

0.0.84

0.0.84.0

Collection-Modifiers-ID-Property REST framework

  Sources   Download

MIT

The Requires

 

The Development Requires

14/11 2014

0.0.83

0.0.83.0

Collection-Modifiers-ID-Property REST framework

  Sources   Download

MIT

The Requires

 

The Development Requires

07/11 2014

0.0.82

0.0.82.0

Collection-Modifiers-ID-Property REST framework

  Sources   Download

MIT

The Requires

 

The Development Requires

07/11 2014

0.0.81

0.0.81.0

Collection-Modifiers-ID-Property REST framework

  Sources   Download

MIT

The Requires

 

The Development Requires