Location Management

Location Management

🚫
NOTE: This part of the API does not exist yet.

Create, update, delete locations and move devices between them.

List Locations

Endpoint

GET /care-homes

Response

200 OK

[
  {
    "id": "61417400",
    "name": "Awesome Care Inc.",
    "devices": ["123e4567-e89b-12d3-a456-426614174000"]
  }
]
  • id: Unique identifier of the location.
  • name: Name of the location.
  • devices: List of device IDs currently assigned to this location.

Create Location

Endpoint

POST /care-homes

Body

{
  "name": "Awesome Care Inc."
}
  • name: Name of the location. Must be a trimmed utf-8 string of 1 to 120 characters.

Response

201 Created

{
  "id": "61417400",
  "name": "Awesome Care Inc.",
  "devices": []
}
  • id: Unique identifier of the location.
  • name: Name of the location.
  • devices: List of device IDs currently assigned to this location. Will be empty for a newly created location.

Update Location

Endpoint

PATCH /care-homes/<locationId>

Body

{
  "name": "Even More Awesome Care Inc."
}
  • name: New name of the location. Must be a trimmed utf-8 string of 1 to 120 characters.

Response

200 OK

{
  "id": "61417400",
  "name": "Even More Awesome Care Inc.",
  "devices": ["123e4567-e89b-12d3-a456-426614174000"]
}
  • id: Unique identifier of the location.
  • name: Updated name of the location.
  • devices: List of device IDs currently assigned to this location.

Delete Location

Endpoint

DELETE /care-homes/<locationId>

Response

  • 204 - location was deleted
  • 409 - location cannot be deleted because it still has devices assigned to it. Move or delete the devices first and try again.

Get Device

Endpoint

GET /care-homes/<locationId>/devices/<deviceId>

Response

200 OK

{
  "id": "123e4567-e89b-12d3-a456-426614174000",
  "name": "Alice's Room Sensor"
}
  • id: Unique identifier of the device.
  • name: Name of the device.

Update Device

Endpoint

PATCH /care-homes/<locationId>/devices/<deviceId>

Body

{
  "name": "Alice's Even Cooler Room Sensor"
}
  • name: New name of the device. Must be a trimmed utf-8 string of 1 to 120 characters.

Response

200 OK

{
  "id": "123e4567-e89b-12d3-a456-426614174000",
  "name": "Alice's Even Cooler Room Sensor"
}
  • id: Unique identifier of the device.
  • name: Updated name of the device.

Move Device

Endpoint

POST /care-homes/<locationId>/devices/<deviceId>/move

Body

{
  "targetLocationId": "61417401"
}
  • targetLocationId: ID of the location to move the device to.

Response

  • 204: Device was successfully moved to the target location.
  • 403: Lacking permissions for one of the involved locations.