• Please be aware: Kaspersky Anti-Virus has been deprecated
    With the upgrade to Plesk Obsidian 18.0.64, "Kaspersky Anti-Virus for Servers" will be automatically removed from the servers it is installed on. We recommend that you migrate to Sophos Anti-Virus for Servers.
  • The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.
  • We’re working on enhancing the Monitoring feature in Plesk, and we could really use your expertise! If you’re open to sharing your experiences with server and website monitoring or providing feedback, we’d love to have a one-hour online meeting with you.

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