首页 > > 详细

讲解 XJCO3011 Web Services and Web Data 2024辅导 Python编程

XJCO3011 Web Services and Web Data

Resit Coursework, July - August 2024

Submission Deadline: 9 August 2024 at 10:00

Using the DJANGO framework, design and implement a RESTful web API for an online retailer. The retailer maintains the following information about each of the products in stock:

· A Universal Product Code (UPC), e.g. ‘5000159471206’

· The product name, e.g. ‘Shaver’.

· The brand name, e.g. ‘McShaver’.

· The unit price, e.g. £44.90

· The quantity in stock, e.g. 20.

Customers can use a client application to order things from this retailer. This involves the following three steps:

1. Getting a list of all available products from the retailer website.

2. Adding products and the required quantity of each to a shopping basket. For simplicity, shopping basket data is maintained and managed on the client side (i.e. the server does not maintain shopping basket information).

3. Ordering all the products in the shopping basket in one go.

For simplicity, you don’t have to consider payment procedures, i.e. customers don’t have to pay for the products they order (a free shop, cool isn’t it). Also, no logging in or authentication is required for any of the services. Finally, customers don’t need to provide their details (such as name or address) to order the products in the shopping basket.

A. Using the DJANGO framework, implement a database and a RESTful API for the following two services:  (20 marks)

i. Obtaining a list of all available products.

ii. Ordering products.

Then, using the admin site (which will be automatically created by the DJNAGO framework), populate the database with information about a minimum of 5 hypothetical products of your choice).

B. Using Python 3 and the Requests library (https://pypi.org/project/requests/), write a simple client application that allows a user to: (20 marks)

i. Display a list of all available products.

ii. Add a product to the shopping basket (remember that the shopping basket is maintained locally on the client side).

iii. List the products currently in the shopping basket.

iv. Order the products in the shopping basket.

C. Write a short report (maximum 5 pages) containing the following:

i. A description of the database.

ii. Details of the API implementation for each of the two requests, including the HTTP verb, the URL, the request payload, the response codes, and the response payload.

iii. Clear instructions on how to run and use the client, and how to access the admin site (please share a username and password of the admin site so that I can use it to check the database).

The report itself does not have any marks assigned to it but the clarity of your report will affect the marks you are awarded for the relevant aspects of the mark scheme.

Bundle your Django project code, the code, and the report into a single directory. Compress the directory with Zip and upload to Minerva.

 


联系我们
  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-21:00
  • 微信:codinghelp
热点标签

联系我们 - QQ: 99515681 微信:codinghelp
程序辅导网!