Manage2 API Function - Add Licenses


Last modified: March 12, 2021

Description

This function adds a new license to a Manage2 account.

Examples

XML

https://manage2.cpanel.net/XMLlicenseAdd.cgi?ip=192.0.2.0&packageid=8&groupid=13&force=1&dryrun=0&maxusers=120&external_notes=testlicense

JSON

https://manage2.cpanel.net/XMLlicenseAdd.cgi?output=json&ip=192.0.2.0&packageid=008&groupid=013&force=1&dryrun=0&maxusers=120&external_notes=testlicense

YAML

https://manage2.cpanel.net/XMLlicenseAdd.cgi?output=yaml&ip=192.0.2.0&packageid=008&groupid=013&force=1&dryrun=0&maxusers=120&external_notes=testlicense

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
<?php
include("cpl.inc.php");
$cpl = new cPanelLicensing("username@example.com", "123456luggage");
$lisc = (array)$cpl->activateLicense(array(
    "ip"          => "192.0.2.0",
    "groupid"     => "013",
    "packageid"   => 008",
    "force"       => "1",
    "dryrun"      => "0",
    "maxusers"      => "120",
    "external_notes"    => "testlicense"
    )
);
?>

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
use cPanelLicensing;
my $licenseManager = new cPanelLicensing(user => "username\@example.com", pass => "123456luggage");
my $liscid = $licenseManager->activateLicense(
    'ip'          => '192.0.2.0',
    'groupid'     => '013',
    'packageid'   => '008',
    'force'       => '1',
    "dryrun"      => "0",
    "maxusers"      => "120",
    "external_notes"    => "testlicense"
);

<XMLlicenseAdd licenseid="6793969" monthly_price="21.34" price="0.00" promoinfo="" reason="Activated EXAMPLECOMPANY license on 192.0.2.0 in the 'example' group." status="1" yearly="0"/>

1
2
3
4
5
6
7
8
9
{
    "monthly_price": "21.34",
    "status": 1,
    "yearly": 0,
    "reason": "Activated EXAMPLECOMPANY license on 192.0.2.0 in the 'example' group.",
    "price": "100.00",
    "promoinfo": "",
    "licenseid": "6793969"
}

1
2
3
4
5
6
7
8
---
monthly_price: '21.34'
status: 1
yearly: 0
reason: Activated EXAMPLECOMPANY license on 192.0.2.0 in the 'example' group.
price: '100.00'
promoinfo: ''
licenseid: '6793969'

Parameters

This function accepts the following parameters:

Parameter Type Description Example
ip string Required
The IP address for which to add a license.
192.0.2.0
packageid string Required
The package’s ID number. The Manage2 List Package Information function returns a list of possible values.
008
groupid string Required
The ID of the group to which to add the license. The Manage2 Display Groups function returns a list of possible values.
013
force
or
reactivateok
Boolean Whether to forcibly add the license to the specified IP address:
  • 1 — Forcibly add the license.
  • 0 — Do not forcibly add the license.
This parameter defaults to 1.
0
dryrun Boolean Whether to display error messages and price information, but not activate the license:
  • 1 — Display fee information but do not activate the license.
  • 0 — Do not display fee information but activate the license.
This parameter defaults to 0.
1
maxusers integer The maximum number of users allowed on the license. 120
external_notes string A space for additional information associated with the license, up to 64 characters long. testlicense

Returns

This function returns the following values:

Return Type Description Example
licenseid integer The new license ID. 6793969
monthly_price numeric The monthly base price of a license, in US dollars. 21.34
price numeric The price for a license, in US dollars. 100.00
promoinfo string Information about any applied promotional rates. One of:
  • A string value.
  • "" — No promotion applied.
""
reason string Information about the license activation. Activated EXAMPLECOMPANY license on 192.0.2.0 in the 'example' group.
status Boolean Whether the function succeeded:
  • 1 — Success.
  • 0 — Failure.
1
yearly Boolean Whether the license is a yearly license:
  • 1 — A yearly license.
  • 0 — Not a yearly license.
0

Additional Documentation