In this assignment you will plan out a REST URL structure an
In this assignment you will plan out a REST URL structure and describe how one would interact with it. The thing you will be modeling is a library. The resources in the library will be books, customers and authors. These things will be represent by JSON. The following are examples of a book, customer and author.
Book
Library Customer
Author
These represent a representation of a book, customer and author. It includes all the information that needs to be modeled in your API. The following should be possible to filter by in your API:
Books by author
Books by genre
Books by status of checked in/checked out
Books checked out by a specific individual
Authors by genre (if they have written at least one book in that genre they should be in the collection of authors associated with that genre)
All books
All customers
All authors
The following actions should be possible:
Add a book, customer or author.
Check in a book from a customer.
Check out a book to a customer.
Delete a book, customer or author.
Update the attributes of a book, customer or author.
You should provide the URL/HTTP Verb combination along with placeholders to be replaced with the data needed for the request. For example, in the GitHub (Links to an external site.) documentation they use the notation :attribute to signify that :attribute needs to be replaced with an actual value. So if that is needed in the URL, use that notation. With each URL include a short description of its function.
Additionally if you need to send a request body (like in a POST request) note which attributes are required and which are optional.
For each action listed above also provide at least one sample request that has the placeholders replaced with realistic values and the request body filled in with realistic attributes.
This is all abstract, no working code implementation is expected this week. All that you will be turning in is a document with the description of the URLs and the hypothetical examples. The GitHub documentation has several examples of this.
You should turn in a single PDF that has all of the above content.
You will be graded based on the extent to which you implement the URLs and HTTP verbs in a RESTful way.
As an example the following would be how I might describe listing all aquariums that had a particular kind of fish in it in it in the class example.
GET /fish/:fishkind/aquariums
Returns a collection of all aquariums containing :fishkind.
GET /fish/guppy/aquariums
This would return all aquariums that contained a guppy.
Previous
Solution
GET /fish/:fishkind/aquariums
Returns a collection of all aquariums containing :fishkind.
GET /fish/guppy/aquariums
This would return all aquariums that contained a guppy.
The below URI\'s could be planned.
For the BOOKS JSON:
GET /book/ - Returns all information with regard to books.
GET /book/:id - Return book with specific ID.
Here ID can be replaced with required ID.
POST /book/:book_name - This will add a new book entry and assign a unique ID.
The body of POST request should contain:
{ \"id\":\"100\",
\"title\": \"Magic Faraway Tree\",
\"ISBN\":\"0345391802\",
\"genre\":[\"sci-fi\", \"humor\"],
\"variety\":\"paperback\",
\"author\":\"Edwin\"
}
For Library Customer
GET /library/ - Returns all the data with regard to library.
GET /library/:id - Return info with regard to specific ID.
POST /library/subscriber - Add a new subscriber to the Library and assign a unique ID.
The request body for POST request should contain:
{ \"name\": \"Arthur Dent\",
\"address\": .............,
\"contactNum\": ...........,
}
For Author
GET /author/ - Returns all the author\'s info.
GET /author/:id - Returns specific author.
POST /author/name - Add the a new Author and assign a unique ID.
The body of the request should contain:
{ \"id\":\"50\",
\"name\": \"Douglas Adams\",
\"publications\":[\"The Hitchhiker\'s Guide to the Galaxy\", \"Dirk Gently\'s Holistic Detective Agency\"]
}

