Page tree
Skip to end of metadata
Go to start of metadata

 

Introduction

UAPI outputs data in JavaScript Object Notation (JSON).You can also return UAPI data in Extensible Markup Language (XML)

  • The data structures will resemble the JSON described below.
  • This API's XML output does not comply with XML standards, is slower than JSON output to produce, and may result in validation errors. We strongly recommend that you use JSON.

Important:

cPanel & WHM version 66 deprecated XML output for cPanel API 1, cPanel API 2, UAPI, WHM API 0, and WHM API 1.

  • Calls for XML API output will return a deprecation warning.
  • We plan to remove XML output entirely in a future version of cPanel & WHM.

For more information, read our cPanel Deprecation Plan documentation.

Basic return data

UAPI JSON output returns as hashes, arrays of hashes, or scalar values.

For example, the DomainInfo::domains_data function's output is typical UAPI output:

{
  "messages": null,
  "errors": null,
  "status": 1,
  "metadata": {
     
  },
  "data": {
    "addon_domains": [
      {
        "phpopenbasedirprotect": "1",
        "ip": "192.168.0.128",
        "domain": "addondomain.com",
        "usecanonicalname": "Off",
        "group": "user",
        "hascgi": "1",
        "user": "user",
        "documentroot": "/home/user/addondomain/home/dir",
        "owner": "root",
        "userdirprotect": "",
        "ipv6": null,
        "serveralias": "addondomain.com www.addondomain.com www.subdomain.example.com",
        "homedir": "/home/user",
        "servername": "subdomain.example.com",
        "type": "addon_domain",
        "serveradmin": "webmaster@subdomain.example.com",
        "no_cache_update": "0"
      }
    ],
    "parked_domains": [
      "parkeddomain.com"
    ],
    "sub_domains": [
      {
        "phpopenbasedirprotect": "1",
        "ip": "192.168.0.128",
        "domain": "sub.example.com",
        "usecanonicalname": "Off",
        "group": "user",
        "hascgi": "1",
        "user": "user",
        "documentroot": "/home/user/public_html/sub",
        "owner": "root",
        "userdirprotect": "",
        "ipv6": null,
        "serveralias": "www.sub.example.com",
        "homedir": "/home/user",
        "servername": "sub.example.com",
        "type": "sub_domain",
        "serveradmin": "webmaster@sub.example.com",
        "no_cache_update": "0"
      }
    ],
    "main_domain": {
      "phpopenbasedirprotect": "1",
      "options": "ExecCGI Includes",
      "ip": "192.168.0.128",
      "domain": "example.com",
      "hascgi": "1",
      "group": "user",
      "usecanonicalname": "Off",
      "scriptalias": [
        {
          "url": "/cgi-bin/",
          "path": "/home/user/public_html/cgi-bin"
        },
        {
          "url": "/cgi-bin/",
          "path": "/home/user/public_html/cgi-bin/"
        }
      ],
      "user": "user",
      "ifmodulemodsuphpc": {
        "group": "user"
      },
      "owner": "root",
      "documentroot": "/home/user/public_html",
      "userdirprotect": "",
      "serveralias": "parkeddomain.com www.parkeddomain.com www.example.com",
      "port": "80",
      "homedir": "/home/user",
      "customlog": [
        {
          "target": "/usr/local/apache/domlogs/example.com",
          "format": "combined"
        },
        {
          "target": "/usr/local/apache/domlogs/example.com-bytes_log",
          "format": "\"%{%s}t %I .\\n%{%s}t %O .\""
        }
      ],
      "servername": "example.com",
      "type": "main_domain",
      "serveradmin": "webmaster@example.com"
    }
  }
}

Metadata

The following table lists metadata return parameters that always appear in UAPI output.

Warnings:

  • Individual function documents do not include these descriptions of metadata information, unless the function's returns are atypical of the normal UAPI structure.
  • UAPI calls via the command line do not return the metadata that other methods return if they experience errors that prevent a successful function run. To check for errors in code that calls UAPI functions via the command line, validate the command line return for a nonzero exit code instead.
Metadata parameterTypeDescription
messagesstringOne or more messages about the function's results. If there are no messages, this parameter returns a null value.
errorsstringOne or more error messages, if errors occurred. If there are no errors, this parameter returns a null value.
statusBoolean

Whether the function itself succeeded.

Note:

A value of 1 only indicates that the system successfully ran the function. It does not indicate that the function completed its action or that it did not encounter errors. 

metadatahashA hash of additional metadata. Often, this hash includes the transformed parameter.
datahash, array, or scalar

The function's return data. In most cases, the function's output parameters return as a hash or an array of hashes.