• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Question Plesk Downgrade Key API

InsertCoin

Basic Pleskian
Hi,

I am expanding some internal systems to allow keys to be downgraded when required, unfortunately, the API documentation is a little cryptic.

partner10.downgradeKey

The API requires that the 3rd parameter is "name of the upgrade plan to remove". I thought I would be able to use the constants as found here, but these are only for upgrades and I can't discern the right name of the upgrade plan to remove and then how to add in the required name to downgrade to.

Any help would be most welcome.
 
Indeed, there is a misunderstanding with the downgrade.
It is better to explain by example. To upgrade the Plesk Web Pro license -> Plesk Web Host you need a call:

partner10.upgradeKey( <KEY_NUMBER>, "PLESK-12-WEB-PRO-TO-PLESK-12-WEB-HOST" )

And to downgrade Plesk Web Host -> Plesk Web Pro you need a call:

partner10.downgradeKey( <KEY_NUMBER>, "PLESK-12-WEB-PRO-TO-PLESK-12-WEB-HOST" )

that is, the upgrade plan "PLESK-12-WEB-PRO-TO-PLESK-12-WEB-HOST" will be applied backwards.

BTW, The operation of downgrade is not included in the standard role. It requires extended privileges. And why do not you use Partner 3.0? - it's more understandable in my opinion - Modifying a License Key
 
BTW, The operation of downgrade is not included in the standard role. It requires extended privileges. And why do not you use Partner 3.0? - it's more understandable in my opinion - Modifying a License Key

Just looked at my code and I am using the API 3.0 :/ Google sent me to the other API when I was searching.

Still, I am confused on the API 3.0 documentation. Does it use the same principal as you detailed above? and I just need to "PUT" a request over:

PHP:
$apiRequest = array(
 "item" => "PLESK-12-WEB-PRO-TO-PLESK-12-WEB-HOST"
);

curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($apiRequest));
 
If you are using Partner API 3.0 then you just need to specify the desired state of the key.

Creating a Web Host:
Code:
POST  /keys
{
  "items": [
     {"item": "PLESK-12-WEB-HOST-1M"}
  ]
}
Downgrade to Web Pro:
Code:
PUT /keys/<keynumber>
{
"items": [
    {"item": "PLESK-12-WEB-PRO-1M"}
  ]
}
 
And please be sure that you have corresponding rights. By default, downgrade is prohibited.
 
Back
Top