Library Information System: REST Web Service

Resources

This table provides a list of all the resources exposed by this REST web service:

ResourceMethodsDescription
Session GET This resource returns a unique session id that needs to get passed to the other requests
Author GET This resource contains information on authors in the library catalog
Book GET , POST , PUT , DELETE This resource contains information on books in the library catalog
Book Image POST

Accessing Services

To access these REST web services, you need to use the following base URL:

http://libraryinformationsystem.org/Services/RestService.svc/

You can specify the format of data that will be returned (XML or JSON) by passing the following HTTP Headers:

To authenticate with the web service there are two methods:

Finally if you need to call one of the GET methods from a web page in another domain you need to use the special JSONP (JSON with Padding) syntax. This tells the web service to return the data in the form of a JavaScript <script> tag so that it be can be called across web site domains safely. To request the data in JSONP format, just add the following extra querystring parameter:

                    ?callback=[name of callback function]
                

Session

URI Method Description
session GET Returns the unique session id that is used to prevent different user's requests getting mixed up

Author

URI Method Description
author/{id}?session_id={session_id} GET Retrieves a single author by its id
author?session_id={session_id} GET Retrieves the list of users in the system for the current user's session

Book

URI Method Description
book/{id}?session_id={session_id} GET Retrieves a single book by its id
book/{id}?session_id={session_id} PUT Updates an existing book in the system
book/{id}?session_id={session_id} DELETE Deletes an existing book in the system
book/search?session_id={session_id} POST Retrieves a list of books by a date range
book?session_id={session_id} GET Retrieves a list of books in the system
book?session_id={session_id} POST Adds a new book to the system

Book Image

URI Method Description
book/{id}/image POST Uploads a file and returns the byte count