hassanjamal/modus-nhtsa-api

Requirement 3

Closed this issue · 0 comments

When the endpoint:

GET http://localhost:8080/vehicles/<MODEL
YEAR>/<MANUFACTURER>/<MODEL>?withRating=true

is requested, your PHP application shoud make multiple queries to the
NHTSA API and return the same JSON specified in Requirements 1 and 2,
but with an additional field for each car model. The new field is
CrashRating and it will be a string field whose possible values are:

  • "Not Rated"
  • "0"
  • "1"
  • "2"
  • "3"
  • "4"
  • "5"
    So your example response JSON from this endpoint should look precisely
    like this:
{
    Count: <NUMBER OF RESULTS>,
    Results: [
       {
        CrashRating: "<CRASH RATING>"
        Description: "<VEHICLE DESCRIPTION>",
        VehicleId: <VEHICLE ID>
       },...
   ]
} 

As with the previous Requirements 1 and 2, you will need to make this
NHTSA API call to get some of the data required:

GET https://one.nhtsa.gov/webapi/api/SafetyRatings/modelyear/<MODEL
YEAR>/make/>MANUFACTURER>/model/<MODEL>?format=json

For Requirement 3, you will need to use the value of VehicleId that
the NHTSA API returns to make a further API call to obtain the crash
rating data.