System

Authentication

POST /api/v1/login
Response JSON Object:
 
  • isAdmin (boolean) – is administrator group or not
  • username (string) – request username

Example request (username and password)

$ curl -sq -XPOST -c cookies.txt -d '{"username": "admin", "password": "admin"}' \
      http://${QIP}:${QPORT}/container-station/api/v1/login

Example request (sid)

$ curl -sq -XPOST -c cookies.txt -d '{"sid": "nassid"}' \
      http://${QIP}:${QPORT}/container-station/api/v1/login

Example response

{
    "anonymous": false,
    "isAdmin": true,
    "logintime": "2021-08-11 16:54:45",
    "username": "admin"
}

Note

${QPORT} is the same as the system port of NAS.

Steps to check the system port: “Control Panel” > “General Settings”

_images/system_port.png

Note

Login API response will get HTTP 403 Forbidden status code if 2-step

verification is enabled on this account.

You should use sid as request body instead of username and password in login API.

GET /api/v1/login_refresh
Response JSON Object:
 
  • isAdmin (boolean) – is administrator group or not
  • username (string) – request username

Example request

$ curl -sq -XGET -b cookies.txt http://${QIP}:${QPORT}/container-station/api/v1/login_refresh

Example response

{
    "anonymous": false,
    "isAdmin": true,
    "logintime": "2021-08-11 16:54:45",
    "username": "admin"
}
PUT /api/v1/logout
Response JSON Object:
 
  • username (string) – request username

Example request

$ curl -sq -XPUT -b cookies.txt http://${QIP}:${QPORT}/container-station/api/v1/logout

Example response

{
    "username": "admin"
}

System Information

GET /api/v1/system
Response JSON Object:
 
  • cpuCore (int) – CPU core count
  • cpuThread (int) – Total CPU thread count
  • hostname (string) – Device hostname
  • processor (string) – Processor information
  • machine (string) – Machine type, e.g. ‘x86_64’, ‘armv7l’. An empty string is returned if the value cannot be determined.
  • version (object) – Version of Docker, LXC, LXD, and Container Station
  • memoryPageSize (int) – Memory page size.
  • features (object) – Support features, e.g. ‘lxd’, ‘net_bridge’

Example request

$ curl -sq -b cookies.txt http://${QIP}:${QPORT}/container-station/api/v1/system

Example response

{
    "cpuCore": 4,
    "cpuThread": 4,
    "features": [
        "",
        "net_bridge",
        "lxd"
    ],
    "gpu": {
        "csMode": false,
        "device": [],
        "driverInstalled": false
    },
    "gpuchanged": false,
    "hostname": "SW8-ED-453Bm",
    "isDevicemapper": false,
    "isSupportOverlay": true,
    "machine": "amd64",
    "memory": 7998068,
    "memoryPageSize": 4096,
    "migrationDir": "/var/lib/docker/qnap-migration",
    "migrationDmStatus": "",
    "needRestart": false,
    "platform": "qts",
    "processor": "Intel(R) Celeron(R) CPU J3455 @ 1.50GHz",
    "status": "running",
    "storageDriver": "overlay2",
    "uncleanFS": false,
    "version": {
        "compose": "1.29.2",
        "dockerVersion": "20.10.3",
        "firmware": "4.5.4",
        "lxc": "2.0.11-1",
        "lxd": "4.14",
        "qpkg": "2.4.0.2316",
        "qpkgBuildDate": "2021/07/06"
    }
}
GET /api/v1/system/resource
Response JSON Object:
 
  • cpu_usage (string) – CPU usage in percentage
  • memory_usage (object) – Memory usage in MB

Example request

$ curl -sq -b cookies.txt http://${QIP}:${QPORT}/container-station/api/v1/system/resource

Example response

{
    "cpu_usage": "100.0",
    "memory_usage": {
        "buffers": 585,
        "cached": 3336,
        "percent": 26,
        "percent_buffers": 7,
        "percent_cached": 42,
        "total": 7810,
        "used": 2086
    }
}
GET /api/v1/system/report

System diagnosis report

Example request

$ curl -sq -b cookies.txt http://${QIP}:${QPORT}/container-station/api/v1/system/report

Network

GET /api/v1/system/port/(string: protocol)/(string: port)

Check port in used or not.

Parameters:
  • protocoltcp, udp
  • port – Port number.
Response JSON Object:
 
  • used (boolean) – The port has been used or not.

Example request

$ curl -sq -b cookies.txt http://${QIP}:${QPORT}/container-station/api/v1/system/port/tcp/5000
$ curl -sq -b cookies.txt http://${QIP}:${QPORT}/container-station/api/v1/system/port/udp/33806

Example response

{
    "used": true
}
{
    "used": false
}
GET /api/v1/system/bridge

Get brief bridge information.

Response JSON Object:
 
  • interface (string) – Network interface
  • ip (string) – IP address
  • vswitchName (string) – Virtual switch name
  • disabled (boolean) – If it is true, do not use this interface
  • join (boolean) – If it is true, means it will join this bridge which was created by others

Example request

$ curl -sq -b cookies.txt http://${QIP}:${QPORT}/container-station/api/v1/system/bridge

Example response

{
    "data": [
        {
            "bridge": null,
            "display": "Adapter 1",
            "gateway": "192.168.180.254",
            "ip": "192.168.180.68",
            "name": "eth0",
            "netmask": "255.255.254.0"
        },
        {
            "bridge": null,
            "display": "Adapter 2",
            "gateway": "192.168.180.254",
            "ip": "192.168.181.160",
            "name": "eth1",
            "netmask": "255.255.254.0"
        }
    ],
    "default": 1
}

Certificate file

GET /api/v1/tls

Get certificate information

Response JSON Object:
 
  • startdate (string) – After date
  • enddate (string) – Before date
  • outdatedNotify (string) – Notify to user

Example request

$ curl -sq -XGET -b cookies.txt http://${QIP}:${QPORT}/container-station/api/v1/tls

Example response

{
    "enddate": "2024-07-26",
    "outdatedNotify": false,
    "startdate": "2021-08-11"
}
POST /api/v1/tls

Set certificate outdated notify

Request JSON Object:
 
  • outdatedNotify (boolean) – set to false if not notify next time [required]

Example request

$ curl -sq -XPOST -b cookies.txt -d '{"outdatedNotify": false}' \
    http://${QIP}:${QPORT}/container-station/api/v1/tls

Example response

{
    "result": true
}
GET /api/v1/tls/domain_names

Get extra DNS hostname or IP Address for server certificate

Response JSON Object:
 
  • domain_names (string) – Extra hostnames

Example request

$ curl -sq -XGET -b cookies.txt http://${QIP}:${QPORT}/container-station/api/v1/tls/domain_names

Example response

{
    "domain_names": ""
}
PUT /api/v1/tls/domain_names

Set extra DNS hostname or IP Address for server certificate

Request JSON Object:
 
  • domain_names (string) – Extra hostnames [required]

Example request

$ curl -sq -XPUT -b cookies.txt -d '{"domain_names": "user.myqnapcloud.com"}' \
    http://${QIP}:${QPORT}/container-station/api/v1/tls/domain_names

Example response

{
    "result": true
}
GET /api/v1/tls/export

Export certificate files to ZIP format.

Example request

$ curl -sq -XGET -b cookies.txt http://${QIP}:${QPORT}/container-station/api/v1/tls/export
POST /api/v1/tls/rotation

Renew Docker client certificate.

Example request

$ curl -sq -XPOST -b cookies.txt http://${QIP}:${QPORT}/container-station/api/v1/tls/rotation

Shared folders

GET /api/v1/sharefolder/

List shared folders.

Query Parameters:
 
  • path – path of a folder
  • size – Get the total size and used size of root directory.
Response JSON Object:
 
  • name (string) – directory name or file name
  • isDir (boolean) – is directory or not
  • totalSize (string) – Total size of root directory
  • usedSize (string) – Used size of root directory
  • write (boolean) – write permission

Example request

$ curl -sq -b cookies.txt http://${QIP}:${QPORT}/container-station/api/v1/sharefolder/
$ curl -sq -b cookies.txt "http://${QIP}:${QPORT}/container-station/api/v1/sharefolder/?size=true"
$ curl -sq -b cookies.txt "http://${QIP}:${QPORT}/container-station/api/v1/sharefolder/?path=test"
$ curl -sq -b cookies.txt "http://${QIP}:${QPORT}/container-station/api/v1/sharefolder/?path=Public"

Example response

[
    {
        "isDir": true,
        "name": "Container",
        "write": true
    },
    {
        "isDir": true,
        "name": "Download",
        "write": true
    },
    {
        "isDir": true,
        "name": "Multimedia",
        "write": true
    },
    {
        "isDir": true,
        "name": "Public",
        "write": true
    },
    {
        "isDir": true,
        "name": "Web",
        "write": true
    }
]
[
    {
        "isDir": true,
        "name": "Container",
        "totalSize": "565.9G",
        "usedSize": "2.7G",
        "write": true
    },
    {
        "isDir": true,
        "name": "Download",
        "totalSize": "217.3G",
        "usedSize": "1.1G",
        "write": true
    },
    {
        "isDir": true,
        "name": "Multimedia",
        "totalSize": "217.3G",
        "usedSize": "711M",
        "write": true
    },
    {
        "isDir": true,
        "name": "Public",
        "totalSize": "217.3G",
        "usedSize": "5.4G",
        "write": true
    },
    {
        "isDir": true,
        "name": "Web",
        "totalSize": "217.3G",
        "usedSize": "12G",
        "write": true
    }
]
[
    {
        "isDir": true,
        "name": "selenium"
    },
    {
        "isDir": true,
        "name": "spec"
    }
]
[
    {
        "isDir": true,
        "name": "@Recycle"
    },
    {
        "isDir": true,
        "name": "QVRCenterAutoLog"
    },
    {
        "isDir": true,
        "name": "configs"
    },
    {
        "isDir": true,
        "name": "lxc"
    },
    {
        "isDir": true,
        "name": "qpkg"
    },
    {
        "isDir": false,
        "name": "WordPress_5.7.2_x86_64.qpkg"
    },
    {
        "isDir": false,
        "name": "b1.tar"
    },
    {
        "isDir": false,
        "name": "cs-api-server"
    },
    {
        "isDir": false,
        "name": "ctstation.sqlite"
    },
    {
        "isDir": false,
        "name": "messages"
    },
    {
        "isDir": false,
        "name": "wordpress_5.4.2_x86_64.qpkg"
    }
]