Question: Develop a REST server script named measurement_server.py. This script will respond to requests for data from the measurement database by sending back data that is

Develop a REST server script named measurement_server.py. This script will respond to requests for data from the measurement database by sending back data that is JSON serialized. The server should listen on any interface at a particular port number.

Here are the paths and the requests that they correspond to

Path

Function

/area

Get a list of all areas

/area/(\d+)/location

Get all locations for the given area id

/location/(\d+)/measurement

Get all the measurements for the given location id

/area/(\d+)/category

Get all the categories to which the given area belongs

/area/(\d+)/average_measurement

Get the average measurement for the given area

/area/(\d+)/number_locations

Get the number of locations in the given area

Notes:

In the first four request types, return a list of dictionaries, JSON encoded

In the last two request types, return the numbers. JSON encoded

You may wish to follow the organization used in the sakila_rest example in class.

Overview

This assignment will use the measurements example database as a subject. You will be providing data from this database as a service using REST.

The measurements example is described in the Measurements Example.pdf. But, please note! Use the file measures.sqlite rather than recreate the file yourself.

http://jmp.sh/b/ipsFTjUm1dGV4h5ClxFF

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!