Lab 7 - Part 1

Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

Algonquin College, School of Advanced Technology

CST8259 Web Programming Language II

Lab 7 – Part 1

Objective
Create a Restful Web API with PHP

Due Date
See Brightspace posting for the due date of this lab. To earn 5 points, you are required:

1. Complete the lab as required.

2. Submit your lab work to the Brightspace before the due date.

3. Demo your lab work during the following week’s lab sessions.

Requirements
1. Create a new folder WebServices inside AMPPS’ www folder. Add a .htaccess file
to define the necessary URL rewrite rules to forward restaurant view Web API’s
URLs to their corresponding URL to RestaurantReview.php.

2. Develop an PHP project CST8259Lab7Part1 to provide the following Restful


Service API:

 Get All Restaurant Reviews – Accept a HTTP GET request without review’s ID,
return a json string of a list of Restaurant objects containing the restaurant
review data in your restaurant_review.xml file.

 Get Restaurant Review by Id – Accept a HTTP GET request with a review’s ID,
returns a json string of a Restaurant objects containing the restaurant review data.

 Get Restaurant Names – Accept a HTTP GET request for all names of the
restaurants in the restaurant_review.xml file, returns an array of restaurant names.

 Update a Restaurant Review – Accept a HTTP PUT request for updating a


restaurant review in the restaurant_review.xml file. The HTTP request body
contains Restaurant object of the updated restaurant review data in the form of
json string.

 Save a Restaurant Review – Response to a HTTP POST request for saving a


new restaurant review to the restaurant_review.xml file. The HTTP request body
contains Restaurant object of the new restaurant review data in the form of json

CST8259 Web Programming Language II Page 1


Algonquin College, School of Advanced Technology

string. For simplicity, the new restaurant review write to the xml file will only
contain the data in the RestaurantInfo object,

 Delete a Restaurant Review – Accept a HTTP DELETE request with a


restaurant review’s id to delete the restaurant review in the restaurant_review.xml
indexed by the given id.

3. User Postman, or any Restful Web API Test client of your choice, to test Post, Put,
and Delete methods of RestaurantServiceAPI.

CST8259 Web Programming Language II Page 2

You might also like