Plesk XML API Error 2204: Login name is empty

微笑、不失礼 提交于 2019-12-13 04:32:44

问题


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".


回答1:


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>


来源:https://stackoverflow.com/questions/52085635/plesk-xml-api-error-2204-login-name-is-empty

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!