Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

You will store the data in MongoDB in a collection named exercises. Each document in the collection must have the following properties ( i .

You will store the data in MongoDB in a collection named exercises. Each document in the collection must have the following properties (i.e.,
all properties are required):
REST API Web Service
You must implement a REST API that supports CRUD operations by implementing the following 5 endpoints. Note: you can assume that the
requests will have valid data.
Create using POST /exercises
Request
The request body will be a JSON object with all the 5 properties listed in the data model.
The date property will be in the format MM-DD-YY, e.g.,06-24-21.
You can assume that all the properties are valid.
The POST request will have no path parameters.
Response
A JSON object with all the properties of the document including the unique ID value generated by MongoDB.
The content-type of the response must be application/json .
The status code must be 201.
Read all using GET /exercises
Request
No request body and no path parameters.
Response
A JSON array containing the entire collection.
Each document in the collection must be a JSON object with all the properties of the document including the ID.
The content-type of the response must be application/json .
The status code must be 200.
Read one using GET /exercises/:id
Request
The path parameter will contain the ID of the document. You can assume that a document exists with this ID.
The GET request will not have a body.
Response
A JSON object containing the document with the ID provided as the path parameter.
This JSON object must have all the properties of the document including the ID.
The content-type of the response must be
The status code must be 200.
Update using PUT /exercises/:id
Request
The request body will be a JSON object with all the 5 properties listed in the data model.
The date property will be in the format MM-DD-YY, e.g.,
You can assume that all the properties are valid.
The path parameter will contain the ID of a document. You can assume that a document exists with this ID.
Response
A JSON object with all the properties of the updated document including the ID.
The content-type of the response must be application/json .
The status code must be 200.
Delete using DELETE /exercises/:id
Request
The path parameter will contain the ID of the document. You can assume that a document exists with this ID.
The DELETE request will not have a body.
Response
The status code must be 204.
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Formal SQL Tuning For Oracle Databases Practical Efficiency Efficient Practice

Authors: Leonid Nossov ,Hanno Ernst ,Victor Chupis

1st Edition

3662570564, 978-3662570562

More Books

Students also viewed these Databases questions

Question

SQL Injection and Broken Access Control

Answered: 1 week ago