Answered step by step
Verified Expert Solution
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 ie
all properties are required:
REST API Web Service
You must implement a REST API that supports CRUD operations by implementing the following 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 properties listed in the data model.
The date property will be in the format MMDDYY eg
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 contenttype of the response must be applicationjson
The status code must be
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 contenttype of the response must be applicationjson
The status code must be
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 contenttype of the response must be
The status code must be
Update using PUT exercises:id
Request
The request body will be a JSON object with all the properties listed in the data model.
The date property will be in the format MMDDYY eg
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 contenttype of the response must be applicationjson
The status code must be
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
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started