Data


REST API

A starting template for handling simple object data and associations.

GET /{type}?(order,direction,count,offset,custom)

Retrieve a list from the server. The objects will be of type type and limited by the optional filter property. Filters include:

order
The field by which to order the results.
direction
The direction by which to order the results, either ASC or DSC.
count
The number of objects to return.
offset
The offset from which to return objects, used for paginating large data sets.
(custom)
Filter results by a custom field.
Example: retrieving all books
GET /book
Example: retrieving books by Dan Brown ordered by rating
GET /book?author=Dan Brown&order=rating&direction=DSC

POST /{type}

Stores an object as a given type.

Example: create a book
POST /book

POST /{type}/{id}

Update an object with a given type and id.

Example: update book with id of 7
POST /book/7

DELETE /{type}/{id}

DELETE an object with a given type and id.

Example: delete book with id of 7
DELETE /book/7

GET /{type}/{id}/{associated}

Get all objects of type associated that are associated with object type type and id id

Example: get all reviews associated with book 7
GET /book/7/review

POST /{type}/{id}/{associated}

Create an object of type associated and associate it with object type type and id id

Example: create a review for book 7
POST /book/7/review

Angular Service

A simple AngularJS service to abstract Data.

http://data.nicholasstephan.com/angular-data.js

data.load({type}, {filter})

Load array of data of type `type` matching `filter`.

data.save({type}, {data})

Save `data` of type `type`.

data.remove({type}, {id})

Remove data of type `type` with id of `id`.