cPanel XMLAPI - cpanel


DESCRIPTION

This function allows you to access cPanel's API1 and API2 functions from within WebHost Manager


VARIABLES

INPUT

user (string)
The name of the user that owns the cPanel account to be affected.

xmlin (XML)
XML container for the function. Format <cpanelaction><module><func><args></args></func></module></cpanelaction>

module (string)
Name of the module to access (LOWERCASE). (See http://www.cpanel.net/plugins/api2/index.html for module and function names)

apiversion (integer)
Version of the API to access. (1 = API1, no input defaults to API2)

func (string)
Name of the function to access. (See http://www.cpanel.net/plugins/api2/index.html for module and function names)

args (XML or string)
List of arguments or argument container. See examples for API1 and API2 passing arguments.

OUTPUT

cpanelresult (XML)
Result of cPanel operation container.

apiversion (string)
Version of API accessed. (1 | 2)

module (string)
Name of the module accessed.

func (string)
Name of the function accessed.

type (string)
Type of function.

source (string)
Source of the call. (internal | external)

data (XML)
Data provided by the function. (See the function's documentation for data format).

result (string)
Result of the function.


EXAMPLES

API2 - No arguments
Calling this URL in WebHost Manager: /xml-api/cpanel?user=nick&xmlin=<cpanelaction><module>park</module><func>listparkeddomains</func></cpanelaction>

will produce something similar to:

<cpanelresult>

<apiversion>2</apiversion>

<data>

<basedir>public_html</basedir>

<dir>/home/nick/public_html</dir>

<domain>domain1.tld</domain>

<reldir>home:public_html</reldir>

<status>https://www.domain.tld/$1 </status>

</data>

<data>

<basedir>public_html</basedir>

<dir>/home/nick/public_html</dir>

<domain>domain.tld</domain>

<reldir>home:public_html</reldir>

<status>not redirected</status>

</data>

<func>listparkeddomains</func>

<module>Park</module>

</cpanelresult>

API2 - With arguments
Calling this URL in WebHost Manager: /xml-api/cpanel?user=nick&xmlin=<cpanelaction><module>Email</module><func>listpopswithdisk</func><args><domain>domain.tld</domain></args></cpanelaction>

will produce something similar to:

<cpanelresult>

<apiversion>2</apiversion>

<data>

<_diskquota>250.00</_diskquota>

<_diskused>0.00</_diskused>

<diskquota>250.00</diskquota>

<diskused>0.00</diskused>

<diskusedpercent>0</diskusedpercent>

<diskusedpercent20>0</diskusedpercent20>

<domain>domain.tld</domain>

<email>test@domain.tld </email>

<humandiskquota>250 MB </humandiskquota>

<humandiskused>0 Bytes</humandiskused>

<login>test@domain.tld </login>

<txtdiskquota>250.00</txtdiskquota>

<user>test</user>

</data>

<func>listpopswithdisk</func>

<module>Email</module>

</cpanelresult>

API1 - With arguments
Calling this URL in WebHost Manager: /xml-api/cpanel?user=nick&xmlin=<cpanelaction><module>Email</module><func>addpop</func><apiversion>1</apiversion><args>nick</args><args>somepass</args><args>domain.tld</args></cpanelaction>

will produce something similar to:

<cpanelresult>

<module>Email</module>

<func>addpop</func>

<type>event</type>

<source>internal</source>

<apiversion>1</apiversion>

<data>

<result>Sorry the account nick@domain.tld already exists!</result>

</data>

</cpanelresult>

NOTE: calling API1 functions takes a list of arguments, all encapsulated in <args></args> tags while each argument in an API2 tag requires it's own <variablename></variablename> container with the name of the variable supplied.


COPYRIGHT

Copyright 2007 cPanel Inc.