$30
CS 6314.001/002– Assignment 4
Implement a simple RESTful web service using PHP.
Your web service will provide information about books.
http://localhost/books will give list of books that are stored in your database.
http://localhost/books/id will give all book details for given book id.
Results will be in JSON format.
This is very similar to PW7 except that you also need to implement:
http://localhost/books/id
id will be Book ISBN and if you give ISBN number at the end of URL, index.php will return one single object that corresponds to the book with given ISBN.
Solution hint:
The configuration changes you have made for PW7 is sufficient and you will not make any other changes on apache configuration file.
Instead, you will check given URL (use $_SERVER['REQUEST_URI'] to get the URL) parse it and see if it includes a number at the end. If it includes a number, return one single object, otherwise return an array of all book objects (same output as PW7).
You will use same database you have created for PW7.
Deliverables:
Zip index.php file and screenshot of the results (for books and books/id) into yournetid-HW4.zip and submit through eLearning.
Important reminder: Make sure your database name (PW7), table name and attribute names are same as given names in PW7. You also make sure to use default hostname, username and password for database connection. (host: localhost, username: root, password: root). If your database connection parameters are different from the default, change them before submitting your work. Otherwise you will lose points for not complying with the standards of the assignment.