openapi: 3.0.3
info:
  description: Provide Quick Install API doc for QTS 
  version: 5.0.1
  title: Quick Install API
  # put the contact info for your development or API team
  contact:
    email: richardchang@qnap.com
# tags are used for organizing operations
tags:
- name: quick
  description: Quick Install related APIs
servers:
- url: "http:\///172.17.20.33:8080"
  description: "The production API server"
  variables:
    username:
      # note! no enum here means it is an open value
      default: demo
      description: this value is assigned by the service provider, in this example `gigantic-server.com`


paths:
  /cgi-bin/quick/quick.cgi?todo=get_all:
    get:
      tags:
      - quick
      summary: get all quick install 
      operationId: get_all
      parameters:
        - in: query
          name: todo
          required: false
          schema:
            type: string
            default: get_all
      responses:
        200:
          description: Success
          content:
            application/xml:
              schema:
                $ref: '#/components/schemas/get_all'
  /cgi-bin/quick/quick.cgi?todo=get_apply_status:
    get:
      tags:
      - quick
      summary: get apply status
      operationId: get_apply_status
      parameters: []
      responses:
        200:
          description: Success
          content: 
            application/xml:
              schema:
                $ref: '#/components/schemas/get_apply_status'
  /cgi-bin/quick/quick.cgi?todo=get_step_status:
    get:
      tags:
      - quick
      summary: "get update firmware and init status"
      operationId: get_step_status
      parameters: []
      responses:
        200:
          description: Success
          content: 
            application/xml:
              schema:
                $ref: '#/components/schemas/get_step_status'
  /cgi-bin/quick/quick.cgi?todo=have_new_fw:
    post:
      tags:
      - quick
      summary: "check qts have new firmware"
      operationId: have_new_fw
      parameters: []
      responses:
        200:
          description: Success
          content: 
            application/xml:
              schema:
                $ref: '#/components/schemas/have_new_fw'
  /cgi-bin/quick/quick.cgi?todo=check_fw:
    post:
      tags:
      - quick
      summary: "check qts have new firmware and update firmware"
      operationId: check_fw
      parameters: []
      responses:
        200:
          description: Success
          content: 
            application/xml:
              schema:
                $ref: '#/components/schemas/Result'
  /cgi-bin/quick/quick.cgi?todo=get_upload_file:
    post:
      tags:
      - quick
      summary: "upload firmware and update firmware"
      operationId: get_upload_file
      parameters:
        - in file:
          multipart/form-data:
            schema:
              type: object
              properties:
                # 'file' will be the field name in this multipart request
                file:
                  type: string
                  format: binary
      responses:
        200:
          description: Success
          content: 
            application/xml:
              schema:
                $ref: '#/components/schemas/Result'
  /cgi-bin/quick/quick.cgi?todo=set_mode:
    post:
      tags:
      - quick
      summary: "開始初始化設定"
      operationId: set_mode
      parameters:
        - in: query
          name: mode
          required: false
          schema:
            type: string
            default: manual
      responses:
        200:
          description: Success
          content: 
            application/xml:
              schema:
                $ref: '#/components/schemas/Result'
  /cgi-bin/quick/quick.cgi?todo=set_serverinfo:
    post:
      tags:
      - quick
      summary: "set nas server name"
      operationId: set_serverinfo
      parameters:
        - in: query
          name: SERVER_NAME
          required: false
          schema:
            type: string
            default: "hostname"
      responses:
        200:
          description: Success
          content: 
            application/xml:
              schema:
                $ref: '#/components/schemas/Result'
  /cgi-bin/quick/quick.cgi?todo=set_password:
    post:
      tags:
      - quick
      summary: "set nas administrator user"
      operationId: set_password
      parameters:
        - in: query
          name: administrator_user
          required: false
          schema:
            type: string
            default: "qnap"
        - in: query
          name: administrator_passwd
          required: false
          schema:
            type: string
            default: "xxxxxx"
            description: "base64 encode pass word."
      responses:
        200:
          description: Success
          content: 
            application/xml:
              schema:
                $ref: '#/components/schemas/Result'
  /cgi-bin/quick/quick.cgi?todo=get_timeinfo:
    post:
      tags:
      - quick
      summary: "set nas date and time"
      operationId: get_timeinfo
      parameters:
        - in: query
          name: TIMEZONE
          required: false
          schema:
            type: string
            default: "(GMT+08:00) Taipei"
        - in: query
          name: time_mode
          required: false
          schema:
            type: "number"
            default: "3"
            description: "1: manual set clock, 2: follow PC, (1, 2 need year, month, day, hour, minute, second), 3: get from ntp (need ntp_server)"
        - in: query
          name: year
          required: false
          schema:
            type: "number"
            default: "2023"
            description: "20xx (year of A.D.)"
        - in: query
          name: month
          required: false
          schema:
            type: "number"
            default: "1"
            description: "01-12"
        - in: query
          name: day
          required: false
          schema:
            type: "number"
            default: "0"
            description: "00-23"
        - in: query
          name: hour
          required: false
          schema:
            type: "number"
            default: "0"
            description: "00-59"
        - in: query
          name: minute
          required: false
          schema:
            type: "number"
            default: "0"
            description: "00-59"
        - in: query
          name: second
          required: false
          schema:
            type: "number"
            default: "0"
            description: "00-59"
        - in: query
          name: ntp_server
          required: false
          schema:
            type: string
            default: "pool.ntp.org"
      responses:
        200:
          description: Success
          content: 
            application/xml:
              schema:
                $ref: '#/components/schemas/Result'
  /cgi-bin/quick/quick.cgi?todo=get_ntp_test:
    post:
      tags:
      - quick
      summary: "test ntp server can work of not"
      operationId: get_ntp_test
      parameters:
        - in: query
          name: ntp_server
          required: false
          schema:
            type: string
            default: "pool.ntp.org"
      responses:
        200:
          description: Success
          content: 
            application/xml:
              schema:
                $ref: '#/components/schemas/get_ntp_test'
  /cgi-bin/quick/quick.cgi?todo=set_networkinfo:
    post:
      tags:
      - quick
      summary: "set nas network"
      operationId: set_networkinfo
      parameters:
        - in: query
          name: LAN_USAGE
          required: false
          schema:
            type: "string"
            default: "DHCP"
            description: "DHCP: network use dhcp, STATIC: follow PC, (nees LAN_IP, LAN_MASK, LAN_GW, LAN_ID)"
        - in: query
          name: Primary_DNS
          required: false
          schema:
            type: "string"
            default: "8.8.8.8"
        - in: query
          name: Secondary_DNS
          required: false
          schema:
            type: "string"
            default: "127.0.0.1"
        - in: query
          name: LAN_IP
          required: false
          schema:
            type: "string"
            default: "172.17.21.33"
        - in: query
          name: LAN_MASK
          required: false
          schema:
            type: "string"
            default: "255.255.254.0"
        - in: query
          name: LAN_GW
          required: false
          schema:
            type: "string"
            default: "172.17.20.1"
        - in: query
          name: LAN_ID
          required: false
          schema:
            type: "number"
            default: "1"
      responses:
        200:
          description: Success
          content: 
            application/xml:
              schema:
                $ref: '#/components/schemas/Result'
  /cgi-bin/quick/quick.cgi?todo=do_quick:
    post:
      tags:
      - quick
      summary: "start to do quick install."
      operationId: do_quick
      parameters: []
      responses:
        200:
          description: Success
          content: 
            application/xml:
              schema:
                $ref: '#/components/schemas/get_apply_status'



components:
  schemas:
    Result:
      type: object
      properties:
        Result:
          type: string
          example: 'success'
    get_all:
      type: object
      properties:
        DiskError:
          type: "number"
          example: 0
        DiskErrorCode:
          type: string
          example: 'none'
        quick_mode:
          type: string
          example: 'init'
        SWITCH_OS:
          type: string
          example: 'no'
        CheckAndUpdate:
          type: "number"
          example: 0
        SkipUpdateNewFW:
          type: "number"
          example: 1
        QTS_ZFS:
          type: string
          example: 'no'
        IS_QTS:
          type: "number"
          example: 1
        IS_QTS_Hero:
          type: "number"
          example: 0
        hero_model:
          type: "number"
          example: 0
        Support_Hero:
          type: "number"
          example: 0
        Support_QTS:
          type: "number"
          example: 0
        is_over_4gb:
          type: "number"
          example: 0
        mobile_init:
          type: "number"
          example: 0
        switch_qts_or_hero:
          type: "number"
          example: 0
          description:  "0: not changed, 1: hero to qts, 2: qts to hero"
        recovery_mode:
          type: "number"
          example: 0
        paltfrom_task:
          type: "string"
          example: "qts"
        serverinfo:
          $ref: '#/components/schemas/serverinfo'
        timeinfo:
          $ref: '#/components/schemas/timeinfo'
        serviceinfo:
          $ref: '#/components/schemas/serviceinfo'
        networkinfo:
          $ref: '#/components/schemas/networkinfo'
        diskinfo:
          $ref: '#/components/schemas/diskinfo'
        disk_setting:
          $ref: '#/components/schemas/disk_setting'
    serverinfo:
      type: object
      properties:
        model:
          $ref: '#/components/schemas/model'
        firmware:
          $ref: '#/components/schemas/firmware'
        dom_version:
          type: "string"
          example: "5.0.0"
        live_update_xml:
          type: "string"
          example: "https://update.qnap.com/QTS_FW_5.0.0.xml"
        device_suid:
          type: "string"
          example: "e625d43a31ec59d5fd3de22035c0879f"
        country_code:
          $ref: '#/components/schemas/country_code'
        networkInterface:
          $ref: '#/components/schemas/networkInterface'
        server_uris:
          $ref: '#/components/schemas/server_uris'
    model:
      type: object
      properties:
        model:
          type: string
          example: "TS-X53II"
        internalModelName:
          type: string
          example: "TS-X53II"
        platform:
          type: string
          example: "TS-NASX86"
        platform_ex:
          type: string
          example: "X86_BRASWELL"
        customModelName:
          type: string
          example: ""
        displayModelName:
          type: string
          example: "TS-853A"
        storage_v2:
          type: "number"
          example: 1
        encryptfsSupported:
          type: "number"
          example: 1
        is_zfs:
          type: "number"
          example: 0
        node:
          type: string
          example: ""
        dual_node:
          type: string
          example: ""
    firmware:
      type: object
      properties:
        name:
          type: string
          example: "QTS"
        version:
          type: string
          example: "5.0.0"
        number:
          type: string
          example: "2300"
        build:
          type: string
          example: "20230328"
        patch:
          type: "number"
          example: 0
        buildTime:
          type: string
          example: "2023/03/28"
    country_code:
      type: object
      properties:
        code:
          type: "number"
          example: 0
        abbr:
          type: string
          example: "GLB"
        name:
          type: string
          example: "Global"
    networkInterface:
      type: object
      properties:
        networkRate:
          type: "number"
          example: 0
        speed:
          type: "number"
          example: 0
        currentMTU:
          type: "number"
          example: 0
        status:
          type: "number"
          example: 0
        MTU:
          type: "number"
          example: 1500
        macAddress:
          type: string
          example: "00:08:9B:F2:40:7C"
    networkinfo:
      type: object
      properties:
        lan_number:
          type: "number"
          example: 4
        total_lan_number:
          type: "number"
          example: 4
        total_qa_port_lan_number:
          type: "number"
          example: 0
        lan_list:
          type: "array"
          items:
            properties:
              dev:
                type: string
                example: "eth0"
              ifindex:
                type: "number"
                example: 0
              status:
                type: "number"
                example: 1
              ipaddr:
                type: string
                example: "172.17.20.33"
              netmask:
                type: string
                example: "255.255.254.0"
              gateway:
                type: string
                example: "172.17.20.1"
              is_QA_port:
                type: "number"
                example: 0
        select_lan:
          type: "number"
          example: 2
        lan_mode:
          type: "string"
          example: "DHCP"
        dns_major:
          type: "string"
          example: "127.0.1.1"
        dns_minor:
          type: "string"
          example: "8.8.8.8"
        ip:
          type: string
          example: "172.17.20.33"
        netmask:
          type: string
          example: "255.255.254.0"
        gateway:
          type: string
          example: "172.17.20.1"
        thunderbolt_support:
          type: string
          example: "yes"
        qcloud_info:
          type: object
          properties:
            qcloud_url:
              type: string
              example: "https://www.myqnapcloud.com/smarturl//service/cloud_install"
        nvs_support:
          type: "number"
          example: 1
    server_uris:
      type: object
      properties:
        server_name:
          type: string
          example: "qsapi"
        server_uri:
          type: string
          example: "qsapi.qnap.com"
    timeinfo:
      type: object
      properties:
        current_date:
          $ref: '#/components/schemas/current_date'
        current_timezone:
          type: string
          example: ""
        default_timezone:
          type: string
          example: "(GMT) Greenwich Mean Time : Dublin, Edinburgh, Lisbon, London"
        timezone_list:
          $ref: '#/components/schemas/timezone_list'
        time_server:
          $ref: '#/components/schemas/time_server'
    current_date:
      type: object
      properties:
        month:
          type: "number"
          example: 3
        day:
          type: "number"
          example: 28
        year:
          type: "number"
          example: 2023
        hour:
          type: "number"
          example: 8
        minute:
          type: "number"
          example: 42
        second:
          type: "number"
          example: 58
    timezone_list:
      type: "array"
      items:
        properties:
          option0:
            type: string
            example: "(GMT-11:00) MidwayIsland,Samoa"
          option1:
            type: string
            example: "(GMT-10:00) Hawaii"
    time_server:
      type: object
      properties:
        server_checkd:
          type: "string"
          example: "pc"
        ntp_server_ip:
          type: "string"
          example: "pool.ntp.org"
    serviceinfo:
      type: object
      properties:
        samba_func:
          type: "number"
          example: 1
        apple_talk_func:
          type: "number"
          example: 0
        nfc_func:
          type: "number"
          example: 0
        webfilemanager_func:
          type: "number"
          example: 1
        ftp_func:
          type: "number"
          example: 0
        download_func:
          type: "number"
          example: 0
        multimedia_func:
          type: "number"
          example: 0
        upnp_func:
          type: "number"
          example: 0
        qweb_func:
          type: "number"
          example: 0
        photostation_func:
          type: "number"
          example: 0
        musicstation_func:
          type: "number"
          example: 0
        videostation_func:
          type: "number"
          example: 0
    diskinfo:
      type: object
      properties:
        row: 
          type: "array"
          items: 
            type: "object"
            properties: 
              hdno:
                type: "number"
                example: 1
              enc_id:
                type: "number"
                example: 0
              port_id:
                type: "number"
                example: 0
              hdtype:
                type: string
                example: "--"
              hdsize:
                type: string
                example: "--"
              hdstatus:
                type: "number"
                example: -5
              hdblockscan:
                type: object
                properties:
                  scanstatus:
                    type: "number"
                    example: 0
                  badblocks:
                    type: "number"
                    example: 0
              hdsmart:
                type: string
                example: "Unknown"
    disk_setting:
      type: object
      properties:
        is_flexible_volume_support:
          type: "number"
          example: 1
        default_type:
          type: string
          example: "THIN"
        thick_percent:
          type: "number"
          example: 20
        tp_reserved_size_bytes:
          type: "number"
          example: 2751463424
        max_qlv_size:
          type: "number"
          example: 150994944KB
        max_volume_size:
          type: string
          example: "144TB"
        min_volume_size:
          type: string
          example: "1GB"
        tp_metadata_size:
          type: string
          example: "67108864KB"
        min_pool_size:
          type: string
          example: "144TB"
        snapshot_ram_limitation_mb:
          type: "number"
          example: 1024
        mem_dimm_size:
          type: "number"
          example: 2048
        qtier_support:
          type: "number"
          example: 0
        snapshot_support:
          type: "number"
          example: 0
        support_encrypt:
          type: string
          example: "yes"
        sEncrypt:
          type: string
          example: "no"
        select_disk:
          type: string
          example: "2|3"
        spare_disk:
          type: string
          example: ""
        select_mode:
          type: string
          example: "no_change"
        support_raid_50_60:
          type: "number"
          example: 0
        disk_cannot_init_error_code:
          type: "number"
          example: 0
    get_apply_status:
      type: object
      properties:
        CheckAndUpdate:
          type: "number"
          example: 0
        SkipUpdateNewFW:
          type: "number"
          example: 0
        Nas_Status:
          type: string
          example: 'no_apply'
        apply_time_status:
          type: string
          example: 'no'
        apply_password_status:
          type: string
          example: 'no'
        apply_network_status:
          type: string
          example: 'no'
        apply_disk_status:
          type: string
          example: 'no'
        apply_service_status:
          type: string
          example: 'no'
        apply_servername_status:
          type: string
          example: 'no'
        apply_count:
          type: "number"
          example: 0
    get_step_status:
      type: object
      properties:
        StepStatus :
          type: "number"
          example: 0
          description:  "0: waiting, 2: hd initing, 3: hd init ok, 4: hd init fail, 5: upload, 6: upgrade ok, 7: upgrade fail, 8: upgrading, 9: upgrade mount fail, 10: firmware downloading, 11:firmware download failed , 12: firmware download OK"
        UpdateStatus:
          type: "string"
          example: "0"
          description:  "0: 無更新中, 1: 開始更新, 2: 更新中, 3: 完成, 4: 完成等待重新開機, downloading: downloading firmware, gotfile: begin to update firmware"
        downloadPercent :
          type: "number"
          example: 0
          description:  "0 ~ 100"
    have_new_fw:
      type: object
      properties:
        new_feature_url:
          type: "string"
          example: "https://www.qnap.com/go/qts/5.0.1?no_hf=1"
        newVersion:
          type: "string"
          example: "none"
          description:  "none: 無新版本韌體, 5.0.2.2277: 新版本資訊, error: 取得資訊發生錯誤"
        liveVersion:
          type: "string"
          example: "5.0.1.2277"
    get_ntp_test:
      type: object
      properties:
        Result:
          type: string
          example: 'success'
        NTPStatus:
          type: "number"
          example: 1







