To delete secret keys from the server, use the delete operation.

Request Packet Structure

A request XML packet that deletes secret keys includes the delete operation node:

<packet>
   <secret_key>
      <delete>
         ...
      </delete>
   </secret_key>
</packet>

The delete node has the following graphical representation:

image 37158

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 the filtering rule. To delete all secret keys located on the server, use the blank filter node (<filter/>). Data type: complex.
  • The key node is optional. To delete a secret key, specify its value or ID for this node. Data type: string.

Remarks

You can delete multiple secret keys in a single request. To do so, add as many key parameters to filter as many secret keys you want to delete.

<filter>
   <key>...</key>
   ...
   <key>...</key>
</filter>

Response Packet Structure

The delete node of the response XML packet is structured as follows:

image 37161

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: resultType (common.xsd).
  • The status node is required. It specifies the execution status of the delete operation. Data type: string. Allowed values: ok | error.
  • The errcode node is optional. It returns an error code if the delete operation fails. Data type: integer.
  • The errtext node is optional. It returns an error message if the delete operation fails. Data type: string.
  • The key node is optional. It holds the secret key ID if the operation succeeds. Data type: string.

Samples

Deleting a Secret Key

The following request deletes the secret key 0a45eb21-a9e7-4051-9ae8-a8f5d996874e:

<packet>
   <secret_key>
      <delete>
         <filter>
            <key>0a45eb21-a9e7-4051-9ae8-a8f5d996874e</key>
         </filter>
      </delete>
   </secret_key>
</packet>

Response:

<?xml version="1.0" encoding="UTF-8"?>
<packet version="1.6.9.1">
  <secret_key>
    <delete>
      <result>
        <status>ok</status>
        <key>4</key>
      </result>
    </delete>
  </secret_key>
</packet>

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

<?xml version="1.0" encoding="UTF-8"?>
<packet version="1.6.9.1">
  <secret_key>
    <delete>
      <result>
        <status>error</status>
        <errcode>1013</errcode>
        <errtext>secret key does not exist</errtext>
        <key>0a45eb21-a9e7-4051-9ae8-a8f5d996874e</key>
      </result>
    </delete>
  </secret_key>
</packet>

Deleting Multiple Secret Keys

The following request deletes the secret keys with the IDs 1 and 2:

<packet>
   <secret_key>
      <delete>
         <filter>
            <key>1</key>
            <key>2</key>
         </filter>
      </delete>
   </secret_key>
</packet>

Reponse:

<?xml version="1.0" encoding="UTF-8"?>
<packet version="1.6.9.1">
  <secret_key>
    <delete>
      <result>
        <status>ok</status>
        <key>1</key>
      </result>
      <result>
        <status>ok</status>
        <key>2</key>
      </result>
    </delete>
  </secret_key>
</packet>

Deleting All Secret Keys

The following request deletes all secret keys located on the server:

<packet>
   <secret_key>
      <delete>
         <filter>
         </filter>
      </delete>
   </secret_key>
</packet>

Reponse:

<?xml version="1.0" encoding="UTF-8"?>
<packet version="1.6.9.1">
  <secret_key>
    <delete>
      <result>
        <status>ok</status>
        <key>1</key>
      </result>
      <result>
        <status>ok</status>
        <key>2</key>
      </result>
    </delete>
  </secret_key>
</packet>