Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- swagger: '2.0'
- info:
- description: |
- Service to find similar images.
- version: 1.0.0
- title: B-similar
- contact:
- email: ...
- # license:
- # name: Apache 2.0
- # url: http://www.apache.org/licenses/LICENSE-2.0.html
- tags:
- - name: product
- - name: B-similar
- paths:
- /product:
- post:
- tags:
- - product
- summary: Add product/image to images similarity database
- operationId: addProduct
- consumes:
- - application/json
- produces:
- - application/json
- parameters:
- - in: body
- name: body
- description: Image object
- required: true
- schema:
- $ref: '#/definitions/Product'
- responses:
- 200:
- $ref: "#/responses/Ok"
- 404:
- $ref: '#/responses/NotFound'
- 400:
- $ref: '#/responses/InvalidData'
- security:
- - api_key: []
- put:
- tags:
- - product
- 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
- parameters:
- - in: body
- name: body
- description: Product
- required: true
- schema:
- $ref: '#/definitions/Product'
- responses:
- 201:
- $ref: "#/responses/Ok"
- 404:
- $ref: '#/responses/NotFound'
- 400:
- $ref: '#/responses/InvalidData'
- security:
- - api_key: []
- /product/{productId}:
- get:
- tags:
- - product
- summary: Find product by ID
- operationId: getProductById
- produces:
- - application/json
- parameters:
- - name: productId
- in: path
- description: ID of product to return
- required: true
- type: integer
- format: int64
- responses:
- 200:
- $ref: '#/responses/ProductGet'
- 404:
- $ref: '#/responses/NotFound'
- 400:
- $ref: '#/responses/InvalidData'
- security:
- - api_key: []
- /image/{productId}:
- delete:
- tags:
- - product
- summary: Delete product/image or category
- operationId: deleteImage
- produces:
- - application/json
- parameters:
- - name: api_key
- in: header
- required: false
- type: string
- - name: productId
- in: path
- description: product id to delete
- required: true
- type: integer
- format: int64
- - name: categoryIds
- in: query
- description: list of categories, if empty, delete from all categories
- required: false
- type: array
- items:
- type: number
- responses:
- 204:
- $ref: '#/responses/Deleted'
- 404:
- $ref: '#/responses/NotFound'
- 400:
- $ref: '#/responses/InvalidData'
- security:
- - api_key: []
- /bsimilar/{productId}/{categoryIds}:
- get:
- tags:
- - B-similar
- summary: Find similar product ID's by product ID
- operationId: getSimilarProducts
- produces:
- - application/json
- parameters:
- - name: productId
- in: path
- description: ID of product to return
- required: true
- type: integer
- format: int64
- - name: categoryIds
- in: path
- description: list of categories - where to search
- required: true
- type: array
- items:
- type: number
- - name: limit
- in: query
- description: limit results 5-200 (default 100)
- required: false
- type: integer
- default: 100
- minimum: 5
- maximum: 200
- responses:
- 200:
- $ref: '#/responses/ProductResponseVector'
- 404:
- $ref: '#/responses/NotFound'
- 400:
- $ref: '#/responses/InvalidData'
- security:
- - api_key: []
- securityDefinitions:
- api_key:
- type: apiKey
- name: api_key
- in: header
- responses:
- InvalidData:
- description: invalid product ID format
- schema:
- $ref: "#/definitions/ApiResponse"
- examples:
- url:
- code: 400
- type: "error"
- message: "product ID has to be a number"
- NotFound:
- description: ProductID not found
- schema:
- $ref: "#/definitions/ApiResponse"
- examples:
- url:
- code: 404
- type: "not found"
- message: "product not found"
- Ok:
- description: Success response
- Deleted:
- description: Successfuly deleted
- Product:
- description: Success response
- schema:
- $ref: "#/definitions/Product"
- ProductGet:
- description: Success response
- schema:
- $ref: "#/definitions/ProductGet"
- ProductResponseVector:
- description: Success response
- schema:
- $ref: "#/definitions/ProductResponseVector"
- definitions:
- ProductResponseVector:
- type: object
- properties:
- productId:
- type: integer
- format: int64
- example: 1671417
- similarProducts:
- type: array
- items:
- type: object
- description: product object (contains productID and similarity score)
- example:
- - productId: 30558953
- score: 0.015
- - productId: 36315925
- score: 0.035
- - productId: 36315919
- score: 0.15
- - productId: 36315917
- score: 0.16
- - productId: 35975493
- score: 0.38
- ProductGet:
- type: object
- properties:
- productId:
- type: integer
- format: int64
- example: 1671417
- categories:
- type: array
- items:
- format: number
- example: [25, 50, 1250, 11120]
- images:
- type: array
- items:
- type: string
- description: image names (hashes)
- example:
- - 19b91b72670e6c4c3f1d4d6ff6f597869605b738.jpg
- - 2893433b9f4e6f9fe7b653959878ce8ad6f05af3.jpg
- - b87ad2df8ce651542a78ca6b49cb48eb94366b75.jpg
- vectorized:
- type: boolean
- description: vectorization flag
- example: true
- Product:
- type: object
- properties:
- productId:
- type: integer
- format: int64
- example: 1671417
- categories:
- type: array
- items:
- format: number
- example: [25, 50, 1250, 11120]
- images:
- type: array
- items:
- description: full url to images
- format: string
- description: valid image path's - from this path is image downloaded and used for vectorization
- example:
- - https://static.biano.cz/i/product/1020-1020/93/8a/dd/19b91b72670e6c4c3f1d4d6ff6f597869605b738.jpg
- - https://static.biano.cz/i/product/1020-1020/22/7b/cc/2893433b9f4e6f9fe7b653959878ce8ad6f05af3.jpg
- - https://static.biano.cz/i/product/1020-1020/04/15/8a/b87ad2df8ce651542a78ca6b49cb48eb94366b75.jpg
- ApiResponse:
- type: object
- properties:
- code:
- type: integer
- format: int32
- type:
- type: string
- message:
- type: string
- # Added by API Auto Mocking Plugin
- host: virtserver.swaggerhub.com
- basePath: /BSimilar/1.0
- # Added by API Auto Mocking Plugin
- schemes:
- - https
- - http
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement