Choosing an Output Format

By default, the Manage2 API outputs the result of a function call in XML format. However, you are able to change the output of the call by specifying the output variable when the call is made. We offer 2 additional output formats: JSON and YAML.

The examples below display each output format using the XMLpackageInfo.cgi function. This function accepts only accepts the output argument.

PICK Remember: URL arguments are unordered. The output variable can be specified at any point in the API function call.

Using the XML API

Show Hide

To view the output of the API function call in XML, simply do not specify an output variable. For example:

  • http://manage2.cpanel.net/XMLpackageInfo.cgi

This will result in output that resembles the following:

<XMLpackageInfo reason="OK" status="1" version="0.3">
     <packages P0001="ONE TIME FEE" P0002="RESELLER-INTERNAL" 
     P0003="RESELLER-INTERNAL-VPS" P0004="THREE-YEAR" 
     P0005="ONE-YEAR" P0006="TWO-YEAR"/>
</XMLpackageInfo>

Using the JSON API

Show Hide

To view the output of the API function call using the JSON output format, simply append ?output=json to the end of the URL. For example:

  • http://manage2.cpanel.net/XMLpackageInfo.cgi?output=json

This will result in output that resembles the following:

{
   "packages":{
      "P0003":"RESELLER-INTERNAL-VPS",
      "P0005":"ONE-YEAR",
      "P0002":"RESELLER-INTERNAL",
      "P0004":"THREE-YEAR",
      "P0006":"TWO-YEAR",
      "P0001":"ONE TIME FEE"
   },
   "status":1,
   "version":0.3,
   "reason":"OK"
}

Using the YAML API

Show Hide

To view the output of an API function call in the YAML format, append ?output=yaml to the end of the URL. For example:

  • http://manage2.cpanel.net/XMLpackageInfo.cgi?output=yaml

This will result in output that resembles the following:

--- 
packages: 
  P0001: ONE TIME FEE
  P0002: RESELLER-INTERNAL
  P0003: RESELLER-INTERNAL-VPS
  P0004: THREE-YEAR
  P0005: ONE-YEAR
  P0006: TWO-YEAR
reason: OK
status: 1
version: 0.3
Topic revision: r1 - 26 Nov 2010 - 19:30:06 - Main.MelanieSeibert