Here is a SQLite database for a music store. Here is a layout of the tables.
Your job is to build a REST API which allows basic CRUD operations (Create [POST], Read [GET], Update [PUT], Destroy [DELETE]) on this database. Pretend that you are part of a web development team building an internal site for employees to look things up. You should expect JSON-in and JSON-out. (Use Cloud9, or your own host, and make sure Matthew and I have access to run the code.)
GET /customer
should return an array of JSON objects having CustomerId, FirstName, LastName, and Email.GET /customer/:CustomerId
should return a JSON object with all of the information about a customerGET /customer/:CustomerId/invoice
should return an array of JSON objects having InvoiceId, InvoiceDate, and TotalGET /customer/:CustomerId/invoice/:InvoiceId
should return a JSON object having all information about that invoice plus the key InvoiceLines
with value an array of JSON objects having TrackId, (track) Name, (album) Title, (artist) Name, (genre) Name, UnitPrice, and QuantityPOST /customer/
should take in data about a new Customer, create the customer, and return the same as GET /customer/:CustomerId
, most importantly the new CustomerIdPUT /customer/:CustomerId
should update a customer using the given dataDELETE /customer/:CustomerId
should delete the customerGET /playlist
should return an array of JSON objects with PlaylistId
and (playlist)Name
.GET /playlist/:PlaylistId
should return an array of JSON objects, each with information about the appropriate tracks from that playlist (you can pick, but enough for a web-app running from this data to show interesting things about each track).GET /revenue
should return an array of JSON objects each providing the revenue of the store in a given monthGET /revenue[/:year[/:month[/:day]]]
should return a single JSON object giving the revenue for the requested period