This REST API provides a search and navigation system for information related to countries and locations in Brazil. In addition, it also provides the functionality of calculating the distance between two locations by their geographic points.
The project is also hosted on Heroku, click here to access it.
Click here to access the complete documentation made with swagger.
Records added to the database can be found here.
-
This API has three instances:
/countries
/states
/cities
-
/{instance}
Returns all records. -
/{instance}/{id}
Returns a record, if exists, by its id. -
/{instance}/search/{name}
Search and returns all records that match the typed entry. -
/cities/search/{stateUf}
Search and returns all cities belonging to the current state -
By default, queries related to "search" and "find all" return up to 20 records found.
-
To page forward:
/{instance}?page={pageNumber}
-
To change the total of returned records:
/{instance}?size={totalRecords}
-
-
To perform an ordered query, choose an attribute of the current instance that you want to use as a parameter.
/{instance}?sort={attribute}
-
-
By Points:
cities/distance?by=points&from={city1Id}&to={city2Id}
-
By Cube:
cities/distance?by=cube&from={city1Id}&to={city2Id}
-