UAPI - Return Data

Introduction

UAPI outputs data in JavaScript Object Notation (JSON).

Note:

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.

 

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:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
{
  "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.

Warning:

Individual function documents do not include these descriptions of metadata information, unless the function's returns are atypical of the normal UAPI structure.

 Metadata parameter 

Type

Description

messages

string

One or more messages about the function's results. If there are no messages, this parameter returns anull value.

errors

string

One or more error messages, if errors occurred. If there are no errors, this parameter returns a null value.

status

Boolean

Whether the function itself was successful.

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. 

metadata

hash

A hash of additional metadata. Often, this hash includes the transformed parameter.

data

 hash, 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.

 

  • 7 Users Found This Useful
Was this answer helpful?

Related Articles

The cPanel Interface

For  cPanel  &  WHM  version  58 Overview The cPanel interface is...

User Preferences

For cPanel & WHM version 58 Overview This document outlines how to access your cPanel...

Manage External Authentications

For cPanel & WHM version 58 Overview Manage credentials Additional documentation...

What is cPanelID?

In This Article:  Overview ServicesHow to get a cPanelID cPanelID External...

Guide to cPanel Interface Customization - cPanel Style Development

Introduction You can develop custom styles that modify the appearance of the cPanel interface....