public.yml 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  1. openapi: 3.0.3
  2. info:
  3. title: Distributor node public API
  4. description: Distributor node public API
  5. contact:
  6. email: info@joystream.org
  7. license:
  8. name: GPL-3.0-only
  9. url: https://spdx.org/licenses/GPL-3.0-only.html
  10. version: 0.1.0
  11. externalDocs:
  12. description: Distributor node public API
  13. url: https://github.com/Joystream/joystream/issues/2224
  14. servers:
  15. - url: http://localhost:3334/api/v1/
  16. paths:
  17. /status:
  18. get:
  19. operationId: public.status
  20. description: Returns json object describing current node status.
  21. responses:
  22. 200:
  23. description: OK
  24. content:
  25. application/json:
  26. schema:
  27. $ref: '#/components/schemas/StatusResponse'
  28. 500:
  29. description: Unexpected server error
  30. /buckets:
  31. get:
  32. operationId: public.buckets
  33. description: Returns list of distributed buckets
  34. responses:
  35. 200:
  36. description: OK
  37. content:
  38. application/json:
  39. schema:
  40. $ref: '#/components/schemas/BucketsResponse'
  41. 500:
  42. description: Unexpected server error
  43. /assets/{objectId}:
  44. head:
  45. operationId: public.assetHead
  46. description: Returns asset response headers (cache status, content type and/or length, accepted ranges etc.)
  47. parameters:
  48. - $ref: '#/components/parameters/ObjectId'
  49. responses:
  50. 200:
  51. description: Object is supported and should be send on GET request.
  52. headers:
  53. X-Cache:
  54. $ref: '#/components/headers/X-Cache'
  55. 421:
  56. description: Misdirected request. Data object not supported by the node.
  57. 404:
  58. description: Data object does not exist.
  59. 500:
  60. description: Unexpected server error
  61. get:
  62. operationId: public.asset
  63. description: Returns a media file.
  64. parameters:
  65. - $ref: '#/components/parameters/ObjectId'
  66. responses:
  67. 200:
  68. description: Full available object data sent
  69. headers:
  70. X-Cache:
  71. $ref: '#/components/headers/X-Cache'
  72. X-Data-Source:
  73. $ref: '#/components/headers/X-Data-Source'
  74. content:
  75. image/*:
  76. schema:
  77. type: string
  78. format: binary
  79. audio/*:
  80. schema:
  81. type: string
  82. format: binary
  83. video/*:
  84. schema:
  85. type: string
  86. format: binary
  87. 206:
  88. description: Requested partial object data sent
  89. headers:
  90. X-Cache:
  91. $ref: '#/components/headers/X-Cache'
  92. X-Data-Source:
  93. $ref: '#/components/headers/X-Data-Source'
  94. content:
  95. image/*:
  96. schema:
  97. type: string
  98. format: binary
  99. audio/*:
  100. schema:
  101. type: string
  102. format: binary
  103. video/*:
  104. schema:
  105. type: string
  106. format: binary
  107. 421:
  108. description: Misdirected request. Data object not supported.
  109. content:
  110. application/json:
  111. schema:
  112. $ref: '#/components/schemas/ErrorResponse'
  113. 404:
  114. description: Data object does not exist.
  115. content:
  116. application/json:
  117. schema:
  118. $ref: '#/components/schemas/ErrorResponse'
  119. 500:
  120. description: Unexpected server error
  121. components:
  122. parameters:
  123. ObjectId:
  124. name: objectId
  125. required: true
  126. in: path
  127. description: Data Object ID
  128. schema:
  129. type: string
  130. pattern: \d+
  131. headers:
  132. X-Cache:
  133. description: Describes cache status of an object.
  134. Hit - object is already fully fetched in distributor node's cache.
  135. Pending - object is still beeing fetched from the storage node.
  136. Miss - object is neither in cache not currently beeing fetched. Fetching from storage node may be triggered.
  137. schema:
  138. type: string
  139. enum: ['hit', 'pending', 'miss']
  140. X-Data-Source:
  141. description: Describes the source of data stream.
  142. External - the request was proxied to a storage node.
  143. Local - the data is streamed from local file.
  144. schema:
  145. type: string
  146. enum: ['external', 'local']
  147. schemas:
  148. ErrorResponse:
  149. type: object
  150. required:
  151. - message
  152. properties:
  153. type:
  154. type: string
  155. message:
  156. type: string
  157. StatusResponse:
  158. type: object
  159. required:
  160. - id
  161. - objectsInCache
  162. - storageLimit
  163. - storageUsed
  164. - uptime
  165. - downloadsInProgress
  166. properties:
  167. id:
  168. type: string
  169. objectsInCache:
  170. type: integer
  171. minimum: 0
  172. storageLimit:
  173. type: integer
  174. minimum: 0
  175. storageUsed:
  176. type: integer
  177. minimum: 0
  178. uptime:
  179. type: integer
  180. minimum: 0
  181. downloadsInProgress:
  182. type: integer
  183. minimum: 0
  184. BucketsResponse:
  185. oneOf:
  186. - type: object
  187. required:
  188. - 'bucketIds'
  189. properties:
  190. bucketIds:
  191. type: array
  192. items:
  193. type: string
  194. pattern: ^[0-9]+:[0-9]+$
  195. - type: object
  196. required:
  197. - 'allByWorkerId'
  198. properties:
  199. allByWorkerId:
  200. type: integer
  201. minimum: 0