|
|
|
@ -12,6 +12,8 @@ produces:
|
|
|
|
|
basePath: /api |
|
|
|
|
|
|
|
|
|
paths: |
|
|
|
|
# Light-Meter A.P.I. Calls |
|
|
|
|
# ==================================================================== |
|
|
|
|
/readings/add/{light_meter}: |
|
|
|
|
post: |
|
|
|
|
operationId: api.post_a_reading |
|
|
|
@ -72,55 +74,6 @@ paths:
|
|
|
|
|
description: >- |
|
|
|
|
The reading was successfully added to the database. |
|
|
|
|
|
|
|
|
|
/status/update/{device}: |
|
|
|
|
post: |
|
|
|
|
operationId: api.post_a_status_change |
|
|
|
|
tags: |
|
|
|
|
- Log Device Status Change |
|
|
|
|
summary: >- |
|
|
|
|
Logs a change in the status of the specified device. |
|
|
|
|
description: >- |
|
|
|
|
This is mostly to check if the devices included in this project |
|
|
|
|
are turned on, off or an error has occured and they are |
|
|
|
|
unreachable/crashed. |
|
|
|
|
parameters: |
|
|
|
|
- name: device |
|
|
|
|
in: path |
|
|
|
|
description: >- |
|
|
|
|
The Id. of the device with the change in status. 1, 2 and 3 |
|
|
|
|
refer to the light-meters in Ritherdon and 4, 5 and 6 |
|
|
|
|
refer to the relays in the gallery. The pairing of each |
|
|
|
|
meter and relay is as follows: 1->4, 2->5 and 3->6. |
|
|
|
|
type: integer |
|
|
|
|
required: True |
|
|
|
|
- name: the_status_change |
|
|
|
|
in: body |
|
|
|
|
description: >- |
|
|
|
|
The status change and the time the change occurred. |
|
|
|
|
required: True |
|
|
|
|
schema: |
|
|
|
|
type: object |
|
|
|
|
properties: |
|
|
|
|
time: |
|
|
|
|
type: string |
|
|
|
|
format: date-time |
|
|
|
|
example: 2019-10-19 17:04:57 |
|
|
|
|
description: >- |
|
|
|
|
The date and time the change in status occurred. Make |
|
|
|
|
sure to use the U.T.C. time format. This is because |
|
|
|
|
the A.P.I. has made a design decision to standardise |
|
|
|
|
on it. |
|
|
|
|
status: |
|
|
|
|
type: string |
|
|
|
|
example: "on" |
|
|
|
|
description: >- |
|
|
|
|
The current status of the device you would like to log. |
|
|
|
|
The two status types are "on" and "off". |
|
|
|
|
responses: |
|
|
|
|
201: |
|
|
|
|
description: >- |
|
|
|
|
The status update was successfully added to the database. |
|
|
|
|
|
|
|
|
|
/readings/latest/{light_meter}: |
|
|
|
|
get: |
|
|
|
|
operationId: api.get_latest |
|
|
|
@ -146,7 +99,7 @@ paths:
|
|
|
|
|
200: |
|
|
|
|
description: >- |
|
|
|
|
If the server can successfully retrieve the latest reading |
|
|
|
|
for the specified light meter, you should receive a JASON |
|
|
|
|
for the specified light meter, you should receive a JSON |
|
|
|
|
object like the one below. It should include the Id. of |
|
|
|
|
the light meter it was taken with, the time the reading |
|
|
|
|
was taken and the reading itself. |
|
|
|
@ -249,3 +202,105 @@ paths:
|
|
|
|
|
schema: |
|
|
|
|
type: object |
|
|
|
|
additionalProperties: True |
|
|
|
|
|
|
|
|
|
# Device A.P.I. Calls |
|
|
|
|
# ==================================================================== |
|
|
|
|
/status/update/{device}: |
|
|
|
|
post: |
|
|
|
|
operationId: api.post_a_status_change |
|
|
|
|
tags: |
|
|
|
|
- Log Device Status Change |
|
|
|
|
summary: >- |
|
|
|
|
Logs a change in the status of the specified device. |
|
|
|
|
description: >- |
|
|
|
|
This is mostly to check if the devices included in this project |
|
|
|
|
are turned on, off or an error has occured and they are |
|
|
|
|
unreachable/crashed. |
|
|
|
|
parameters: |
|
|
|
|
- name: device |
|
|
|
|
in: path |
|
|
|
|
description: >- |
|
|
|
|
The Id. of the device with the change in status. 1, 2 and 3 |
|
|
|
|
refer to the light-meters in Ritherdon and 4, 5 and 6 |
|
|
|
|
refer to the relays in the gallery. The pairing of each |
|
|
|
|
meter and relay is as follows: 1->4, 2->5 and 3->6. |
|
|
|
|
type: integer |
|
|
|
|
required: True |
|
|
|
|
- name: the_status_change |
|
|
|
|
in: body |
|
|
|
|
description: >- |
|
|
|
|
The status change and the time the change occurred. |
|
|
|
|
required: True |
|
|
|
|
schema: |
|
|
|
|
type: object |
|
|
|
|
properties: |
|
|
|
|
time: |
|
|
|
|
type: string |
|
|
|
|
format: date-time |
|
|
|
|
example: 2019-10-19 17:04:57 |
|
|
|
|
description: >- |
|
|
|
|
The date and time the change in status occurred. Make |
|
|
|
|
sure to use the U.T.C. time format. This is because |
|
|
|
|
the A.P.I. has made a design decision to standardise |
|
|
|
|
on it. |
|
|
|
|
status: |
|
|
|
|
type: string |
|
|
|
|
example: "on" |
|
|
|
|
description: >- |
|
|
|
|
The current status of the device you would like to log. |
|
|
|
|
The two status types are "on" and "off". |
|
|
|
|
responses: |
|
|
|
|
201: |
|
|
|
|
description: >- |
|
|
|
|
The status update was successfully added to the database. |
|
|
|
|
|
|
|
|
|
/status/latest/{device}: |
|
|
|
|
get: |
|
|
|
|
operationId: api.get_latest_device_status |
|
|
|
|
tags: |
|
|
|
|
- Request Device Status |
|
|
|
|
summary: >- |
|
|
|
|
Returns the current status of the specified device. |
|
|
|
|
description: >- |
|
|
|
|
Use this U.R.L. to retrieve the current status of the device |
|
|
|
|
you specified (in the U.R.L.). At the time of writing, the |
|
|
|
|
project has six devices in total which are split equally |
|
|
|
|
between Ritherdon and the gallery. Devices 1 to 3 (light-meters) |
|
|
|
|
refer to the devices in Ritherdon and 4 to 6 (relays) are in |
|
|
|
|
the gallery. Each light-meter and relay should pair up in the |
|
|
|
|
following ways: 1->4, 2->5 and 3->6. |
|
|
|
|
parameters: |
|
|
|
|
- name: device |
|
|
|
|
in: path |
|
|
|
|
description: >- |
|
|
|
|
This is the Id. of the device which you are retrieving the |
|
|
|
|
current status for. The Id. should consist of a number |
|
|
|
|
between 1 and 6, at the time of writing. |
|
|
|
|
type: integer |
|
|
|
|
required: True |
|
|
|
|
responses: |
|
|
|
|
200: |
|
|
|
|
description: >- |
|
|
|
|
If the server can successfully retrieve the current status |
|
|
|
|
for the specified device, you should receive a JSON object |
|
|
|
|
like the one below. It should include the Id. of the |
|
|
|
|
device, the current status and the time it was logged. |
|
|
|
|
schema: |
|
|
|
|
type: object |
|
|
|
|
properties: |
|
|
|
|
id: |
|
|
|
|
type: integer |
|
|
|
|
example: 2 |
|
|
|
|
description: >- |
|
|
|
|
The is the Id. of the device. |
|
|
|
|
time: |
|
|
|
|
type: string |
|
|
|
|
example: 2019-10-19 17:04:57 |
|
|
|
|
description: >- |
|
|
|
|
The time the status change was logged in the |
|
|
|
|
database. The A.P.I. has standardised on the |
|
|
|
|
U.T.C. format. |
|
|
|
|
status: |
|
|
|
|
type: string |
|
|
|
|
example: balshsdkjk |
|
|
|
|
description: The current status of the device. |
|
|
|
|