Requirement 1
hassanjamal opened this issue · comments
Hassan Jamal commented
When the endpoint:
GET http://localhost:8080/vehicles/<MODEL YEAR>/<MANUFACTURER>/<MODEL>
is requested, your PHP application should query the NHTSA API and use the data received to respond with precisely the following JSON if there are results:
Count: <NUMBER OF RESULTS>,
Results: [
{
Description: "<VEHICLE DESCRIPTION>",
VehicleId: <VEHICLE ID>
},
{
Description: "<VEHICLE DESCRIPTION>",
VehicleId: <VEHICLE ID>
},
{
Description: "<VEHICLE DESCRIPTION>",
VehicleId: <VEHICLE ID>
},
{
Description: "<VEHICLE DESCRIPTION>",
VehicleId: <VEHICLE ID>
}
] }
or precisely this JSON if NHTSA's API returns no results:
{
Count: 0,
Results: []
}
Where:
<MODEL YEAR>
,<MANUFACTURER>
and<MODEL>
are variables that
are used when calling the NHTSA API. Example values for these are:<MODEL YEAR>
: 2015<MANUFACTURER>
: Audi<MODEL>
: A3
<NUMBER OF RESULTS>
is the number of records returned from the
NHTSA API and is an integer<VEHICLE DESCRIPTION>
is the name of the vehicle model returned
from the NHTSA API and is a string
In order to get the data to generate your application's response, you
will need to call the following NHTSA API endpoint:
GET https://one.nhtsa.gov/webapi/api/SafetyRatings/modelyear/<MODEL
YEAR>/make/>MANUFACTURER>/model/<MODEL>?format=json