Update doc: Timestamp added to returned events.
[apps/agl-service-can-low-level.git] / low-can-binding / binding / low-can-apidef.json
1 {
2   "openapi": "3.0.0",
3   "$schema": "http:iot.bzh/download/openapi/schema-3.0/default-schema.json",
4   "info": {
5     "description": "",
6     "title": "low-level-can-service",
7     "version": "4.0",
8     "x-binding-c-generator": {
9       "api": "low-can",
10       "version": 2,
11       "prefix": "",
12       "postfix": "",
13       "start": null ,
14       "onevent": null,
15       "init": "initv2",
16       "scope": "",
17       "private": false
18     }
19   },
20   "servers": [
21     {
22       "url": "ws://{host}:{port}/api/monitor",
23       "description": "Low level CAN API.",
24       "variables": {
25         "host": {
26           "default": "localhost"
27         },
28         "port": {
29           "default": "1234"
30         }
31       },
32       "x-afb-events": [
33         {
34           "$ref": "#/components/schemas/afb-event"
35         }
36       ]
37     }
38   ],
39   "components": {
40     "schemas": {
41       "afb-reply": {
42         "$ref": "#/components/schemas/afb-reply-v2"
43       },
44       "afb-event": {
45         "$ref": "#/components/schemas/afb-event-v2"
46       },
47       "afb-reply-v2": {
48         "title": "Generic response.",
49         "type": "object",
50         "required": [ "jtype", "request" ],
51         "properties": {
52           "jtype": {
53             "type": "string",
54             "const": "afb-reply"
55           },
56           "request": {
57             "type": "object",
58             "required": [ "status" ],
59             "properties": {
60               "status": { "type": "string" },
61               "info": { "type": "string" },
62               "token": { "type": "string" },
63               "uuid": { "type": "string" },
64               "reqid": { "type": "string" }
65             }
66           },
67           "response": { "type": "object" }
68         }
69       },
70       "afb-event-v2": {
71         "type": "object",
72         "required": [ "jtype", "event" ],
73         "properties": {
74           "jtype": {
75             "type": "string",
76             "const": "afb-event"
77           },
78           "event": { "type": "string" },
79           "data": { "type": "object" }
80         }
81       }
82     },
83     "x-permissions": {
84         "monitor": {
85           "permission": "urn:AGL:permission:low-can:public:monitor"
86         },
87         "write": {
88           "permission": "urn:AGL:permission:low-can:platform:write"
89         }
90     },
91     "responses": {
92             "200": {
93               "description": "A complex object array response",
94               "content": {
95                 "application/json": {
96                   "schema": {
97                     "$ref": "#/components/schemas/afb-reply"
98                   }
99                 }
100             }
101           }
102     }
103   },
104   "paths": {
105     "/subscribe": {
106       "description": "Subscribe to CAN signals events",
107         "parameters": [
108           {
109             "in": "query",
110             "name": "event",
111             "required": false,
112             "schema": { "type": "string" }
113           }
114         ],
115         "responses": {
116           "200": {"$ref": "#/components/responses/200"}
117         }
118       },
119     "/unsubscribe": {
120       "description": "Unsubscribe previously suscribed signals.",
121         "parameters": [
122           {
123             "in": "query",
124             "name": "event",
125             "required": false,
126             "schema": { "type": "string" }
127           }
128         ],
129         "responses": {
130           "200": {"$ref": "#/components/responses/200"}
131         }
132       },
133     "/auth": {
134       "description": "Authenticate session to be raise Level Of Assurance.",
135       "get": {
136         "x-permissions": {
137           "$ref": "#/components/x-permissions/write"
138         },
139         "responses": {
140           "200": {"$ref": "#/components/responses/200"}
141         }
142       }
143     },
144     "/write": {
145       "description": "Write a CAN messages to the CAN bus.",
146       "get": {
147         "x-permissions": {
148           "LOA": 1
149         },
150         "parameters": [
151           {
152             "in": "query",
153             "name": "bus_name",
154             "required": false,
155             "schema": { "type": "string" }
156         },
157         {
158             "in": "query",
159             "name": "frame",
160             "required": false,
161                         "schema": { "type": "array" },
162                         "parameters": [
163                         {
164                                 "in": "query",
165                                 "name": "can_id",
166                                 "required": false,
167                                 "schema": { "type": "string" }
168                         },
169                         {
170                                 "in": "query",
171                                 "name": "can_dlc",
172                                 "required": false,
173                                 "schema": { "type": "string" }
174                         },
175                         {
176                                 "in": "query",
177                                 "name": "can_data",
178                                 "required": false,
179                                 "schema": { "type": "string" }
180                         }
181                         ]
182                   },
183                 {
184             "in": "query",
185             "name": "signal_name",
186             "required": false,
187             "schema": { "type": "string" }
188                 },
189                 {
190             "in": "query",
191             "name": "signal_value",
192             "required": false,
193             "schema": { "type": "integer" }
194         }
195         ],
196         "responses": {
197           "200": {"$ref": "#/components/responses/200"}
198         }
199       }
200     }
201   }
202 }