Use the switch-subscription operation to associate a subscription with a different service plan.

Request Packet Structure

A request XML packet that switches a subscription to a different service plan includes the switch-subscription operation node:

<packet version="1.6.3.0">
<webspace>
   <switch-subscription>
   ...
   </switch-subscription>
</webspace>
</packet>

The switch-subscription node (domain_input.xsd) has the following graphical representation:

image 66393

Note: The interactive schema navigator for all request packets is available here: http://plesk.github.io/api-schemas/1.6.8.0/agent_input.svg.

  • The filter node is required. It specifies a filtering rule. For info on filters, refer to the Available Filters section. Data type: domainFilterType (domain_input.xsd).
  • The plan-guid node is required. It specifies the GUID of a plan. Data type: string.
  • The plan-external-id node is required. It specifies the ID of a service plan in the Panel components (for example, Business Manager). Data type: string.
  • The no-plan node is required. Use this node if want a subscription that is not associated with any of the service plans. Data type: none.

Response Packet Structure

The switch-subscription node of the output XML packet is structured as follows:

image 66405

Note: The interactive schema navigator for all response packets is available here: http://plesk.github.io/api-schemas/1.6.8.0/agent_output.svg.

  • The result node is required. It wraps the response retrieved from the server. Data type: ResultFilterType (plesk_common.xsd).
  • The status node is required. It specifies the execution status of the operation. Data type: string. Allowed values: ok | error.
  • The errcode node is optional. It is used to return the error code when the operation fails. Data type: unsignedInt.
  • The errtext node is optional. Can be used to return the error message if the operation fails. Data type: string.
  • The filter-id node is optional. It is required if the operation succeeds. Returns a filtering rule. For info on filters, refer to the Available Filters section. Data type: anySimple.
  • The id node is optional. It is required if the operation succeeds. Returns the unique identifier of the subscription. Data type: integer.
  • The problems node is optional. It outputs conflicts that occur on performing the operation. Data type: string.

Note: The problems node outputs a table with these columns: Description, Current, Requested, Allowed. The Description column holds the subscription option name (limit, permission, hosting setting). The Current column contains the current value of the option. The Requested column contains the requested value for the option. The Allowed column contains the changed values. The other values remain in the Current state after the operation is performed.

Samples

The request packet that switches the subscription with ID 5 to the plan with GUID cc982f71-48c3-479d-bc7b-59b97547e092 looks as follows:

<packet version ="1.6.3.0">
<webspace>
   <switch-subscription>
      <filter>
         <id>5</id>
      </filter>
       <plan-guid>cc982f71-48c3-479d-bc7b-59b97547e092</plan-guid>
   </switch-subscription>
</webspace>
</packet>

Response:

<packet version="1.6.3.0">
  <webspace>
    <switch-subscription>
      <result>
        <status>ok</status>
        <filter-id>5</filter-id>
        <id>5</id>
        <problems>Description                          Current                                                     Requested                                                   Allowed
Switch on log rotation (example.com) switched on (Log rotation condition: by size (195           switched on (Log rotation condition: by size (10.0          switched on (Log rotation condition: by size (10.0
                                     MB),
Maximum number of log files: 10,
Compress log files:   KB),
Maximum number of log files: 0,
Compress log files:    KB),
Maximum number of log files: 0,
Compress log files:
                                     switched on,
Send processed log files to e-mail: -)         switched on,
Send processed log files to e-mail: -)         switched on,
Send processed log files to e-mail: -)
Hard disk quota (example.com)        Unlimited                                                   Unlimited                                                   Unlimited
SSL support (example.com)            switched on                                                 switched off                                                switched off
SSI support (example.com)            switched off                                                switched on                                                 switched on</problems>
      </result>
    </switch-subscription>
  </webspace>
</packet>