We have a new documentation site for cPanel & WHM! You can find our new documentation site at docs.cpanel.net.

We will continue to maintain our API documentation on this server.

Child pages
  • Manage2 API Functions - Display Groups
Skip to end of metadata
Go to start of metadata

Description

This function returns the Manage2 account's groups.

Examples 


 Browser-based Calls
XML
https://manage2.cpanel.net/XMLgroupInfo.cgi
JSON
https://manage2.cpanel.net/XMLgroupInfo.cgi?output=json
YAML
https://manage2.cpanel.net/XMLgroupInfo.cgi?output=yaml

Note:

To see the expanded returns, add &expand to the end of each browser-based call.

 cPanel Licensing PHP Class
<?php
include("cpl.inc.php");
$cpl = new cPanelLicensing("barney@example.com","12345luggage");
$lisc = $cpl->fetchGroups();
?>
 cPanel Licensing Perl Module
use cPanelLicensing;
my $cpl = new cPanelLicensing(user => 'barney\@example.com', pass => '12345luggage');
$cpl->fetchGroups();
 Output (JSON)
{
  "version": "0.5",
  "status": 1,
  "groups": {
    "G294666": "alicegroupthree",
    "G863177": "test1",
    "G294662": "alicegrouptwo",
    "G294658": "alicegroupone"
  },
  "reason": "OK"
}

With &expand:

{
  "group": [
    {
      "taxrate": "0.0825",
      "name": "alicegroupone",
      "groupid": "G294658",
      "taxstate": "TX"
    },
    {
      "taxrate": "0.0825",
      "name": "alicegrouptwo",
      "groupid": "G294662",
      "taxstate": "TX"
    },
    {
      "taxrate": "0.0825",
      "name": "alicegroupthree",
      "groupid": "G294666",
      "taxstate": "TX"
    },
    {
      "taxrate": "0.0825",
      "name": "test1",
      "groupid": "G863177",
      "taxstate": "TX"
    }
  ],
  "version": "0.5",
  "status": 1,
  "reason": "OK"
}
 Output (XML)
<XMLgroupInfo reason="OK" status="1" version="0.5">
  <groups G294658="alicegroupone" G294662="alicegrouptwo" G294666="alicegroupthree" G863177="test1"/>
</XMLgroupInfo>

With &expand:

<XMLgroupInfo reason="OK" status="1" version="0.5">
    <group name="alicegroupone" groupid="G294658" taxrate="0.0825" taxstate="TX"/>
    <group name="alicegrouptwo" groupid="G294662" taxrate="0.0825" taxstate="TX"/>
    <group name="alicegroupthree" groupid="G294666" taxrate="0.0825" taxstate="TX"/>
    <group name="test1" groupid="G863177" taxrate="0.0825" taxstate="TX"/>
</XMLgroupInfo>
 Output (YAML)
---
groups:
  G294658: alicegroupone
  G294662: alicegrouptwo
  G294666: alicegroupthree
  G863177: test1
reason: OK
status: 1
version: '0.5'

With &expand:

---
group:
  -
    groupid: G294658
    name: alicegroupone
    taxrate: '0.0825'
    taxstate: TX
  -
    groupid: G294662
    name: alicegrouptwo
    taxrate: '0.0825'
    taxstate: TX
  -
    groupid: G294666
    name: alicegroupthree
    taxrate: '0.0825'
    taxstate: TX
  -
    groupid: G863177
    name: test1
    taxrate: '0.0825'
    taxstate: TX
reason: OK
status: 1
version: '0.5'

Parameters

ParameterTypeDescriptionPossible valuesExample
expandstring

Displays the taxstate and taxrate returns.

This parameter does not accept values. 

&expand

Returns

ReturnTypeDescriptionPossible valuesExample
groupshashA hash of the account's group names and group IDs.A hash of group ID numbers and names.
 Click to view...
groups 
G0001= "ExampleGroup" 
G0002= "" 
G0003= "Training Server*" 
G0004= "Training Server 2*" 
G0005= "Enterprise" 
G0006= "Enterprise 2" 
G0007= "Testing Server"
reasonstring

Information about the group display operation.

A string value.OK
statusBooleanWhether the function succeeded.
  • 1 — Success.

  • 0 — Failure.
1
versionnumericInternal information that the Manage2 API uses to identify the version.

A numeric value.

0.4

groupsarray of hashes

A hash of expanded group information.

Note:

This return only appears when you add the expand parameter.

This hash includes the following returns:

  • groupid
  • name
  • taxstate
  • taxrate

 groupid

string

The group's ID number.

The function returns this value in the groups hash.

A string value.G294658
 namestring

The group's name.

The function returns this value in the groups hash.

A string value.alicegroupone
 taxstatestring

The group's US state.

The function returns this value in the groups hash.

  • A two-letter postal abbreviation for a US state.
  • null — No state.
TX
 taxratenumeric

The sales tax rate.

The function returns this value in the groups hash.

  • A numeric value between 0 and 1.
  • null — Not taxable.
0.0825