dawarich/swagger/v1/swagger.yaml

617 lines
17 KiB
YAML

---
openapi: 3.0.1
info:
title: API V1
version: v1
paths:
"/api/v1/areas":
post:
summary: Creates an area
tags:
- Areas
parameters:
- name: api_key
in: query
required: true
description: API Key
schema:
type: string
responses:
'201':
description: area created
'422':
description: invalid request
requestBody:
content:
application/json:
schema:
type: object
properties:
name:
type: string
latitude:
type: number
longitude:
type: number
radius:
type: number
required:
- name
- latitude
- longitude
- radius
examples:
'0':
summary: Creates an area
value:
name: Home
latitude: 40.7128
longitude: -74.006
radius: 100
get:
summary: Retrieves all areas
tags:
- Areas
parameters:
- name: api_key
in: query
required: true
description: API Key
schema:
type: string
responses:
'200':
description: areas found
content:
application/json:
schema:
type: array
items:
type: object
properties:
id:
type: integer
name:
type: string
latitude:
type: number
longitude:
type: number
radius:
type: number
required:
- id
- name
- latitude
- longitude
- radius
"/api/v1/areas/{id}":
delete:
summary: Deletes an area
tags:
- Areas
parameters:
- name: api_key
in: query
required: true
description: API Key
schema:
type: string
- name: id
in: path
required: true
description: Area ID
schema:
type: string
responses:
'200':
description: area deleted
"/api/v1/health":
get:
summary: Retrieves application status
tags:
- Health
responses:
'200':
description: Healthy
"/api/v1/overland/batches":
post:
summary: Creates a batch of points
tags:
- Batches
parameters:
- name: api_key
in: query
required: true
description: API Key
schema:
type: string
responses:
'201':
description: Batch of points created
'401':
description: Unauthorized
requestBody:
content:
application/json:
schema:
type: object
properties:
type:
type: string
geometry:
type: object
properties:
type:
type: string
coordinates:
type: array
properties:
type: object
properties:
timestamp:
type: string
altitude:
type: number
speed:
type: number
horizontal_accuracy:
type: number
vertical_accuracy:
type: number
motion:
type: array
pauses:
type: boolean
activity:
type: string
desired_accuracy:
type: number
deferred:
type: number
significant_change:
type: string
locations_in_payload:
type: number
device_id:
type: string
wifi:
type: string
battery_state:
type: string
battery_level:
type: number
required:
- geometry
- properties
examples:
'0':
summary: Creates a batch of points
value:
locations:
- type: Feature
geometry:
type: Point
coordinates:
- 13.356718
- 52.502397
properties:
timestamp: '2021-06-01T12:00:00Z'
altitude: 0
speed: 0
horizontal_accuracy: 0
vertical_accuracy: 0
motion: []
pauses: false
activity: unknown
desired_accuracy: 0
deferred: 0
significant_change: unknown
locations_in_payload: 1
device_id: Swagger
wifi: unknown
battery_state: unknown
battery_level: 0
"/api/v1/owntracks/points":
post:
summary: Creates a point
tags:
- Points
parameters:
- name: api_key
in: query
required: true
description: API Key
schema:
type: string
responses:
'200':
description: Point created
'401':
description: Unauthorized
requestBody:
content:
application/json:
schema:
type: object
properties:
batt:
type: number
lon:
type: number
acc:
type: number
bs:
type: number
inrids:
type: array
BSSID:
type: string
SSID:
type: string
vac:
type: number
inregions:
type: array
lat:
type: number
topic:
type: string
t:
type: string
conn:
type: string
m:
type: number
tst:
type: number
alt:
type: number
_type:
type: string
tid:
type: string
_http:
type: boolean
ghash:
type: string
isorcv:
type: string
isotst:
type: string
disptst:
type: string
required:
- owntracks/jane
examples:
'0':
summary: Creates a point
value:
batt: 85
lon: -74.006
acc: 8
bs: 2
inrids:
- 5f1d1b
BSSID: b0:f2:8:45:94:33
SSID: Home Wifi
vac: 3
inregions:
- home
lat: 40.7128
topic: owntracks/jane/iPhone 12 Pro
t: p
conn: w
m: 1
tst: 1706965203
alt: 41
_type: location
tid: RO
_http: true
ghash: u33d773
isorcv: '2024-02-03T13:00:03Z'
isotst: '2024-02-03T13:00:03Z'
disptst: '2024-02-03 13:00:03'
"/api/v1/points":
get:
summary: Retrieves all points
tags:
- Points
parameters:
- name: api_key
in: query
required: true
description: API Key
schema:
type: string
- name: start_at
in: query
description: Start date (i.e. 2024-02-03T13:00:03Z or 2024-02-03)
schema:
type: string
- name: end_at
in: query
description: End date (i.e. 2024-02-03T13:00:03Z or 2024-02-03)
schema:
type: string
- name: page
in: query
required: false
description: Page number
schema:
type: integer
- name: per_page
in: query
required: false
description: Number of points per page
schema:
type: integer
responses:
'200':
description: points found
content:
application/json:
schema:
type: array
items:
type: object
properties:
id:
type: integer
battery_status:
type: number
ping:
type: number
battery:
type: number
tracker_id:
type: string
topic:
type: string
altitude:
type: number
longitude:
type: number
velocity:
type: number
trigger:
type: string
bssid:
type: string
ssid:
type: string
connection:
type: string
vertical_accuracy:
type: number
accuracy:
type: number
timestamp:
type: number
latitude:
type: number
mode:
type: number
inrids:
type: array
in_regions:
type: array
raw_data:
type: string
import_id:
type: string
city:
type: string
country:
type: string
created_at:
type: string
updated_at:
type: string
user_id:
type: integer
geodata:
type: string
visit_id:
type: string
"/api/v1/points/{id}":
delete:
summary: Deletes a point
tags:
- Points
parameters:
- name: api_key
in: query
required: true
description: API Key
schema:
type: string
- name: id
in: path
required: true
description: Point ID
schema:
type: string
responses:
'200':
description: point deleted
"/api/v1/settings":
patch:
summary: Updates user settings
tags:
- Settings
parameters:
- name: api_key
in: query
required: true
description: API Key
schema:
type: string
responses:
'200':
description: settings updated
requestBody:
content:
application/json:
schema:
type: object
properties:
route_opacity:
type: number
meters_between_routes:
type: number
minutes_between_routes:
type: number
fog_of_war_meters:
type: number
time_threshold_minutes:
type: number
merge_threshold_minutes:
type: number
optional:
- route_opacity
- meters_between_routes
- minutes_between_routes
- fog_of_war_meters
- time_threshold_minutes
- merge_threshold_minutes
examples:
'0':
summary: Updates user settings
value:
settings:
route_opacity: 0.3
meters_between_routes: 100
minutes_between_routes: 100
fog_of_war_meters: 100
time_threshold_minutes: 100
merge_threshold_minutes: 100
get:
summary: Retrieves user settings
tags:
- Settings
parameters:
- name: api_key
in: query
required: true
description: API Key
schema:
type: string
responses:
'200':
description: settings found
content:
application/json:
schema:
type: object
properties:
settings:
type: object
properties:
route_opacity:
type: string
meters_between_routes:
type: string
minutes_between_routes:
type: string
fog_of_war_meters:
type: string
time_threshold_minutes:
type: string
merge_threshold_minutes:
type: string
required:
- route_opacity
- meters_between_routes
- minutes_between_routes
- fog_of_war_meters
- time_threshold_minutes
- merge_threshold_minutes
"/api/v1/stats":
get:
summary: Retrieves all stats
tags:
- Stats
parameters:
- name: api_key
in: query
required: true
description: API Key
schema:
type: string
responses:
'200':
description: stats found
content:
application/json:
schema:
type: object
properties:
totalDistanceKm:
type: number
totalPointsTracked:
type: number
totalReverseGeocodedPoints:
type: number
totalCountriesVisited:
type: number
totalCitiesVisited:
type: number
yearlyStats:
type: array
items:
type: object
properties:
year:
type: integer
totalDistanceKm:
type: number
totalCountriesVisited:
type: number
totalCitiesVisited:
type: number
monthlyDistanceKm:
type: object
properties:
january:
type: number
february:
type: number
march:
type: number
april:
type: number
may:
type: number
june:
type: number
july:
type: number
august:
type: number
september:
type: number
october:
type: number
november:
type: number
december:
type: number
required:
- year
- totalDistanceKm
- totalCountriesVisited
- totalCitiesVisited
- monthlyDistanceKm
required:
- totalDistanceKm
- totalPointsTracked
- totalReverseGeocodedPoints
- totalCountriesVisited
- totalCitiesVisited
- yearlyStats
servers:
- url: http://{defaultHost}
variables:
defaultHost:
default: localhost:3000