openapi.yaml 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280
  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: filesApi.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: filesApi.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. description: Upload data
  99. operationId: filesApi.uploadFile
  100. tags:
  101. - files
  102. requestBody:
  103. content:
  104. multipart/form-data:
  105. schema:
  106. type: object
  107. required:
  108. - dataObjectId
  109. - storageBucketId
  110. - bagId
  111. properties:
  112. file:
  113. description: Data file
  114. type: string
  115. format: binary
  116. dataObjectId:
  117. description: Data object runtime ID
  118. type: string
  119. pattern: '^\d+$' #integer
  120. storageBucketId:
  121. description: Storage bucket ID
  122. type: string
  123. pattern: '^\d+$' #integer
  124. bagId:
  125. description: Bag ID
  126. type: string
  127. required: true
  128. responses:
  129. 201:
  130. description: Created
  131. content:
  132. application/json:
  133. schema:
  134. type: object
  135. properties:
  136. id:
  137. type: string
  138. 400:
  139. description: Bad request
  140. content:
  141. application/json:
  142. schema:
  143. $ref: '#/components/schemas/ErrorResponse'
  144. /state/data-objects:
  145. get:
  146. operationId: stateApi.getAllLocalDataObjects
  147. description: Returns all local data objects.
  148. tags:
  149. - state
  150. responses:
  151. 200:
  152. description: Ok
  153. content:
  154. application/json:
  155. schema:
  156. $ref: '#/components/schemas/DataObjectResponse'
  157. /state/bags/{bagId}/data-objects:
  158. get:
  159. operationId: stateApi.getLocalDataObjectsByBagId
  160. description: Returns local data objects for the bag.
  161. tags:
  162. - state
  163. parameters:
  164. - name: bagId
  165. required: true
  166. in: path
  167. description: Bag ID
  168. schema:
  169. type: string
  170. responses:
  171. 200:
  172. description: Ok
  173. content:
  174. application/json:
  175. schema:
  176. $ref: '#/components/schemas/DataObjectResponse'
  177. /version:
  178. get:
  179. operationId: stateApi.getVersion
  180. description: Returns server version.
  181. tags:
  182. - state
  183. responses:
  184. 200:
  185. description: Ok
  186. content:
  187. application/json:
  188. schema:
  189. $ref: '#/components/schemas/VersionResponse'
  190. /state/data:
  191. get:
  192. operationId: stateApi.getLocalDataStats
  193. description: Returns local uploading directory stats.
  194. tags:
  195. - state
  196. responses:
  197. 200:
  198. description: Ok
  199. content:
  200. application/json:
  201. schema:
  202. $ref: '#/components/schemas/DataStatsResponse'
  203. components:
  204. schemas:
  205. TokenRequest:
  206. type: object
  207. required:
  208. - data
  209. - signature
  210. properties:
  211. data:
  212. type: object
  213. required:
  214. - memberId
  215. - accountId
  216. - dataObjectId
  217. - storageBucketId
  218. - bagId
  219. properties:
  220. memberId:
  221. type: integer
  222. format: int64
  223. accountId:
  224. type: string
  225. dataObjectId:
  226. type: integer
  227. format: int64
  228. storageBucketId:
  229. type: integer
  230. format: int64
  231. bagId:
  232. type: string
  233. signature:
  234. type: string
  235. ErrorResponse:
  236. type: object
  237. required:
  238. - message
  239. properties:
  240. type:
  241. type: string
  242. message:
  243. type: string
  244. DataStatsResponse:
  245. type: object
  246. required:
  247. - totalSize
  248. - objectNumber
  249. properties:
  250. totalSize:
  251. type: integer
  252. format: int64
  253. objectNumber:
  254. type: integer
  255. format: int64
  256. tempDirSize:
  257. type: integer
  258. format: int64
  259. tempDownloads:
  260. type: integer
  261. format: int64
  262. VersionResponse:
  263. type: object
  264. required:
  265. - version
  266. properties:
  267. version:
  268. type: string
  269. userAgent:
  270. type: string
  271. DataObjectResponse:
  272. type: array
  273. items:
  274. type: string