Plesk XML API Error 2204: Login name is empty

2019-08-21 14:12发布

I can't find anything on Google about this, I am using the Plesk XML API with PHP but when I use this code:

//Add to Plesk
require("../../plesk-php-api.php");
$client = new PleskApiClient('broomfieldhosting.co.uk');
$client->setCredentials('admin', 'adminpassword');
//Webspace
$pleskDomainRequest = <<<EOF
<packet>
  <webspace>
    <add>
      <gen_setup>
        <name>flamingfireball64.com</name>
        <htype>vrt_hst</htype>
        <ip_address>104.238.170.144</ip_address>
      </gen_setup>
      <hosting>
        <vrt_hst>
            <ip_address>104.238.170.144</ip_address>
        </vrt_hst>
      </hosting>
      <plan-name>pro</plan-name>
    </add>
  </webspace>
</packet>
EOF;
$pleskDomainResponseXML = $client->request($pleskDomainRequest);

I get the following error:

Error 2204: Unable to update hosting preferences. System user update is failed: Unable to check system user existance: login name is empty. Incorrect fields: "login".

标签: php xml api plesk
1条回答
淡お忘
2楼-- · 2019-08-21 14:52

As I understand you would like to create a subscription flamingfireball64.com. You forgot to specify system user name and its password. Below API can be used to create a subscription. Replace my data with yours.

<packet>
<webspace>
    <add>
      <gen_setup>
        <name>testsubscription.test</name>
        <ip_address>10.39.91.61</ip_address>
      </gen_setup>
      <hosting>
        <vrt_hst>
          <property>
            <name>ftp_login</name>
            <value>someuser</value>
          </property>
          <property>
            <name>ftp_password</name>
            <value>somepassword</value>
          </property>
        </vrt_hst>
      </hosting>
          <plan-name>Unlimited</plan-name>
    </add>
  </webspace>
</packet>
查看更多
登录 后发表回答