Simple example of API that allows to store some interesting places with their map coordinates and description.
With this API you can:
- Add Point info (name, description, coordinates, city)
- Edit Point info
- Get nearest Points by desired radius and IP address
- Get Points located in desired city
- In project folder execute
docker-compose up -d
- Enter container with
docker exec -ti points bash
- Execute
composer install
- Rename
.env.example
file into.env
- Execute
./artisan migrate --force
to run database migrations - In
.env
file write yourIP_STACK_KEY
andAPI_TOKEN
- Check api status by address
http://localhost:8080/api/v1/health?api_token=123
To run unit tests execute vendor/bin/phpunit tests/unit
inside points
container.
To run only functional tests execute vendor/bin/phpunit tests/functional
.
To run all tests execute vendor/bin/phpunit
.
All requests must contain api_token
parameter with API_TOKEN
environment variable value.
Example: GET /api/v1/health?api_token=123
Get health status of the service.
URL: GET /api/v1/health
Endpoints for viewing and manipulating points.
- Add Point:
POST /api/v1/points
- Update Point:
PUT /api/v1/points/:pk
- Show points by desired ip and radius:
GET /api/v1/points/inrad
- Show points in desired city:
GET /api/v1/points/in/:city