-
Notifications
You must be signed in to change notification settings - Fork 2
Rest API
Users: /users
Areas: /areas
Weather: /areas/weather/:areaId
Sensors: /sensors
Controllers: /controllers
Cronjobs: /crons
Timetable: /timetable
Durations: /timetable/durations/:controllerId
Users, areas, controllers and sensors support the methods below:
Get: Returns all entries with relations.
Get/:id: Returns single entry by id + relations (for ex: GET request sent to url 'users/1')
Post: Creates a new entry and returns it (without relations). Body should be in the format of associated DTO (below).
Patch/:id: Updates an entry by id and returns an object that contains the changed property and id. Body should be in the format of associated DTO (below), however all fields are optional. (for ex: PATCH request sent to url 'areas/3')
Delete/:id: Deletes single entry by id (for ex: DELETE request sent to url 'users/2'). Does not return anything in the body, replies with 200 if successful.
Timetables: Timetables support the get method on /timetable endpoint, which returns an array of objects that have id, controllerId, startTime and endTime (start and end dates of each job per controller).
Durations support the get method on /timetable/durations endpoint to return all controllers, and /time/durations/:id for a specific controller. If queried for all, returns an object that has controller ids as keys and objects of (date: duration) pairs as values. If queried for a specific controller id, it returns the object of date: duration pairs for that controller.
{
firstName: string,
lastName: string,
isActive: boolean
}
{
user: string, // User id passed as string
isActive: boolean
}
{
area: string, // Area id passed as string
type: string,
isActive: boolean
}
{
area: string, // Area id passed as string
type: string,
isActive: boolean
}
{
controllerId (will be refactored): string,
time: string, use cron syntax -> "* * * * * *"
action: object [MqttActionDto]:
{
"id": "pump1",
"action": "on",
"duration": 3
}
}