Browse Source

route openapi specs

Maxime Alves LIRMM@home 3 years ago
parent
commit
f67d0bece3
1 changed files with 166 additions and 0 deletions
  1. 166
    0
      docs/openapi.yaml

+ 166
- 0
docs/openapi.yaml View File

@@ -0,0 +1,166 @@
1
+openapi: "3.0.0"
2
+info:
3
+    title: PyHeatpump API specifications
4
+    version: 0.1.0
5
+paths:
6
+    /:
7
+        get:
8
+            operation: get_specs
9
+            summary: List API specs (read this file)
10
+            responses:
11
+                '200':
12
+                    description: 200 response
13
+                    content:
14
+                        application/json:
15
+                            examples:
16
+                                value:
17
+                                    [route1, route2, ..., routeN]
18
+    /config:
19
+        get:
20
+            operation: get_config
21
+            summary: Retrieves current configuration values
22
+            responses:
23
+                '200':
24
+                    description: The dictionary of configuration
25
+                    content:
26
+                        application/json:
27
+                            examples:
28
+                                configuration:
29
+                                    heatpump:
30
+                                        option: value
31
+                                    supervisor:
32
+                                        option: value
33
+                '500':
34
+                    description: Failed to get configuration
35
+
36
+
37
+        post:
38
+            operation: set_config
39
+            summary: Sets the configuration values
40
+            content:
41
+                application/json:
42
+                    examples:
43
+                        valuesToSet:
44
+                            heatpump:
45
+                                database: memory
46
+                            supervisor:
47
+                                scheme: https
48
+                                host: supervision.gteo.fr:8081
49
+
50
+                text/plain:
51
+                    examples:
52
+                        valuesToSet: heatpump.serial_port=/dev/serial0
53
+
54
+
55
+            responses:
56
+                '200':
57
+                    description: Setting configuration succeeded
58
+                '403':
59
+                    description: Setting configuration forbidden
60
+                '404':
61
+                    description: Specified setting does not exists
62
+                '415':
63
+                    description: Sent data cannot be treated
64
+
65
+    /variable_types:
66
+        get:
67
+            operation: get_variable_types
68
+            summary: Retrieves the list of variable types and their parameters
69
+            responses:
70
+                '200':
71
+                    description: The variable types details, as described in the database tab var_types
72
+                    content:
73
+                        application/json:
74
+                            examples:
75
+                                variableTypes:
76
+                                    analog:
77
+                                        slabel: A
78
+                                        type: float
79
+                                        start_address: 0
80
+                                        end_address: 250
81
+                                    integer:
82
+                                        slabel: I
83
+                                        type: int
84
+                                        start_address: 0
85
+                                        end_address: 250
86
+                                    digital:
87
+                                        slabel: D
88
+                                        type: boolean
89
+                                        start_address: 0
90
+                                        end_address: 250
91
+        set:
92
+            operation: set_variable_types
93
+            summary: Retrieves the list of variable types and their parameters
94
+            content:
95
+                application/json:
96
+                    examples:
97
+                        variableTypes:
98
+                            analog:
99
+                                slabel: A
100
+                                type: float
101
+                                start_address: 0
102
+                                end_address: 250
103
+                            integer:
104
+                                slabel: I
105
+                                type: int
106
+                                start_address: 0
107
+                                end_address: 250
108
+                            digital:
109
+                                slabel: D
110
+                                type: boolean
111
+                                start_address: 0
112
+                                end_address: 250
113
+             responses:
114
+                '200':
115
+                    description: The variable types details were correctly set.
116
+
117
+
118
+    /variables:
119
+        get:
120
+            operation: get_variables
121
+            summary: Retrieves a list of variables, by type
122
+            parameters:
123
+                changed:
124
+                    description: List only variables where values changed since last fetch
125
+                errored:
126
+                    description: Listen only variables that the program was unable to fetch
127
+            responses:
128
+                '200':
129
+                    application/json:
130
+                        description: List of the variables
131
+                        examples:
132
+                            variablesList:
133
+                                A:
134
+                                    - 42: 34
135
+                                    - 24: 43
136
+                                I:
137
+                                    - 4200: 777
138
+
139
+        post:
140
+            operation: set_variables
141
+            summary: Make changes to some variables
142
+            content:
143
+                application/json:
144
+                    description: List of the changes to make
145
+                    examples:
146
+                        variablesToSet:
147
+                            A:
148
+                                42: 34
149
+                                24: 43
150
+                            I:
151
+                                4200: 777
152
+                            D:
153
+                                100: 1
154
+                                200: 0
155
+            responses:
156
+                '500':
157
+                    description: Some variables cannot be set
158
+                    content:
159
+                        examples:
160
+                            variablesErrored:
161
+                                A:
162
+                                    - 42
163
+                                    - 24
164
+                                I:
165
+                                    - 4200
166
+                                    - 420

Loading…
Cancel
Save