http://localhost:9003/temppath/CarTracker/1.0/cars
Notice that the Web address includes the server name, port number, base URI, and path for the GetCars operation.
The browser should display the full records of six cars. Leave the browser open.
This starts the console.
StockNumber | 0 |
make | Honda |
model | Civic |
year | 2005 |
price | 9000 |
mileage | 110000 |
color | blue |
doors | 2 |
bodyStyle | hatchback |
transmission | manual |
driveType | 2WD |
cylinders | 4 |
fuelType | gasoline |
fuelMPG | 24 |
feature number of occurrences (10 max) | 2 |
featureID | 1 |
description | cassette player |
featureID | 2 |
description | air conditioning |
The car you just added should now appear on the list, with the stockNumber assigned as 7.
This starts the console.
featureID | 0 |
description | cruise control |
stockNumber | 7 |
The car you added in the previous section should now appear on the list with the additional feature.
Here you use query parameters in the path to filter the fields in the response.
http://localhost:9003/temppath/CarTracker/1.0/cars?doors=2&fuelType=gasoline
The JSON response lists all 2-door cars that run on gasoline:
{ "car" : [ { "stockNumber" : 2, "make" : "Ford", "model" : "Mustang", "year" : 2015, "price" : 22000, "mileage" : 6000, "color" : "yellow", "doors" : 2, "bodyStyle" : "convertible", "transmission" : "manual", "driveType" : "2WD", "cylinders" : 8, "fuelType" : "gasoline", "fuelMPG" : 15, "feature" : [ { "featureID" : 1, "description" : "heated seats" }, { "featureID" : 2, "description" : "CD player" }, { "featureID" : 3, "description" : "air conditioning" }, { "featureID" : 4, "description" : "power windows" }, { "featureID" : 5, "description" : "premium sound" }, { "featureID" : 6, "description" : "mag wheels" } ] }, { "stockNumber" : 7, "make" : "Honda", "model" : "Civic", "year" : 2005, "price" : 9000, "mileage" : 110000, "color" : "blue", "doors" : 2, "bodyStyle" : "hatchback", "transmission" : "manual", "driveType" : "2WD", "cylinders" : 4, "fuelType" : "gasoline", "fuelMPG" : 24, "feature" : [ { "featureID" : 1, "description" : "cassette player" }, { "featureID" : 2, "description" : "air conditioning" }, { "featureID" : 3, "description" : "cruise control" } ] } ] }
http://localhost:9003/temppath/CarTracker/1.0/cars?doors=2&fuelType=gasoline&$fields=make,model,price,fuelType
The JSON response shows the same filtered list, but includes only the fields specified by the special $fields query parameter:
{ "car" : [ { "make" : "Ford", "model" : "Mustang", "price" : 22000, "fuelType" : "gasoline" }, { "make" : "Honda", "model" : "Civic", "price" : 9000, "fuelType" : "gasoline" } ] }
This concludes the tutorial.