Question: 6 ) Your REST API will provide responses to the following GET requests: Request: Response: / states / All state data returned / states /

6) Your REST API will provide responses to the following GET requests:
Request: Response:
/states/ All state data returned
/states/?contig=true All state data for contiguous states (Not AK or HI)
/states/?contig=false All state data for non-contiguous states (AK, HI)
/states/:state All data for the state URL parameter
/states/:state/funfact A random fun fact for the state URL parameter
/states/:state/capital {state: stateName, capital: capitalName }
/states/:state/nickname {state: stateName, nickname: nickname }
/states/:state/population {state: stateName, population: population }
/states/:state/admission {state: stateName, admitted: admissionDate }
NOTES on GET routes:
1) If you have a catch all for routes that do not exist in your server, you will not need to check if
URL parameters exist. If they are entered wrong, the response will be a 404.
2) The :state URL parameter above represents state codes like KS, NE, TX, NY, etc. Entering in
full state names should result in a 404.
3) Check the example application to verify the exact responses expected.
4) Also check the example application for expected messages when required parameters are not
received or no fun facts are found for a requested state.
5) Notice contig above is a query parameter where :state is a URL parameter.
6)All state data means all state data from statesData.json merged with the fun facts stored in
MongoDB.

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 Programming Questions!