Binarly Product API

The Product API from Binarly — 4 operation(s) for product.

OpenAPI Specification

binarly-product-api-openapi.yml Raw ↑
openapi: 3.0.3
info:
  title: Binarly Assistant Product API
  version: 4.275.2
security:
- auth: []
tags:
- name: Product
paths:
  /api/v4/products:
    get:
      summary: List Products
      operationId: ListProducts
      x-permission: ''
      x-pass-resource-ids:
        resourceType: Product
        permission: products.view
      tags:
      - Product
      responses:
        '200':
          description: success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Products'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '500':
          $ref: '#/components/responses/InternalServerError'
        '502':
          $ref: '#/components/responses/BadGateway'
    post:
      summary: Create Product
      operationId: CreateProduct
      x-permission: products.create
      tags:
      - Product
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateProductPayload'
      responses:
        '201':
          description: success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Product'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '409':
          $ref: '#/components/responses/Conflict'
        '500':
          $ref: '#/components/responses/InternalServerError'
        '502':
          $ref: '#/components/responses/BadGateway'
  /api/v4/products:bulkArchive:
    post:
      summary: Bulk Archive Products
      operationId: BulkArchiveProducts
      x-permission: products.archive
      x-resource-id-source: bulk-ids
      tags:
      - Product
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/BulkIds'
      responses:
        '200':
          description: success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BulkIds'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '500':
          $ref: '#/components/responses/InternalServerError'
  /api/v4/products:bulkUnarchive:
    post:
      summary: Bulk Unarchive Products
      operationId: BulkUnarchiveProducts
      x-permission: products.archive
      x-resource-id-source: bulk-ids
      tags:
      - Product
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/BulkIds'
      responses:
        '200':
          description: success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BulkIds'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '500':
          $ref: '#/components/responses/InternalServerError'
  /api/v4/products/{productId}:
    get:
      summary: Get Product by ID
      operationId: GetProduct
      x-permission: products.view
      tags:
      - Product
      parameters:
      - $ref: '#/components/parameters/PathProductId'
      responses:
        '200':
          description: success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Product'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '500':
          $ref: '#/components/responses/InternalServerError'
        '502':
          $ref: '#/components/responses/BadGateway'
    patch:
      summary: Update Product by ID
      operationId: UpdateProduct
      x-permission: products.update
      tags:
      - Product
      parameters:
      - $ref: '#/components/parameters/PathProductId'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateProductPayload'
      responses:
        '200':
          description: success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Product'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          $ref: '#/components/responses/Conflict'
        '500':
          $ref: '#/components/responses/InternalServerError'
components:
  responses:
    Forbidden:
      description: Forbidden
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ForbiddenErrorResponse'
    NotFound:
      description: Not Found
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    Conflict:
      description: Conflict
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    Unauthorized:
      description: Unauthorized
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    BadRequest:
      description: Bad request
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    BadGateway:
      description: Bad Gateway
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    InternalServerError:
      description: Internal server error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
  schemas:
    WithOptionalResourceType:
      type: object
      properties:
        resourceType:
          $ref: '#/components/schemas/ResourceType'
    WithOptionalName:
      type: object
      properties:
        name:
          type: string
    WithOptionalParent:
      type: object
      properties:
        parent:
          $ref: '#/components/schemas/Parent'
    WithProducts:
      type: object
      required:
      - products
      properties:
        products:
          type: array
          items:
            $ref: '#/components/schemas/Product'
    ErrorDetail:
      type: object
      required:
      - error
      properties:
        reason:
          type: string
          x-go-type-skip-optional-pointer: true
        field:
          type: string
          x-go-type-skip-optional-pointer: true
        service:
          type: string
          x-go-type-skip-optional-pointer: true
    User:
      readOnly: true
      allOf:
      - $ref: '#/components/schemas/WithUserId'
      - $ref: '#/components/schemas/WithOptionalId'
      - $ref: '#/components/schemas/WithOptionalCreateTime'
      - $ref: '#/components/schemas/WithOptionalEmail'
      - $ref: '#/components/schemas/WithOptionalUserStatus'
      - $ref: '#/components/schemas/WithOptionalResourceType'
    WithAuthor:
      type: object
      required:
      - author
      properties:
        author:
          $ref: '#/components/schemas/User'
    WithIds:
      type: object
      required:
      - ids
      properties:
        ids:
          type: array
          items:
            $ref: '#/components/schemas/ULID'
    CreateProductPayload:
      type: object
      allOf:
      - $ref: '#/components/schemas/WithName'
      - $ref: '#/components/schemas/WithOptionalDescription'
    WithOptionalId:
      type: object
      properties:
        id:
          readOnly: true
          allOf:
          - $ref: '#/components/schemas/ULID'
    WithOptionalEmail:
      type: object
      properties:
        email:
          type: string
          example: user@binarly.io
    Product:
      allOf:
      - $ref: '#/components/schemas/WithId'
      - $ref: '#/components/schemas/WithName'
      - $ref: '#/components/schemas/WithOptionalParent'
      - $ref: '#/components/schemas/WithOptionalDescription'
      - $ref: '#/components/schemas/WithCreateTime'
      - $ref: '#/components/schemas/WithAuthor'
    WithOptionalUserStatus:
      type: object
      properties:
        status:
          type: string
          x-go-type: string
          enum:
          - active
          - archived
    UpdateProductPayload:
      type: object
      allOf:
      - $ref: '#/components/schemas/WithOptionalName'
      - $ref: '#/components/schemas/WithOptionalDescription'
    ForbiddenErrorResponse:
      type: object
      required:
      - message
      - permission
      - resourceName
      properties:
        message:
          type: string
        permission:
          type: string
        resourceName:
          type: string
        details:
          type: array
          items:
            $ref: '#/components/schemas/ErrorDetail'
    WithName:
      type: object
      required:
      - name
      properties:
        name:
          type: string
    ResourceType:
      type: string
      enum:
      - Org
      - Group
      - Product
      - User
      - Image
      - Finding
      - Occurrence
    BulkIds:
      $ref: '#/components/schemas/WithIds'
    ErrorResponse:
      required:
      - message
      type: object
      properties:
        message:
          type: string
          readOnly: true
          x-go-type-skip-optional-pointer: true
        details:
          type: array
          items:
            $ref: '#/components/schemas/ErrorDetail'
    ULID:
      type: string
      format: ulid
      minLength: 26
      maxLength: 26
      example: 01ARZ3NDEKTSV4RRFFQ69G5FAV
      x-go-type: ulid.ULID
      x-go-type-import:
        path: github.com/oklog/ulid/v2
    WithId:
      type: object
      required:
      - id
      properties:
        id:
          readOnly: true
          allOf:
          - $ref: '#/components/schemas/ULID'
    Parent:
      type: string
      format: path
      description: URI path (path-noscheme) without the leading /
      readOnly: true
      x-go-type: string
      x-go-type-skip-optional-pointer: true
    WithCreateTime:
      type: object
      required:
      - createTime
      properties:
        createTime:
          type: string
          readOnly: true
          example: '2024-01-01T01:00:00Z'
    WithOptionalDescription:
      type: object
      properties:
        description:
          type: string
    Products:
      $ref: '#/components/schemas/WithProducts'
    WithOptionalCreateTime:
      type: object
      properties:
        createTime:
          type: string
          readOnly: true
          example: '2024-01-01T01:00:00Z'
    WithUserId:
      type: object
      required:
      - userId
      properties:
        userId:
          type: string
          readOnly: true
          x-go-type-skip-optional-pointer: true
  parameters:
    PathProductId:
      name: productId
      in: path
      description: Product ID
      required: true
      schema:
        $ref: '#/components/schemas/ULID'
  securitySchemes:
    auth:
      type: http
      scheme: bearer
      bearerFormat: JWT