PRIMIS Product API

Product API

OpenAPI Specification

primis-product-api-openapi.yml Raw ↑
openapi: 3.0.0
info:
  title: REST Auth Product API
  version: 1.1.0
  description: Primis API docs
servers:
- url: https://api.primis.cx
  description: Production server
- url: https://api.qa.primis.cx
  description: QA Server
tags:
- name: Product
  description: Product API
paths:
  /products:
    post:
      tags:
      - Product
      summary: Create new product
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Product'
      responses:
        '200':
          description: Ok
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Product'
        '500':
          description: Server Error
  /products/{id}:
    get:
      tags:
      - Product
      summary: Get product
      parameters:
      - in: path
        name: id
        schema:
          type: string
        required: true
        description: Id of the product
      responses:
        '200':
          description: Ok
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Product'
        '500':
          description: Server Error
    put:
      tags:
      - Product
      summary: Update a product
      parameters:
      - in: path
        name: id
        schema:
          type: string
        required: true
        description: Id of the product
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Product'
      responses:
        '200':
          description: Ok
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Product'
        '500':
          description: Server Error
    delete:
      tags:
      - Product
      summary: Delete product
      parameters:
      - in: path
        name: id
        schema:
          type: string
        required: true
        description: Id of the product
      responses:
        '200':
          description: Ok
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Product'
        '500':
          description: Server Error
  /products/image:
    put:
      tags:
      - Product
      summary: Get product
      parameters:
      - in: path
        name: id
        schema:
          type: string
        required: true
        description: Id of the product
      responses:
        '200':
          description: Ok
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Product'
        '500':
          description: Server Error
components:
  schemas:
    ProductVariant:
      properties:
        id:
          title: ProductVariant.id
          type: string
        imageUrl:
          title: ProductVariant.imageUrl
          type: string
        title:
          title: ProductVariant.title
          type: string
      required:
      - id
      - imageUrl
      - title
      additionalProperties: false
      title: ProductVariant
      type: object
    ProductColor:
      properties:
        name:
          title: ProductColor.name
          type: string
        value:
          title: ProductColor.value
          type: string
      required:
      - name
      - value
      additionalProperties: false
      title: ProductColor
      type: object
    Product:
      properties:
        _id:
          title: Product._id
          type: string
        retailerId:
          title: Product.retailerId
          type: string
        externalProductId:
          title: Product.externalProductId
          type: string
        status:
          type: string
          enum:
          - draft
          - published
          - deleted
          title: Product.status
        name:
          title: Product.name
          type: string
        description:
          title: Product.description
          type: string
        imageUrl:
          title: Product.imageUrl
          type: string
        colors:
          items:
            $ref: '#/components/schemas/ProductColor'
            title: Product.colors.[]
          title: Product.colors
          type: array
        hyperlink:
          title: Product.hyperlink
          type: string
        variants:
          items:
            $ref: '#/components/schemas/ProductVariant'
            title: Product.variants.[]
          title: Product.variants
          type: array
      required:
      - retailerId
      - status
      - name
      - imageUrl
      - hyperlink
      additionalProperties: false
      title: Product
      type: object
  securitySchemes:
    bearerAuth:
      type: https
      scheme: bearer
      bearerFormat: JWT