Advertisement
Guest User

Untitled

a guest
Jan 18th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.34 KB | None | 0 0
  1. swagger: '2.0'
  2. info:
  3. description: |
  4. Service to find similar images.
  5. version: 1.0.0
  6. title: B-similar
  7. contact:
  8. email: ...
  9. # license:
  10. # name: Apache 2.0
  11. # url: http://www.apache.org/licenses/LICENSE-2.0.html
  12. tags:
  13. - name: product
  14. - name: B-similar
  15. paths:
  16. /product:
  17. post:
  18. tags:
  19. - product
  20. summary: Add product/image to images similarity database
  21. operationId: addProduct
  22. consumes:
  23. - application/json
  24. produces:
  25. - application/json
  26. parameters:
  27. - in: body
  28. name: body
  29. description: Image object
  30. required: true
  31. schema:
  32. $ref: '#/definitions/Product'
  33. responses:
  34. 200:
  35. $ref: "#/responses/Ok"
  36. 404:
  37. $ref: '#/responses/NotFound'
  38. 400:
  39. $ref: '#/responses/InvalidData'
  40. security:
  41. - api_key: []
  42. put:
  43. tags:
  44. - product
  45. description: in "categories" key, should be all active categories, image will be revectorized for listed categories. If an image will be in some category which won't be listed in put categories, image will be removed from this category
  46. parameters:
  47. - in: body
  48. name: body
  49. description: Product
  50. required: true
  51. schema:
  52. $ref: '#/definitions/Product'
  53. responses:
  54. 201:
  55. $ref: "#/responses/Ok"
  56. 404:
  57. $ref: '#/responses/NotFound'
  58. 400:
  59. $ref: '#/responses/InvalidData'
  60. security:
  61. - api_key: []
  62. /product/{productId}:
  63. get:
  64. tags:
  65. - product
  66. summary: Find product by ID
  67. operationId: getProductById
  68. produces:
  69. - application/json
  70. parameters:
  71. - name: productId
  72. in: path
  73. description: ID of product to return
  74. required: true
  75. type: integer
  76. format: int64
  77. responses:
  78. 200:
  79. $ref: '#/responses/ProductGet'
  80. 404:
  81. $ref: '#/responses/NotFound'
  82. 400:
  83. $ref: '#/responses/InvalidData'
  84. security:
  85. - api_key: []
  86. /image/{productId}:
  87. delete:
  88. tags:
  89. - product
  90. summary: Delete product/image or category
  91. operationId: deleteImage
  92. produces:
  93. - application/json
  94. parameters:
  95. - name: api_key
  96. in: header
  97. required: false
  98. type: string
  99. - name: productId
  100. in: path
  101. description: product id to delete
  102. required: true
  103. type: integer
  104. format: int64
  105. - name: categoryIds
  106. in: query
  107. description: list of categories, if empty, delete from all categories
  108. required: false
  109. type: array
  110. items:
  111. type: number
  112. responses:
  113. 204:
  114. $ref: '#/responses/Deleted'
  115. 404:
  116. $ref: '#/responses/NotFound'
  117. 400:
  118. $ref: '#/responses/InvalidData'
  119. security:
  120. - api_key: []
  121. /bsimilar/{productId}/{categoryIds}:
  122. get:
  123. tags:
  124. - B-similar
  125. summary: Find similar product ID's by product ID
  126. operationId: getSimilarProducts
  127. produces:
  128. - application/json
  129. parameters:
  130. - name: productId
  131. in: path
  132. description: ID of product to return
  133. required: true
  134. type: integer
  135. format: int64
  136. - name: categoryIds
  137. in: path
  138. description: list of categories - where to search
  139. required: true
  140. type: array
  141. items:
  142. type: number
  143. - name: limit
  144. in: query
  145. description: limit results 5-200 (default 100)
  146. required: false
  147. type: integer
  148. default: 100
  149. minimum: 5
  150. maximum: 200
  151. responses:
  152. 200:
  153. $ref: '#/responses/ProductResponseVector'
  154. 404:
  155. $ref: '#/responses/NotFound'
  156. 400:
  157. $ref: '#/responses/InvalidData'
  158. security:
  159. - api_key: []
  160. securityDefinitions:
  161. api_key:
  162. type: apiKey
  163. name: api_key
  164. in: header
  165. responses:
  166. InvalidData:
  167. description: invalid product ID format
  168. schema:
  169. $ref: "#/definitions/ApiResponse"
  170. examples:
  171. url:
  172. code: 400
  173. type: "error"
  174. message: "product ID has to be a number"
  175. NotFound:
  176. description: ProductID not found
  177. schema:
  178. $ref: "#/definitions/ApiResponse"
  179. examples:
  180. url:
  181. code: 404
  182. type: "not found"
  183. message: "product not found"
  184. Ok:
  185. description: Success response
  186. Deleted:
  187. description: Successfuly deleted
  188. Product:
  189. description: Success response
  190. schema:
  191. $ref: "#/definitions/Product"
  192. ProductGet:
  193. description: Success response
  194. schema:
  195. $ref: "#/definitions/ProductGet"
  196. ProductResponseVector:
  197. description: Success response
  198. schema:
  199. $ref: "#/definitions/ProductResponseVector"
  200. definitions:
  201. ProductResponseVector:
  202. type: object
  203. properties:
  204. productId:
  205. type: integer
  206. format: int64
  207. example: 1671417
  208. similarProducts:
  209. type: array
  210. items:
  211. type: object
  212. description: product object (contains productID and similarity score)
  213. example:
  214. - productId: 30558953
  215. score: 0.015
  216. - productId: 36315925
  217. score: 0.035
  218. - productId: 36315919
  219. score: 0.15
  220. - productId: 36315917
  221. score: 0.16
  222. - productId: 35975493
  223. score: 0.38
  224. ProductGet:
  225. type: object
  226. properties:
  227. productId:
  228. type: integer
  229. format: int64
  230. example: 1671417
  231. categories:
  232. type: array
  233. items:
  234. format: number
  235. example: [25, 50, 1250, 11120]
  236. images:
  237. type: array
  238. items:
  239. type: string
  240. description: image names (hashes)
  241. example:
  242. - 19b91b72670e6c4c3f1d4d6ff6f597869605b738.jpg
  243. - 2893433b9f4e6f9fe7b653959878ce8ad6f05af3.jpg
  244. - b87ad2df8ce651542a78ca6b49cb48eb94366b75.jpg
  245. vectorized:
  246. type: boolean
  247. description: vectorization flag
  248. example: true
  249. Product:
  250. type: object
  251. properties:
  252. productId:
  253. type: integer
  254. format: int64
  255. example: 1671417
  256. categories:
  257. type: array
  258. items:
  259. format: number
  260. example: [25, 50, 1250, 11120]
  261. images:
  262. type: array
  263. items:
  264. description: full url to images
  265. format: string
  266. description: valid image path's - from this path is image downloaded and used for vectorization
  267. example:
  268. - https://static.biano.cz/i/product/1020-1020/93/8a/dd/19b91b72670e6c4c3f1d4d6ff6f597869605b738.jpg
  269. - https://static.biano.cz/i/product/1020-1020/22/7b/cc/2893433b9f4e6f9fe7b653959878ce8ad6f05af3.jpg
  270. - https://static.biano.cz/i/product/1020-1020/04/15/8a/b87ad2df8ce651542a78ca6b49cb48eb94366b75.jpg
  271. ApiResponse:
  272. type: object
  273. properties:
  274. code:
  275. type: integer
  276. format: int32
  277. type:
  278. type: string
  279. message:
  280. type: string
  281. # Added by API Auto Mocking Plugin
  282. host: virtserver.swaggerhub.com
  283. basePath: /BSimilar/1.0
  284. # Added by API Auto Mocking Plugin
  285. schemes:
  286. - https
  287. - http
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement