• 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 Сhange subscription expire date via REST API

pvl

New Pleskian
Hi!
How to change subscription expire date via REST API? Via XML - found it, via REST - no. I searched in CLI gate entry points, but there is nothing.
 
Yes.
Have you tried to use REST API call for subscription CLI utility as the first example from KB article How to manage Plesk via REST API? ?
Yes. Found and tried to change the creation date - successfully.
Code:
curl -X POST "https://***.****.***:8443/api/v2/cli/domain/call" -H "accept: application/json" -H "Content-Type: application/json" -d "{ \"params\": [ \"--update\", \"****.****.***\", \"-creation-date\", \"2021-10-10\" ] }"

{
  "code": 0,
  "stdout": "SUCCESS: Update of domain '****.****.***' completed.",
  "stderr": ""
}

Change expire date....

Code:
curl -X POST "https://***.****.***:8443/api/v2/cli/domain/call" -H "accept: application/json" -H "Content-Type: application/json" -d "{ \"params\": [ \"--update\", \"****.****.***\", \"-expire-date\", \"2021-11-11\" ] }"

{
  "code": 1,
  "stdout": "",
  "stderr": "Unrecognized option: '-expire-date'"
}

For the subscription CLI-command, I also did not find the expire-date parameter. Command webspace (by analogy with the XML) is also no
 
You have to use this utility with the corresponding option:

Code:
# plesk bin subscription_settings --help | grep expir
                                       updates expiration date.
    -expiration        <YYYY-MM-DD>    Sets the subscription expiration date
                                       (-1 is for no expiration).
 
You have to use this utility with the corresponding option:

Code:
# plesk bin subscription_settings --help | grep expir
                                       updates expiration date.
    -expiration        <YYYY-MM-DD>    Sets the subscription expiration date
                                       (-1 is for no expiration).
Igor, I don’t understand, but how to call this utility through Rest API? Explain please.
 
I have never tried this, but I suppose everything is done exactly like in the example, only you change the utility and its option.
Something like:

Code:
curl -X POST "https://***.****.***:8443/api/v2/cli/subscription_settings/call" -H "accept: application/json" -H "Content-Type: application/json" -d "{ \"params\": [ \"--update\", \"yourdomain.com\", \"-expiration\", \"2021-11-11\" ] }"
 
I have never tried this, but I suppose everything is done exactly like in the example, only you change the utility and its option.
Something like:

Code:
curl -X POST "https://***.****.***:8443/api/v2/cli/subscription_settings/call" -H "accept: application/json" -H "Content-Type: application/json" -d "{ \"params\": [ \"--update\", \"yourdomain.com\", \"-expiration\", \"2021-11-11\" ] }"
Hmm.....
Code:
curl -X POST "https://****.****.***:8443/api/v2/cli/subscription_settings/call" -H "accept: application/json" -H "Content-Type: application/json" -d "{ \"params\": [ \"--update\", \"****.****.***\", \"-expiration\", \"2021-11-11\" ] }"

{
  "code": 0,
  "message": "Command 'subscription_settings' not found"
}

and
Code:
curl -X POST "https://****.****.***:8443/api/v2/cli/subscription/call" -H "accept: application/json" -H "Content-Type: application/json" -d "{ \"params\": [ \"--update\", \"****.****.***\", \"-expiration\", \"2021-11-11\" ] }"

{
  "code": 1,
  "stdout": "",
  "stderr": "Unrecognized option: '-expiration'"
}

ver 18.0.34.... Apparently not yet =)
 
Last edited:
So... It turns out not to change the expiration date via REST API?
Does version 18 support XML? Or maybe there are some other ways to change expiration date remotely?
 
Hello PVL, hello rest of the world,

after trying and failing with the curl command from above, i dug a bit deeper and found out that the subscription_settings are simply named different in the rest api. You can manage all settings of a subscription by using the domain_pref instead of subscription settings. The following did work for me:

curl -X POST "https://***.****.***:8443/api/v2/cli/domain_pref/call" -H "accept: application/json" -H "Content-Type: application/json" -d "{ \"params\": [ \"--update\", \"yourdomain.com\", \"-expiration\", \"2022-11-11\" ] }"

Hope that helps!
 
Back
Top