Use the terminate operation to close a specified session.

Request Packet Structure

A request XML packet terminating a specified session includes the terminate operation node:

<packet>
    <session>
        <termination>
            ...
        </termination>
    </session>
</packet>

The terminate node is presented by type SessionTerminateInput (session.xsd) and has the following graphical representation:

image 40428

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

  • The session-id node is required. It specifies the session ID. For info on how to retrieve the session ID, refer to the Retrieving Sessions List section. Data type: string.

Response Packet Structure

The terminate node of the output XML packet is presented by type SessionTerminateOutput (session.xsd) and structured as follows:

image 40432

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

  • The result node is required. It wraps the response retrieved from the server. Data type: resultType (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. Is returns the error code if the terminate operation fails. Data type: integer.
  • The errtext node is optional. It returns the error message if the terminate operation fails. Data type: string.

Samples

The request packet terminating the session win ID a66734b looks as follows:

<packet>
    <session>
        <terminate>
            <session-id>a66734b</session-id>
        </terminate>
    </session>
</packet>

Response:

<packet>
    <session>
        <terminate>
            <result>
                <status>ok</status>
            </result>
        </terminate>
    </session>
</packet>

If the session was not found on the server, the response looks as follows:

<packet>
    <session>
        <terminate>
            <result>
                <status>error</status>
                <errcode>1013</errcode>
                <errtext>Session does not exist</errtext>
            </result>
        </terminate>
    </session>
</packet>