• Our team is looking to connect with folks who use email services provided by Plesk, or a premium service. If you'd like to be part of the discovery process and share your experiences, we invite you to complete this short screening survey. If your responses match the persona we are looking for, you'll receive a link to schedule a call at your convenience. We look forward to hearing from you!
  • The BIND DNS server has already been deprecated and removed from Plesk for Windows.
    If a Plesk for Windows server is still using BIND, the upgrade to Plesk Obsidian 18.0.70 will be unavailable until the administrator switches the DNS server to Microsoft DNS. We strongly recommend transitioning to Microsoft DNS within the next 6 weeks, before the Plesk 18.0.70 release.
  • The Horde component is removed from Plesk Installer. We recommend switching to another webmail software supported in Plesk.

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