-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathapiary.apib
98 lines (71 loc) · 2.57 KB
/
apiary.apib
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
FORMAT: 1A
HOST: iot-bath-vent-switch.herokuapp.com
# bath-vent-switch
bath-vent-switch is a simple api that allows user to turn on or off switch.
it doesn't matter in which state switch is, after calling on, it will be on,
adter calling off, it will be off.
# Ping [/ping]
## Ping service [GET]
Returns `200` if service is alive.
+ Response 200 (application/json)
## bath-vent turn on/off [/houses/{house_id}]
+ Parameters
+ house_id (required, string, `d28f9e91-ea20-43cf-abf5-24f3d659afef`) ... unique ID of the House.
### get bath vent switch state [GET]
checks state of bath vent switch in the house identified by house_id
Status code is:
200 when everything was fine and successed;
503 when connection to simulator fails and response is based
on the last update this switch had.
404 when house id specification is incorrect
+ response 200 (application/json)
{
"houseid" : "a1bc00fb-4724-476a-a553-d65d2c1bac0e",
"status" : "on",
"successed" : true
}
+ response 503 (application/json)
{
"houseid" : "a1bc00fb-4724-476a-a553-d65d2c1bac0e",
"status" : "on",
"successed" : false
}
+ response 404 (application/json)
{
"houseid" : "a1bc00fb-4724-476a-a553-d65d2c1bac0e",
"status" : null,
"successed" : false
}
### Change bath vent status [PUT]
house is identified by house id, and json formatted arguments
are passed in body. "set_status" is state in which bath vent need to move,
timeout is interval, during of which, bath vent should keep this state, and
then be off.
Status code is:
200 when everything was fine and successed;
503 when connection to simulator fails and response is based
on the last update this switch had.
404 when device id specification is incorrect
+ Request (application/json)
{
"set_status": "on",
"timeout": 30
}
+ response 200 (application/json)
{
"houseid" : "a1bc00fb-4724-476a-a553-d65d2c1bac0e",
"status" : "on",
"successed" : true
}
+ response 503 (application/json)
{
"houseid" : "a1bc00fb-4724-476a-a553-d65d2c1bac0e",
"status" : "on",
"successed" : false
}
+ response 404 (application/json)
{
"houseid" : "a1bc00fb-4724-476a-a553-d65d2c1bac0e",
"status" : null,
"successed" : false
}