﻿openapi: 3.0.1
info:
  title: Vasion Output Management Print API
  version: v1.0.0
  contact:
    name: PrinterLogic Support
    url: https://vasion.com/technical-support/
    email: support@printerlogic.com
servers:
  - url: https://external-api.app.printercloud.com
tags: []
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
paths:
  /v1/print:
    post:
      security:
        - bearerAuth: []
      summary: Print Job Request
      description: "Send a new print job to be printed."
      requestBody:
        content:
          multipart/form-data:
            schema:
              required:
                - copies
                - file
                - queue
                - username
              properties:
                file:
                  type: string
                  format: binary
                  description: File to be printed. The Content-Type header must be set in this part of the form-data.
                queue:
                  type: string
                  description: Printer name as defined in PrinterLogic
                  example: HP127
                jobID:
                  pattern: >-
                    ^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$
                  type: string
                  description: >-
                    Job UUID. Not required, if not sent it will be generated.
                    Must be unique between jobs.
                  example: 96e31686-daae-4820-9389-5a9d36496bad
                deviceName:
                  type: string
                  description: >-
                    Job origination device. Not required, if not sent will use
                    the hostname the service client is running on.
                  example: m123.local
                duplex:
                  type: number
                  description: >-
                    Print the job in duplex.
                    0 - respect printer's default setting.  
                    1 - simplex.  
                    2 - duplex flipped on long edge.  
                    3 - duplex flipped on short edge. 
                    Will also accept 'true/false'. If true, will default to duplex (long edge).
                  default: false
                color:
                  type: boolean
                  description: Print the job in color or black and white.
                  default: true
                copies:
                  minimum: 1
                  type: number
                  description: >-
                    Number of copies to print. Must be > 0. 1 means the job will
                    print once, 2 twice, and so on.
                  default: 1
                paperSource:
                  type: string
                  description: The tray code of the tray that the job should be printed to.
                  example: 1
                paperSize:
                  type: string
                  description: The paper size being printed on (LETTER, A4, etc.).
                  example: A4
                username:
                  type: string
                  description: >-
                    Identifier for the user who sent the job. Can be email
                    `john.doe@example.com` or domain and account
                    `example\\john.doe`.

                    If the user is not found in Vasion, then the job will still
                    continue but not report to that user. With the exception of
                    pull print or secure jobs, which will print immediately.
                  example: ken.mickelssen@vasion.com
                statusURL:
                  pattern: ^(https?)://[^\s/$.?#].[^\s]*$
                  type: string
                  example: "https://example.com/print-job-status"
                  description: >-
                    A URL endpoint that will be called with the status of the
                    job once it is completed. See the other documentation for
                    what interface this URL needs to implement.
        required: true
      responses:
        202:
          description: Added to queue successfully
          content:
            application/json:
              examples:
                OK:
                  value: |-
                    {
                      "jobID": "ac6bce59-ccfb-45d5-a939-09da12b8eebc"
                    }
        400:
          description: "Bad Request. Error occurred when reading the request body or headers."
        401:
          description: "Unauthorized. Invalid authorization was used in the request."
        405:
          description: "Method Not Allowed. The request was sent with the wrong method."
        500:
          description: "Internal Server Error."

  /v1/batch/open:
    post:
      security:
        - bearerAuth: []
      summary: Batch Open Request
      description: "Send a request to start a new batch."
      requestBody:
        content:
          application/json:
            schema:
              required:
                - batchID
                - jobIDs
              properties:
                batchID:
                  pattern: >-
                    ^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$
                  type: string
                  description: Batch UUID
                  example: 96e31686-daae-4820-9389-5a9d36496ba
                jobIDs:
                  pattern: >-
                    ^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$
                  type: string
                  description: A list of job uuids.
                  example:
                    [
                      96e31686-daae-4820-9389-5a9d36496bal,
                      96e31686-daae-4820-9389-5a9d36496bca,
                    ]
                requireAllJobs:
                  type: bool
                  description: Require all jobs to be submitted before allowing the batch to close.
                  example: false
                  required: false
                  default: false
        required: true
      responses:
        201:
          description: Batch created successfully
          content:
            application/json:
              examples:
                CREATED:
                  value: |-
                    {
                      "id": "96e31686-daae-4820-9389-5a9d36496bal",
                      "jobIds": ["96e31686-daae-4820-9389-5a9d31296bzl", "96e31686-daae-4820-9389-5a9d36496bg1"],
                      "createdTime": "2024-01-12T03:25:36.229752Z"
                    }
        400:
          description: "Bad Request. Error occurred when reading the request body or headers."
        401:
          description: "Unauthorized. Invalid authorization was used in the request."
        405:
          description: "Method Not Allowed. The request was sent with the wrong method."
        500:
          description: "Internal Server Error."
  /v1/batch/close:
    post:
      security:
        - bearerAuth: []
      summary: Batch Close Request
      description: "Send a request to close a batch."
      requestBody:
        content:
          application/json:
            schema:
              required:
                - batchID
              properties:
                batchID:
                  pattern: >-
                    ^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$
                  type: string
                  description: Batch UUID
                  example: 96e31686-daae-4820-9389-5a9d36496ba
        required: true
      responses:
        202:
          description: Batch closed successfully
          content:
            application/json:
              examples:
                accepted:
                  value:
        400:
          description: "Bad Request. Error occurred when reading the request body or headers."
        401:
          description: "Unauthorized. Invalid authorization was used in the request."
        405:
          description: "Method Not Allowed. The request was sent with the wrong method."
