You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1.7 KiB
1.7 KiB
RX_API_Call
Objective
Create a very basic API using tools and languages of your choice. The API will have a single endpoint/method with a single function.
API Input
- User Location - The API will receive a latitude and longitude value which describes the current location of a user.
API Output
- The API will return a simple response packet with the name and address of the pharmacy chosen by the application.
- The distance between: the input latitude/longitude and the location of the pharmacy.
Business Requirements
- The API will receive a latitude/longitude, using the provided list in pharmacies.csv the API will calculate the closest pharmacy to the input latitude/longitude.
- The API will return the closest pharmacy (with name and address) in a consumable response packet.
- The API will include the distance (in miles) between the input latitude/longitude and the selected closest pharmacy in the response packet.
Database is a SQLite
Table Schema
create table pharmacies
(
Pharmacy TEXT not null,
Address TEXT,
City TEXT,
State TEXT,
Zip TEXT,
Latitude REAL not null,
Longitude REAL not null
);
Call: https://rhays.us/Examples/RX_API_Call/RX.php?K=RLH1234&Latitude=39.1030&Longitude=-95.3222
This is a basic lookup system to find the closest pharmacy to a given Lat/Lon
My assumptions:
- No clear request for distance, options are drive distance or straight line distance, I chose: straight line distance.
- No request trap errors, I added a few, validation, key check, request check, and a basic DB check.
- Output was requested as a packet but not the type, so I just passed the requested data back as text and not JSON.