openapi.yaml 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324
  1. openapi: 3.0.3
  2. info:
  3. title: Storage node API
  4. description: Storage node API
  5. contact:
  6. email: info@joystream.org
  7. license:
  8. name: GPL-3.0-only
  9. url: https://opensource.org/licenses/GPL-3.0
  10. version: 0.1.0
  11. externalDocs:
  12. description: Storage node API
  13. url: https://github.com/Joystream/joystream/issues/2224
  14. servers:
  15. - url: http://localhost:3333/api/v1/
  16. tags:
  17. - name: files
  18. description: Storage node Files API
  19. - name: state
  20. description: Storage node State API
  21. paths:
  22. /files/{id}:
  23. get:
  24. operationId: publicApi.getFile
  25. description: Returns a media file.
  26. tags:
  27. - files
  28. parameters:
  29. - name: id
  30. required: true
  31. in: path
  32. description: Data object ID
  33. schema:
  34. type: string
  35. responses:
  36. 200:
  37. description: Ok
  38. content:
  39. video/*:
  40. schema:
  41. type: string
  42. format: binary
  43. audio/*:
  44. schema:
  45. type: string
  46. format: binary
  47. image/*:
  48. schema:
  49. type: string
  50. format: binary
  51. application/octet-stream:
  52. schema:
  53. type: string
  54. format: binary
  55. 400:
  56. description: Bad request
  57. content:
  58. application/json:
  59. schema:
  60. $ref: '#/components/schemas/ErrorResponse'
  61. 401:
  62. description: Unauthorized
  63. content:
  64. application/json:
  65. schema:
  66. $ref: '#/components/schemas/ErrorResponse'
  67. 404:
  68. description: File not found
  69. content:
  70. application/json:
  71. schema:
  72. $ref: '#/components/schemas/ErrorResponse'
  73. 500:
  74. description: Unknown server error
  75. head:
  76. operationId: publicApi.getFileHeaders
  77. description: Returns a media file headers.
  78. tags:
  79. - files
  80. parameters:
  81. - name: id
  82. required: true
  83. in: path
  84. description: Data object ID
  85. schema:
  86. type: string
  87. responses:
  88. 200:
  89. description: Ok
  90. 400:
  91. description: Bad request
  92. 404:
  93. description: File not found
  94. 500:
  95. description: Unknown server error
  96. /files:
  97. post:
  98. security:
  99. - UploadAuth: []
  100. description: Upload data
  101. operationId: publicApi.uploadFile
  102. tags:
  103. - files
  104. requestBody:
  105. content:
  106. multipart/form-data:
  107. schema:
  108. type: object
  109. required:
  110. - dataObjectId
  111. - storageBucketId
  112. - bagId
  113. properties:
  114. file:
  115. description: Data file
  116. type: string
  117. format: binary
  118. dataObjectId:
  119. description: Data object runtime ID
  120. type: string
  121. pattern: '^\d+$' #integer
  122. storageBucketId:
  123. description: Storage bucket ID
  124. type: string
  125. pattern: '^\d+$' #integer
  126. bagId:
  127. description: Bag ID
  128. type: string
  129. required: true
  130. responses:
  131. 201:
  132. description: Created
  133. content:
  134. application/json:
  135. schema:
  136. type: object
  137. properties:
  138. id:
  139. type: string
  140. 400:
  141. description: Bad request
  142. content:
  143. application/json:
  144. schema:
  145. $ref: '#/components/schemas/ErrorResponse'
  146. 401:
  147. description: Unauthorized
  148. /authToken:
  149. post:
  150. description: Get auth token from a server.
  151. operationId: publicApi.authTokenForUploading
  152. tags:
  153. - files
  154. requestBody:
  155. description: Token request parameters,
  156. content:
  157. application/json:
  158. schema:
  159. $ref: '#/components/schemas/TokenRequest'
  160. responses:
  161. 201:
  162. description: Created
  163. content:
  164. application/json:
  165. schema:
  166. type: object
  167. properties:
  168. token:
  169. type: string
  170. 400:
  171. description: Bad request
  172. content:
  173. application/json:
  174. schema:
  175. $ref: '#/components/schemas/ErrorResponse'
  176. 401:
  177. description: Unauthorized
  178. content:
  179. application/json:
  180. schema:
  181. $ref: '#/components/schemas/ErrorResponse'
  182. /state/data-objects:
  183. get:
  184. operationId: stateApi.getAllLocalDataObjects
  185. description: Returns all local data objects.
  186. tags:
  187. - state
  188. responses:
  189. 200:
  190. description: Ok
  191. content:
  192. application/json:
  193. schema:
  194. $ref: '#/components/schemas/DataObjectResponse'
  195. /state/bags/{bagId}/data-objects:
  196. get:
  197. operationId: stateApi.getLocalDataObjectsByBagId
  198. description: Returns local data objects for the bag.
  199. tags:
  200. - state
  201. parameters:
  202. - name: bagId
  203. required: true
  204. in: path
  205. description: Bag ID
  206. schema:
  207. type: string
  208. responses:
  209. 200:
  210. description: Ok
  211. content:
  212. application/json:
  213. schema:
  214. $ref: '#/components/schemas/DataObjectResponse'
  215. /version:
  216. get:
  217. operationId: stateApi.getVersion
  218. description: Returns server version.
  219. tags:
  220. - state
  221. responses:
  222. 200:
  223. description: Ok
  224. content:
  225. application/json:
  226. schema:
  227. $ref: '#/components/schemas/VersionResponse'
  228. /state/data:
  229. get:
  230. operationId: stateApi.getLocalDataStats
  231. description: Returns local uploading directory stats.
  232. tags:
  233. - state
  234. responses:
  235. 200:
  236. description: Ok
  237. content:
  238. application/json:
  239. schema:
  240. $ref: '#/components/schemas/DataStatsResponse'
  241. components:
  242. securitySchemes:
  243. UploadAuth:
  244. type: apiKey
  245. in: header
  246. name: x-api-key
  247. schemas:
  248. TokenRequest:
  249. type: object
  250. required:
  251. - data
  252. - signature
  253. properties:
  254. data:
  255. type: object
  256. required:
  257. - memberId
  258. - accountId
  259. - dataObjectId
  260. - storageBucketId
  261. - bagId
  262. properties:
  263. memberId:
  264. type: integer
  265. format: int64
  266. accountId:
  267. type: string
  268. dataObjectId:
  269. type: integer
  270. format: int64
  271. storageBucketId:
  272. type: integer
  273. format: int64
  274. bagId:
  275. type: string
  276. signature:
  277. type: string
  278. ErrorResponse:
  279. type: object
  280. required:
  281. - message
  282. properties:
  283. type:
  284. type: string
  285. message:
  286. type: string
  287. DataStatsResponse:
  288. type: object
  289. required:
  290. - totalSize
  291. - objectNumber
  292. properties:
  293. totalSize:
  294. type: integer
  295. format: int64
  296. objectNumber:
  297. type: integer
  298. format: int64
  299. tempDirSize:
  300. type: integer
  301. format: int64
  302. tempDownloads:
  303. type: integer
  304. format: int64
  305. VersionResponse:
  306. type: object
  307. required:
  308. - version
  309. properties:
  310. version:
  311. type: string
  312. userAgent:
  313. type: string
  314. DataObjectResponse:
  315. type: array
  316. items:
  317. type: string