How to Execute a REST API Call on Apache Spark the Right Way
This simple REST based web service is designed for use with the example code in the article on medium.com. The data is sourced from the US Government at https://vpic.nhtsa.dot.gov/api/vehicles/getallmakes?format=json
The web service can be accessed via the following URL:
https://tools.rulenumberfour. co.uk/api/vehicles/[page]
E.g. https://tools.rulenumberfour. co.uk/api/vehicles/1
The web service accepts a single parameter via the URL itself and that is the page number itself. It will return a maximum of 100 records per page along-with a HTTP Status Code of 200 on success.
On error, (i.e. invalid page number) a status code of 405 will be returned.
Schema
- page is the requested page number
- maxRecords is the total number of results in the dataset. I.e. maxResults/100 = total pages