Skip to content

API Reference for beacon backend

GET /beacon

Retrieves the properties of a beacon using the beacon id.

Parameters

  • id: string, 5 < length < 20

Request

{
    "id": "1234567890"
}

Response

400 if no/invalid id is provided. 404 if no beacon with such id exists.

{
    "id": "1234567891",
    "description": "test beacon2",
    "longDescription": "long description",
    "txPower": -10,
    "lat": 50,
    "long": 51
}

GET /beacons

Gets all the beacons in the database.

Parameters

None

Response

[
    {
        "id": "1234567891",
        "description": "test beacon2",
        "longDescription": "long description",
        "txPower": -10,
        "lat": 50,
        "long": 51
    }
]

POST /beacon

Adds a new beacon to the database.

Parameters

  • id, 5 < length < 20
  • description, a short description of the beacon
  • longDescription, a detailed description of the beacon
  • txPower, the power that the beacon is transmitting used to calculate the distance to the beacon.
  • lat, the latitude of the beacon
  • long, the longtitude of the beacon
{
    "id": "1234567891",
    "description": "test beacon2",
    "longDescription": "long description",
    "txPower": -10,
    "lat": 50,
    "long": 51
}

Response

400 if invalid input is provided

200 if operation was successful along with a json of the object that was created.

DELETE /beacon

Deletes the beacon with the specified id.

Parameters

  • id: string, 5 < length < 20

Request

{
    "id": "1234567890"
}

Response

400 if invalid id was provided

If successful returns a json of the beacon that was deleted.


Last update: June 19, 2023