Manage2 API Function - Change a License Package

Last modified: March 16, 2021


Description

This function updates a license’s package.

Examples

XML

https://manage2.cpanel.net/XMLpackageUpdate.cgi?output=xml&ip=192.0.2.0&oldpackageid=P003&newpackageid=P002&maxusers=120

JSON

https://manage2.cpanel.net/XMLpackageUpdate.cgi?output=json&ip=192.0.2.0&oldpackageid=P003&newpackageid=P002&maxusers=120

YAML

https://manage2.cpanel.net/XMLpackageUpdate.cgi?output=yaml&ip=192.0.2.0;oldpackageid=P003;newpackageid=P002&maxusers=120

1
2
3
4
5
6
7
8
9
<?php
    include("cpl.inc.php");
    $cpl = new cPanelLicensing("[email protected]", "123456luggage");
    $response = (array)$cpl->packageUpdate(array(
        "ip"           => "192.0.2.0",
        "oldpackageid" => "P003",
        "newpackageid" => "P002".
        "maxusers"     => '120'));
?>

1
2
3
4
5
6
7
8
use cPanelLicensing;
my $licenseManager = new cPanelLicensing(user => 'username\@example.com', pass => '123456luggage');
$licenseManager->packageUpdate(
        'ip'           => '192.0.2.0',
        'oldpackageid' => 'P003',
        'newpackageid' => 'P002',
        'maxusers'     => '120'
);

<XMLpackageUpdate status="1" reason="Updated package on 192.0.2.0 from 15-DAY-TEST to COMPANY-INTERNAL-VPS."/>

1
2
3
4
{
  "status": 1,
  "reason": "Updated package on 192.0.2.0 from 15-DAY-TEST to COMPANY-INTERNAL-VPS."
}

1
2
3
---
status: 1
reason: Updated package on 192.0.2.0 from 15-DAY-TEST to COMPANY-INTERNAL-VPS.

Parameters

Important:

If more than one license uses the given IP address, you must provide the oldpackageid parameter.

This function accepts the following parameters:

Parameter Type Description Example
ip string Required
The license’s current IP address.
192.0.2.0
newpackageid string Required
The new package’s ID. The Manage2 List Package Information function returns a list of possible values.
P002
oldpackageid string Required
The license’s current package’s ID. The Manage2 List Package Information function returns a list of possible values.

If you do not use this parameter, the system attempts to determine the package ID for the supplied IP address.
P003
maxusers integer The maximum number of users allowed on the license.
  • A positive integer.
  • 0 — No users allowed.
If you do not use this parameter, the system defaults to unlimited users.
120

Returns

This function returns the following values:

Return Type Description Example
reason string Whether the function updated the package. Updated package on 192.0.2.0 from 15-DAY-TEST to COMPANY-INTERNAL-VPS.
status Boolean Whether the function succeeded:
  • 1 — Success.
  • 0 — Failure.
1

Additional Documentation