openapi: 3.0.0
info:
  title: VisibilityIQ Device Management
  version: 1.0.2
servers:
  - url: https://api.zebra.com/v3/services/partners
    description: For US
  - url: https://api.zebra.com/v3/eu/services/partners
    description: For EU
security:
  - BearerAuth: []
  - ApiKeyAuth: []
paths:
  /devices/enroll:
    post:
      tags:
        - Device Enrollment
      summary: Enroll the devices
      description: Enroll new device in VIQ by providing company name and asset details.
      operationId: Device Enroll
      parameters:
        - name: companyName
          in: header
          description: Company name
          required: true
          style: simple
          explode: false
          schema:
            type: string
      requestBody:
        $ref: "#/components/requestBodies/assetDetails"
      responses:
        "201":
          description: Successful operation
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ApiResponseEnroll"
        "400":
          description: Bad request
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ApiResponse400"
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ApiResponse401"
        "500":
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ApiResponse500"
      deprecated: false
  /devices/unenroll:
    post:
      tags:
        - Device Unenrollment
      summary: Unenroll the devices
      description: Unenroll the devices from VIQ
      operationId: Device Unenroll
      parameters:
        - name: companyName
          in: header
          description: Company name
          required: true
          style: simple
          explode: false
          schema:
            type: string
      requestBody:
        $ref: "#/components/requestBodies/assetInfo"
      responses:
        "201":
          description: Successfull operation
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ApiResponseUnEnroll"
        "400":
          description: Bad request
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ApiResponse400"
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ApiResponse401"
        "500":
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ApiResponse500"
      deprecated: false
  /devices/enrollmentstatus:
    post:
      tags:
        - Device Enrollment Status
      summary:
        Get the status of device enrollment by providing company name and assets
        detail.
      description: Check device enrollment status in VIQ
      operationId: Enrollment Status
      parameters:
        - name: companyName
          in: header
          description: Company name
          required: true
          style: simple
          explode: false
          schema:
            type: string
      requestBody:
        $ref: "#/components/requestBodies/assetsInfo"
      responses:
        "201":
          description: Successfull operation
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ApiResponseEnrollmentStatus"
        "400":
          description: Bad request
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ApiResponse400"
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ApiResponse401"
        "500":
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ApiResponse500"
      deprecated: false
  /devices/monthly-average-devices:
    get:
      tags:
        - Monthly Average Devices
      summary:
        Get the monthly average devices count for a given company name and
        date range.
      description: Get the monthly average devices count.
      operationId: Monthly Average Devices
      parameters:
        - name: companyName
          in: header
          description: Company name
          required: true
          style: simple
          explode: false
          schema:
            type: string
        - name: deviceType
          in: header
          description: Device Type - If no value is selected, by default all 3 are considered.
          required: false
          style: simple
          explode: false
          schema:
            type: string
            enum:
              - MOBILE
              - PRINTER
              - SCANNER
        - name: startMonth
          in: header
          description: Start Month (MM-yyyy)
          required: true
          style: simple
          explode: false
          schema:
            type: string
          example: 06-2023
        - name: endMonth
          in: header
          description: End Month (MM-yyyy)
          required: true
          style: simple
          explode: false
          schema:
            type: string
          example: 07-2023
      responses:
        "200":
          description: Successfull operation
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ApiResponseMonthlyAverageDevice"
        "400":
          description: Bad request
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ApiResponse400"
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ApiResponse401"
        "500":
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ApiResponse500"
      deprecated: false
components:
  schemas:
    ApiResponseEnroll:
      required:
        - response_description
        - response_status
      type: object
      properties:
        response_status:
          type: string
          description: response_status
          example: success/failure
        response_description:
          type: string
          description: response_description
          example:
            "Total assets requested for enrollment: 2, Total failed assets
            : 0, Total enrolled assets : 2"
        event_time:
          type: string
          description: event_time
          example: 2023-01-03 12:10:00
        company_name:
          type: string
          description: company_name
          example: TestCompany
        failed_assets:
          type: array
          description: Assets which does not match the enrollment criteria.
          items:
            type: object
            properties:
              serial_number:
                type: string
                example: "123456788"
              model:
                type: string
                example: TCXXX
              reason:
                type: string
                example: invalid serial number
    ApiResponseUnEnroll:
      required:
        - response_description
        - response_status
      type: object
      properties:
        response_status:
          type: string
          description: response_status
          example: success/failure
        response_description:
          type: string
          description: response_description
          example:
            "Total assets requested for unenrollment: 2, Total failed assets
            : 0, Total unenrolled assets : 2"
        event_time:
          type: string
          description: event_time
          example: 2023-01-03 12:10:00
        company_name:
          type: string
          description: company_name
          example: TestCompany
        failed_assets:
          type: array
          description: Assets which does not match the unenrollment criteria.
          items:
            type: object
            properties:
              serial_number:
                type: string
                example: "123456788"
              model:
                type: string
                example: TCXXX
              reason:
                type: string
                example: invalid serial number
    ApiResponse400:
      required:
        - response_description
        - response_status
      type: object
      properties:
        id:
          type: string
          description: id
          example: "123"
        status:
          type: integer
          description: status
          example: 400
        code:
          type: string
          description: code
          example: 1.2.1
        title:
          type: string
          description: title
          example: "ERROR: Bad Request"
        detail:
          type: string
          description: detail
          example: Required parameter missing
        source:
          type: object
          properties:
            parameter:
              type: string
              example: companyName
            pointer:
              type: string
              example: header/companyName
          description: source
    ApiResponse401:
      required:
        - response_description
        - response_status
      type: object
      properties:
        fault:
          type: object
          properties:
            faultstring:
              type: string
              example: Invalid ApiKey
            detail:
              type: object
              properties:
                errorcode:
                  type: string
                  example: oauth.v2.InvalidApiKey
              description: detail
          description: source
    ApiResponse500:
      required:
        - response_description
        - response_status
      type: object
      properties:
        timestamp:
          type: string
          description: timestamp
          example: 2023-01-03T12:10:00
        status:
          type: integer
          description: status
          example: 500
        error:
          type: string
          description: error
          example: Internal Server Error
        path:
          type: string
          description: detail
          example: /partners/devices
    ApiResponseEnrollmentStatus:
      required:
        - response_description
        - response_status
      type: object
      properties:
        event_time:
          type: string
          description: event_time
          example: 2023-01-03 12:10:00
        company_name:
          type: string
          description: company_name
          example: test
        assets:
          type: array
          description: Provide the assets enrollment status
          items:
            type: object
            properties:
              serial_number:
                type: string
                example: "123456788"
              model:
                type: string
                example: TCXXX
              status:
                type: string
                example: enrolled queued for enrollment validation
              status_date:
                type: string
                example: 2023-01-03 12:12:12
    ApiResponseMonthlyAverageDevice:
      required:
        - customer -partnerName -companyName -companyDisplayName
        - message
      type: object
      properties:
        companyName:
          type: string
          description: Company Name
          example: Test Company
        deviceType:
          type: string
          description: Device Type
          example: '["MOBILE","PRINTER","SCANNER"]'
        monthlyAverageDeviceCount:
          type: array
          example:
            - monthYear: 06-2023
              count: 10
            - monthYear: 07-2023
              count: 10
          items:
            type: string
    ApiError:
      required:
        - data
        - status
      type: object
      properties:
        data:
          type: string
          example: request unsuccessfull
        status:
          type: string
          example: failed
    ApiErrorN:
      required:
        - detail
        - status
      type: object
      properties:
        detail:
          type: string
          example: INTERNAL SERVER ERROR
        status:
          type: string
          example: "500"
    ApiErrorForbidden:
      required:
        - code
        - detail
        - id
        - status
        - title
      type: object
      properties:
        detail:
          type: string
          example: User does not have access to company-partner data
        status:
          type: string
          example: "403"
        code:
          type: string
          example: 1.1.5
        id:
          type: string
          example: adf131j123
  responses:
    Response400:
      description: Bad request
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/ApiError"
    Response401:
      description: Unauthorized
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/ApiError"
    Response500:
      description: Internal server error
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/ApiErrorN"
  parameters:
    companyName:
      name: companyName
      in: header
      description: Company name
      required: true
      style: simple
      explode: false
      schema:
        type: string
    deviceType:
      name: deviceType
      in: header
      description: Device Type - If no value is selected, by default all 3 are considered.
      required: false
      style: simple
      explode: false
      schema:
        type: string
        enum:
          - MOBILE
          - PRINTER
          - SCANNER
    startMonth:
      name: startMonth
      in: header
      description: Start Month (MM-yyyy)
      required: true
      style: simple
      explode: false
      schema:
        type: string
      example: 06-2023
    endMonth:
      name: endMonth
      in: header
      description: End Month (MM-yyyy)
      required: true
      style: simple
      explode: false
      schema:
        type: string
      example: 07-2023
  requestBodies:
    assetDetails:
      description: Device Enroll
      content:
        application/json:
          schema:
            type: object
            properties:
              assets:
                type: array
                items:
                  type: object
                  properties:
                    serial_number:
                      pattern: ^[a-zA-Z0-9]*$
                      type: string
                      description: Device Serial Number
                      nullable: false
                      example: "123456788"
                    model:
                      pattern: ^[a-zA-Z0-9]*$
                      type: string
                      description: Device Model
                      nullable: false
                      example: TCXXX
                    site_name:
                      type: string
                      description: Site name assigned for the device
                      nullable: true
                      example: test_site8
                    device_type:
                      type: string
                      description: Device Type
                      nullable: false
                      example: Mobile Computer
                      enum:
                        - Mobile Computer
                        - Printer
                        - Scanner
                    device_manufacturer:
                      type: string
                      description: Device Manufacturer
                      nullable: false
                      example: Panasonic
                      enum:
                        - Zebra
                        - Honeywell
                        - Panasonic
                    contract_id:
                      pattern: ^[a-zA-Z0-9-]*$
                      type: string
                      description: Valid Zebra Contract Id for the device
                      nullable: true
                      example: Contract-1234
              event_id:
                type: string
                description: Unique Id for the event(UUID).
                nullable: false
                example: acsad35d114
              event_time:
                type: string
                description:
                  Time when the enroll request comes. It cannot be less
                  than UTC {{current_date_time}}-1hour
                nullable: false
                example: 2023-01-03 12:10:00
      required: true
    assetInfo:
      description: Asset information for unenrollment
      content:
        application/json:
          schema:
            type: object
            properties:
              assets:
                type: array
                items:
                  type: object
                  properties:
                    serial_number:
                      pattern: ^[a-zA-Z0-9]*$
                      type: string
                      description: Device Serial Number
                      nullable: false
                      example: "123456788"
                    model:
                      pattern: ^[a-zA-Z0-9]*$
                      type: string
                      description: Device Model
                      nullable: false
                      example: TCXXX
                    contract_id:
                      pattern: ^[a-zA-Z0-9-]*$
                      type: string
                      description: Valid Zebra Contract Id for the device
                      nullable: true
                      example: Contract-1234
              event_id:
                type: string
                description: Unique Id for the event(UUID).
                nullable: false
                example: acsad35d114
              event_time:
                type: string
                description:
                  Time when the unenroll request comes. It cannot be less
                  than UTC {{current_date_time}}-1hour
                nullable: false
                example: 2023-01-03 12:10:00
      required: true
    assetsInfo:
      description: List of assets
      content:
        application/json:
          schema:
            type: object
            properties:
              serial_number:
                type: array
                description: Device Serial Number
                nullable: true
                items:
                  type: string
                  example: '["123456","789456"]'
              event_id:
                type: string
                description: Searh with unique Id for the event(UUID)
                nullable: false
                example: acsad35d114
              event_time:
                type: string
                description:
                  Search Time when the unenroll request comes. It cannot
                  be less than UTC {{current_date_time}}-1hour
                format: date-time
                nullable: false
      required: true
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
    ApiKeyAuth:
      type: apiKey
      name: X-APIKey
      in: header
