Version API and add spot_allowed to options call. Closes #35

This commit is contained in:
Ian Renton
2025-10-09 15:35:29 +01:00
parent c66693fc99
commit 277743dac7
5 changed files with 20 additions and 16 deletions

View File

@@ -10,9 +10,9 @@ info:
license:
name: The Unlicense
url: https://unlicense.org/#the-unlicense
version: 0.1
version: 1
servers:
- url: https://spothole.app/api
- url: https://spothole.app/api/v1
paths:
/spots:
get:
@@ -389,8 +389,12 @@ paths:
example: "EU"
max_spot_age:
type: integer
description: The maximum age, in seconds, of any spot before it will be deleted by the system. When querying the /api/spots endpoint and providing a "max_age" or "since" parameter, there is no point providing a number larger than this, because the system drops all spots older than this.
description: The maximum age, in seconds, of any spot before it will be deleted by the system. When querying the /api/v1/spots endpoint and providing a "max_age" or "since" parameter, there is no point providing a number larger than this, because the system drops all spots older than this.
example: 3600
spot_allowed:
type: boolean
description: Whether the POST /spot call, to add spots to the server directly via its API, is permitted on this server.
example: true
/spot:
@@ -398,7 +402,7 @@ paths:
tags:
- spots
summary: Add a spot
description: "Supply a new spot object, which will be added to the system. Currently, this will not be reported up the chain to a cluster, POTA, SOTA etc. This will be introduced in a future version. cURL example: `curl --request POST --header \"Content-Type: application/json\" --data '{\"dx_call\":\"M0TRT\",\"time\":1760019539, \"freq\":14200000, \"comment\":\"Test spot please ignore\", \"de_call\":\"M0TRT\"}' https://spothole.app/api/spot`"
description: "Supply a new spot object, which will be added to the system. Currently, this will not be reported up the chain to a cluster, POTA, SOTA etc. This will be introduced in a future version. cURL example: `curl --request POST --header \"Content-Type: application/json\" --data '{\"dx_call\":\"M0TRT\",\"time\":1760019539, \"freq\":14200000, \"comment\":\"Test spot please ignore\", \"de_call\":\"M0TRT\"}' https://spothole.app/api/v1/spot`"
operationId: spot
requestBody:
description: The JSON spot object

View File

@@ -6,7 +6,7 @@ var alerts = []
// Load alerts and populate the table.
function loadAlerts() {
$.getJSON('/api/alerts' + buildQueryString(), function(jsonData) {
$.getJSON('/api/v1/alerts' + buildQueryString(), function(jsonData) {
// Store last updated time
lastUpdateTime = moment.utc();
updateRefreshDisplay();
@@ -177,7 +177,7 @@ function addAlertRowsToTable(tbody, alerts) {
// Load server options. Once a successful callback is made from this, we then query alerts.
function loadOptions() {
$.getJSON('/api/options', function(jsonData) {
$.getJSON('/api/v1/options', function(jsonData) {
// Store options
options = jsonData;

View File

@@ -6,7 +6,7 @@ var spots = []
// Load spots and populate the table.
function loadSpots() {
$.getJSON('/api/spots' + buildQueryString(), function(jsonData) {
$.getJSON('/api/v1/spots' + buildQueryString(), function(jsonData) {
// Store last updated time
lastUpdateTime = moment.utc();
updateRefreshDisplay();
@@ -155,7 +155,7 @@ function updateTable() {
// Load server options. Once a successful callback is made from this, we then query spots and set up the timer to query
// spots repeatedly.
function loadOptions() {
$.getJSON('/api/options', function(jsonData) {
$.getJSON('/api/v1/options', function(jsonData) {
// Store options
options = jsonData;

View File

@@ -1,6 +1,6 @@
// Load server status
function loadStatus() {
$.getJSON('/api/status', function(jsonData) {
$.getJSON('/api/v1/status', function(jsonData) {
$("#status-container").empty();
$("#status-container").append(generateStatusCard("Server Information", [
`Software Version: ${jsonData["software-version"]}`,