plesk-onyx

change plesk subscription expire date via API


how can i prolong plesk subscription expire date via XML RPC or REST? in the following code i can create subrcription, but i want a way to change the expiration date after creation.

<webspace>
    <add>
      <gen_setup>
        <name>{domainName}</name>
        <owner-login>{username}</owner-login>
        <ip_address>1.1.1.1</ip_address>
      </gen_setup>
      <hosting>
        <vrt_hst>
         <property>
            <name>ftp_login</name>
            <value>ftp_{ftpUsername}</value>
          </property>
          <property>
            <name>ftp_password</name>
            <value>{pass}</value>
          </property>
          <ip_address>1.1.1.1</ip_address>
        </vrt_hst>
      </hosting>
      <plan-name>{plan}</plan-name>
    </add>
  </webspace>

Solution

  • You can get subscription properties which include experation date in UNIXTIME using the following request:

    <?xml version="1.0" encoding="UTF-8"?>
    <packet version="1.6.7.0">         
     <webspace>
      <get>
       <filter>
        <name>example.com</name>
       </filter>
       <dataset>
        <limits/>
       </dataset>
      </get>
     </webspace>
    </packet>
    

    To set the expiration date, use:

    <?xml version="1.0" encoding="UTF-8"?>
    <packet version="1.6.7.0">         
     <webspace>
      <set>
       <filter>
        <name>example.com</name>
       </filter>
       <values>
        <limits>
         <limit>
          <name>expiration</name>
          <value>1600000000</value>
         </limit>
        </limits>
       </values>
      </set>
     </webspace>
    </packet>
    

    Where example.com is a subscription name, 1600000000 - expiration date in UNIXTIME.