• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Cannot list sites through api

Jelle_Timmer

Basic Pleskian
Hi,

I'm trying to get a list of all sites on a Plesk 12 server.

This is the request:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<packet version="1.6.6.0">
  <site>
    <get>
      <filter/>
      <dataset>
        <hosting/>
        <gen_info/>
      </dataset>
    </get>
  </site>
</packet>

And this is the response:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<packet version="1.6.6.0">
  <site>
    <get>
      <result>
        <status>ok</status>
      </result>
    </get>
  </site>
</packet>

Stepping back to an older protocol-version to use 'domain' instead of 'site' is no option for me because all of my sites have IPv6-addresses, which are not supported by protocol-versions older than 1.6.3.2.

When i would be using an older version with 'domain', the response would be:
Code:
<packet version="1.6.2.0">
  <domain>
    <get>
      <result>
        <status>ok</status>
        <filter-id>1</filter-id>
        <id>1</id>
        <data>
          <gen_info>
            <cr_date>2015-04-13</cr_date>
            <name>example.com</name>
            <ascii-name>example.com</ascii-name>
            <status>0</status>
            <real_size>483328</real_size>
            <owner-login>admin</owner-login>
            <dns_ip_address>xxx.xxx.xxx.xxx</dns_ip_address>
            <htype>vrt_hst</htype>
            <guid>ac82559c-e0fc-4fb6-bbff-7942def5fd98</guid>
          </gen_info>
          <hosting>
            <vrt_hst>
              <property>
                <name>ftp_login</name>
                <value>username</value>
              </property>
              <property>
                <name>ftp_password</name>
                <value>password</value>
              </property>
              <property>
                <name>ftp_password_type</name>
                <value>plain</value>
              </property>
              <property>
                <name>ftp_quota</name>
                <value>-1</value>
              </property>
              <property>
                <name>fp</name>
                <value>false</value>
              </property>
              <property>
                <name>fp_ssl</name>
                <value>false</value>
              </property>
              <property>
                <name>fp_auth</name>
                <value>false</value>
              </property>
              <property>
                <name>fp_admin_login</name>
                <value/>
              </property>
              <property>
                <name>fp_admin_password</name>
                <value/>
              </property>
              <property>
                <name>ssl</name>
                <value>true</value>
              </property>
              <property>
                <name>shell</name>
                <value>/bin/false</value>
              </property>
              <property>
                <name>php</name>
                <value>true</value>
              </property>
              <property>
                <name>php_handler_type</name>
                <value>fastcgi</value>
              </property>
              <property>
                <name>ssi</name>
                <value>false</value>
              </property>
              <property>
                <name>cgi</name>
                <value>true</value>
              </property>
              <property>
                <name>perl</name>
                <value>true</value>
              </property>
              <property>
                <name>python</name>
                <value>true</value>
              </property>
              <property>
                <name>asp</name>
                <value>false</value>
              </property>
              <property>
                <name>asp_dot_net</name>
                <value>false</value>
              </property>
              <property>
                <name>miva</name>
                <value>false</value>
              </property>
              <property>
                <name>coldfusion</name>
                <value>false</value>
              </property>
              <property>
                <name>webstat</name>
                <value>awstats</value>
              </property>
              <property>
                <name>webstat_protected</name>
                <value>true</value>
              </property>
              <property>
                <name>errdocs</name>
                <value>true</value>
              </property>
              <property>
                <name>at_domains</name>
                <value>false</value>
              </property>
              <property>
                <name>fastcgi</name>
                <value>true</value>
              </property>
              <property>
                <name>cgi_mode</name>
                <value/>
              </property>
              <property>
                <name>www_root</name>
                <value>/var/www/vhosts/example.com/httpdocs</value>
              </property>
              <property>
                <name>safe_mode</name>
                <value>off</value>
              </property>
              <property>
                <name>open_basedir</name>
                <value>{WEBSPACEROOT}{/}{:}{TMP}{/}</value>
              </property>
              <property>
                <name>apache-restrict-follow-sym-links</name>
                <value>false</value>
              </property>
              <property>
                <name>nginx-transparent-mode</name>
                <value>false</value>
              </property>
              <property>
                <name>nginx-serve-static</name>
                <value>false</value>
              </property>
              <ip_address>xxx.xxx.xxx.xxx</ip_address>
            </vrt_hst>
          </hosting>
        </data>
      </result>
      <result>
        <status>error</status>
        <errcode>1017</errcode>
        <errtext>IPv6 addresses are not support in protocols below 1.6.3.2</errtext>
        <filter-id>2</filter-id>
        <id>2</id>
      </result>
      <result>
        <status>error</status>
        <errcode>1017</errcode>
        <errtext>IPv6 addresses are not support in protocols below 1.6.3.2</errtext>
        <filter-id>3</filter-id>
        <id>3</id>
      </result>
      <result>
        <status>error</status>
        <errcode>1017</errcode>
        <errtext>IPv6 addresses are not support in protocols below 1.6.3.2</errtext>
        <filter-id>4</filter-id>
        <id>4</id>
      </result>
    </get>
  </domain>
</packet>

Is there another option to get a full list of all sites (and domains) on my server by using the API?

With kind regards...
 
I tried your request with method described here http://download1.parallels.com/Plesk/PP12/12.0/Doc/en-US/online/plesk-api-rpc/33126.htm and all works fine on my test Plesk12 server:

[root@ppu12-0 ~]# REMOTE_HOST=localhost REMOTE_LOGIN=admin REMOTE_PASSWORD=setup ./example.py
<?xml version="1.0" encoding="UTF-8"?>
<packet version="1.6.6.0">
<site>
<get>
<result>
<status>ok</status>
<filter-id>7</filter-id>
<id>7</id>
<data>
<gen_info>
<cr_date>2015-04-16</cr_date>
<name>kiehnskilesandkling.ppu12-0.demo.pp.plesk.ru</name>
<ascii-name>kiehnskilesandkling.ppu12-0.demo.pp.plesk.ru</ascii-name>
<status>0</status>
<real_size>0</real_size>
<dns_ip_address>10.58.103.102</dns_ip_address>
<htype>vrt_hst</htype>
<guid>b3eba34a-ec12-49a2-8922-87a54b5608de</guid>
<webspace-guid>67375848-9830-4fa8-8194-65562d49618a</webspace-guid>
<sb-site-uuid/>
<webspace-id>6</webspace-id>
<description/>
</gen_info>
<hosting>
<vrt_hst>
<property>
<name>seo-redirect</name>
<value>none</value>
</property>
<property>
<name>ftp_login</name>
....................
 
Hi Igor,

Thank you for your reply. I see I forgot to mention i'm trying to connect with PHP and curl.
But even when running the python-script I get the same response as when running PHP.

Only status 'OK', no list of sites (it should return 4 sites).

Do I need to configure something Plesk itself before the API should be working for me?

I'm running Plesk on a VPS on which I have full rights. So there shouldn't be any ISP-limitations.
  • OS: CentOS 6.6 (Final)
  • Plesk version: 12.0.18 Update #41, last updated at April 13, 2015 01:14 PM
 
Last edited:
Back
Top