openAPISpec.yaml 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385
  1. openapi: "3.0.0"
  2. info:
  3. version: 1.0.0
  4. title: SensLog Telemetry
  5. servers:
  6. - url: http://127.0.0.1:8080
  7. paths:
  8. /info:
  9. get:
  10. operationId: infoGET
  11. summary: Information about running instance
  12. responses:
  13. '200':
  14. description: Instance information
  15. content:
  16. application/json:
  17. schema:
  18. $ref: "#/components/schemas/Info"
  19. default:
  20. description: unexpected error
  21. content:
  22. application/json:
  23. schema:
  24. $ref: "#/components/schemas/Error"
  25. /campaigns:
  26. get:
  27. operationId: campaignAllGET
  28. summary: Publish info about all campaigns
  29. responses:
  30. 200:
  31. description: JSON array of basic info of each campaign
  32. content:
  33. application/json:
  34. schema:
  35. type: array
  36. properties:
  37. Campaign@NavigationLink:
  38. type: string
  39. format: uri
  40. id:
  41. type: integer
  42. format: int64
  43. description:
  44. type: string
  45. from_time:
  46. type: string
  47. format: date-time
  48. example: "2023-01-25 15:35:32Z"
  49. to_time:
  50. type: string
  51. format: date-time
  52. example:
  53. Campaign@NavigationLink: "/campaigns/1"
  54. id: 1
  55. description: "Campaign example"
  56. from_time: "2023-01-25 15:35:32Z"
  57. to_time: "2023-03-20 10:35:32Z"
  58. default:
  59. description: unexpected error
  60. content:
  61. application/json:
  62. schema:
  63. $ref: '#/components/schemas/Error'
  64. /campaigns/{id}:
  65. get:
  66. operationId: campaignIdGET
  67. summary: Publish info about a campaign
  68. parameters:
  69. - in: path
  70. name: id
  71. schema:
  72. type: integer
  73. required: true
  74. description: Numeric ID of the campaign to get
  75. responses:
  76. 200:
  77. description: JSON object containing info about a campaign
  78. content:
  79. application/json:
  80. schema:
  81. $ref: '#/components/schemas/CampaignInfo'
  82. default:
  83. description: unexpected error
  84. content:
  85. application/json:
  86. schema:
  87. $ref: '#/components/schemas/Error'
  88. /campaigns/{id}/observations:
  89. get:
  90. operationId: campaignIdObservationGET
  91. summary: Publish last observation from the campaign
  92. parameters:
  93. - in: path
  94. name: id
  95. schema:
  96. type: integer
  97. required: true
  98. description: Numeric ID of the campaign to get
  99. responses:
  100. 200:
  101. description: JSON containing telemetry observation of the campaign
  102. content:
  103. application/json:
  104. schema:
  105. type: object
  106. properties:
  107. Campaign@NavigationLink:
  108. type: string
  109. format: uri
  110. data:
  111. type: array
  112. items:
  113. $ref: '#/components/schemas/Observation'
  114. default:
  115. description: unexpected error
  116. content:
  117. application/json:
  118. schema:
  119. $ref: "#/components/schemas/Error"
  120. /units/{id}:
  121. get:
  122. operationId: unitIdGET
  123. summary: Publish info about a unit
  124. responses:
  125. 200:
  126. description: JSON object containing info about an unit
  127. content:
  128. application/json:
  129. schema:
  130. $ref: '#/components/schemas/UnitInfo'
  131. default:
  132. description: unexpected error
  133. content:
  134. application/json:
  135. schema:
  136. $ref: "#/components/schemas/Error"
  137. /units/{id}/observations:
  138. get:
  139. operationId: unitIdObservationGET
  140. summary: Publish last observation from the unit
  141. responses:
  142. 200:
  143. description: JSON containing telemetry observations of the unit
  144. content:
  145. application/json:
  146. schema:
  147. type: object
  148. properties:
  149. Unit@NavigationLink:
  150. type: string
  151. format: uri
  152. data:
  153. type: array
  154. items:
  155. $ref: '#/components/schemas/Observation'
  156. default:
  157. description: unexpected error
  158. content:
  159. application/json:
  160. schema:
  161. $ref: "#/components/schemas/Error"
  162. /sensors/{id}:
  163. get:
  164. operationId: sensorIdGET
  165. summary: Publish info about a sensor
  166. responses:
  167. 200:
  168. description: JSON object containing info about a sensor
  169. content:
  170. application/json:
  171. schema:
  172. $ref: '#/components/schemas/SensorInfo'
  173. default:
  174. description: unexpected error
  175. content:
  176. application/json:
  177. schema:
  178. $ref: "#/components/schemas/Error"
  179. components:
  180. schemas:
  181. CampaignInfo:
  182. type: object
  183. required:
  184. - id
  185. - from_time
  186. - to_time
  187. - units
  188. properties:
  189. Observations@NavigationLink:
  190. type: string
  191. format: uri
  192. id:
  193. type: integer
  194. format: int64
  195. description:
  196. type: string
  197. from_time:
  198. type: string
  199. format: date-time
  200. to_time:
  201. type: string
  202. format: date-time
  203. units:
  204. type: array
  205. items:
  206. type: object
  207. required:
  208. - unit_id
  209. - Unit@NavigationLink
  210. properties:
  211. id:
  212. type: integer
  213. format: int64
  214. Unit@NavigationLink:
  215. type: string
  216. format: uri
  217. example:
  218. Observations@NavigationLink: "/campaigns/1/observations"
  219. id: 1
  220. description: "Campaign example"
  221. from_time: "2023-01-25 15:35:32Z"
  222. to_time: "2023-03-20 10:35:32Z"
  223. units: []
  224. UnitInfo:
  225. type: object
  226. required:
  227. - unit_id
  228. - is_mobile
  229. - type
  230. - sensors
  231. properties:
  232. Campaign@NavigationLink:
  233. type: string
  234. format: uri
  235. description: URI link to the assigned campaign
  236. id:
  237. type: integer
  238. format: int64
  239. description:
  240. type: string
  241. is_mobile:
  242. type: boolean
  243. type:
  244. type: object
  245. required:
  246. - id
  247. - name
  248. properties:
  249. id:
  250. type: string
  251. minLength: 1
  252. maxLength: 2
  253. name:
  254. type: string
  255. maxLength: 20
  256. description:
  257. type: string
  258. sensors:
  259. type: array
  260. items:
  261. type: object
  262. required:
  263. - sensor_id
  264. - Sensor@NavigationLink
  265. properties:
  266. sensor_id:
  267. type: integer
  268. format: int64
  269. Sensor@NavigationLink:
  270. type: string
  271. format: uri
  272. description: URI link to the sensor info
  273. SensorInfo:
  274. type: object
  275. required:
  276. - sensor_id
  277. - name
  278. - type
  279. - phenomenon
  280. properties:
  281. sensor_id:
  282. type: integer
  283. format: int64
  284. name:
  285. type: string
  286. type:
  287. type: string
  288. min_range:
  289. type: string
  290. max_range:
  291. type: string
  292. phenomenon:
  293. $ref: '#/components/schemas/PhenomenonInfo'
  294. PhenomenonInfo:
  295. type: object
  296. required:
  297. - id
  298. - name
  299. - uom
  300. properties:
  301. id:
  302. type: integer
  303. format: int64
  304. name:
  305. type: string
  306. uom:
  307. type: string
  308. maxLength: 30
  309. uom_link:
  310. type: string
  311. format: uri
  312. Observation:
  313. type: object
  314. required:
  315. - unit_id
  316. - time_stamp
  317. - location
  318. - observed_values
  319. properties:
  320. unit_id:
  321. type: integer
  322. format: int64
  323. time_stamp:
  324. type: string
  325. format: date-time
  326. location:
  327. $ref: '#/components/schemas/Location'
  328. observed_values:
  329. type: object
  330. Location:
  331. type: object
  332. properties:
  333. longitude:
  334. type: number
  335. format: float
  336. latitude:
  337. type: number
  338. format: float
  339. altitude:
  340. type: number
  341. format: float
  342. example:
  343. longitude: 49.7384
  344. latitude: 13.3736
  345. altitude: 350.3
  346. Info:
  347. required:
  348. - name
  349. - version
  350. - build
  351. - uptime
  352. - uptimeMillis
  353. properties:
  354. name:
  355. type: string
  356. version:
  357. type: string
  358. build:
  359. type: string
  360. uptimeMillis:
  361. type: integer
  362. format: int64
  363. uptime:
  364. type: string
  365. example:
  366. name: "senslog-telemetry"
  367. version: "1.1.0"
  368. build: "123456789"
  369. uptimeMillis: 1684862333
  370. uptime: "1:20:00"
  371. Error:
  372. required:
  373. - code
  374. - message
  375. properties:
  376. code:
  377. type: integer
  378. format: int32
  379. message:
  380. type: string
  381. example:
  382. code: 404
  383. message: "Not Found"