Creating Secret Key

Use the create operation to create a secret key.

Note: To create a secret key, you should specify the IP address and (or) login this secret key will be linked to. Packets sent with this key from different IP's will not be proceeded by Plesk API RPC service.

In this chapter:

Request Packet Structure

Response Packet Structure

Samples

 

Request Packet Structure

A request XML packet creating a secret key includes the create operation node:

<packet>
<secret_key>
<create>
...  
</create>
</secret_key>
</packet>

 

The create node has the following graphical representation:

Secret_key_create

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 ip_address node is optional. It specifies the IP address that will be linked to the key. If this node is not specified, the IP address of the request sender will be used. Data type: ip_address (common.xsd).
  • The description node is optional. It specifies additional information about the key. Data type: string.
  • The login node is optional. It specifies the login name of an existing customer or a reseller that will have this secret key. The customer's or reseller's account should be active. If this node is not specified, the administrator's login will be used. Data type: string.

Remarks

You can create multiple secret keys in a single packet. Add as many create operations as the number of keys to be created.

<create>
   ...
</create>
   ...
<create>
   ...
</create>

Important: When creating request packets, put nodes and elements in the order they follow in the packet structure.

 

Response Packet Structure

The create node of the output XML packet is structured as follows:

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 create operation. Data type: string. Allowed values: ok | error.
  • The errcode node is optional. Is returns the error code if the create operation fails. Data type: integer.
  • The errtext node is optional. It returns the error message if the create operation fails. Data type: string.
  • The key node is optional. It holds the key value if the operation succeeds. Data type: string.
 

Samples

Creating a single secret key linked to IP address

This request packet creates the secret key for IP 192.0.2.1.

<packet>
<secret_key>
   <create>
      <ip_address>192.0.2.1</ip_address>
   </create>
</secret_key>
</packet>

Response:

<packet>
<secret_key>
   <create>
      <result>
         <status>ok</status>
         <key>6575fae36288be6d1bad40b99808e37f</key>
      </result>
   </create>
</secret_key>
</packet> 
Creating a single secret key linked to IP address for a customer

This request packet creates the secret key linked to IP 192.0.2.1 for the customer user_demo.

<packet>
<secret_key>
   <create>
      <ip_address>192.0.2.1</ip_address>
      <login>user_demo</login>
   </create>
</secret_key>
</packet>

Response:

<?xml version="1.0" encoding="UTF-8"?>
<packet version="1.6.8.0">
  <secret_key>
    <create>
      <result>
        <status>ok</status>
        <key>c5b239d1-8eb6-8cee-76b7-aa16be37fee8</key>
      </result>
    </create>
  </secret_key>
</packet>
Creating multiple secret keys

This request packet creates secret keys for User1, and for User2.

<packet>
<secret_key>
 
   <create>
      <ip_address>192.0.2.2</ip_address>
      <description>For User1</description>
   </create>
 
   <create>
      <ip_address>192.0.2.3</ip_address>
      <description>For User2</description>
   </create>
 
</secret_key>
</packet>

Response:

<packet>
<secret_key>
 
   <create>
      <result>
         <status>ok</status>
         <key>6575fae36288be6d1bad40b99808e37f</key>
      </result>
   </create>
 
   <create>
      <result>
         <status>ok</status>
         <key>e1b9288a886c82f652921a34ea5e3e62</key>
      </result>
   </create>
 
</secret_key>
</packet>
 

Leave your feedback on this topic here

If you have questions or need support, please visit the Plesk forum or contact your hosting provider.
The comments below are for feedback on the documentation only. No timely answers or help will be provided.