You can find our user documentation at docs.cpanel.net.

Check out our new API beta site!

Child pages
  • UAPI Functions - Stats::list_sites
Skip to end of metadata
Go to start of metadata

Description

This function displays the Analog statistics for the domains on a cPanel account.

Examples


 cPanel or Webmail Session URL
https://hostname.example.com:2083/cpsess##########/execute/Stats/list_sites?engine=webalizer&traffic=http


Note:

This example calls the UAPI function via a cPanel session. For more information, read our Guide to UAPI documentation. 

 LiveAPI PHP Class
$cpanel = new CPANEL(); // Connect to cPanel - only do this once.
 
// Get account statistics for all sites on the cPanel account.
$list_sites = $cpanel->uapi(
    'Stats', 'list_sites',
    array(
        'engine'    => 'webalizer',
        'traffic'   => 'http',
  )
);


Note:

For more information, read our Guide to the LiveAPI System.

 LiveAPI Perl Module
my $cpliveapi = Cpanel::LiveAPI->new(); # Connect to cPanel - only do this once.
 
# Get account statistics for all sites on the cPanel account.
my $list_sites = $cpliveapi->uapi(
    'Stats', 'list_sites',
    {
        'engine'   => 'webalizer',
        'traffic'  => 'http',
    }
);


Note:

For more information, read our Guide to the LiveAPI System.

 

 Command Line
uapi --user=username Stats list_sites engine=webalizer traffic=http


Notes:

  • You must URI-encode values.
  • username represents your account-level username.
  • For more information and additional output options, read our Guide to UAPI documentation or run the uapi --help command. 
  • If you run CloudLinux™, you must use the full path of the uapi command:

    /usr/local/cpanel/bin/uapi


 Output (JSON)
{
	"messages": null,
	"errors": null,
	"status": 1,
	"metadata": {

	},
	"data": [{
		"path": "/tmp/user/webalizer/index.html",
		"ssl": 1,
		"domain": "example.com",
		"all_domains": "1"
	}]
}	


Note:

Use cPanel's API Shell interface (cPanel >> Home >> Advanced >> API Shell) to directly test cPanel API calls.

Parameters

ParameterTypeDescriptionPossible valuesExample
enginestring

Required

The statistics engine.

  • webalizer 
  • analog 
webalizer
trafficinteger

The web traffic type.

This parameter defaults to http.

  • http 
  • ftp 
http

Returns

ReturnTypeDescriptionPossible valuesExample
pathstring

The filepath to the statistics file.

A valid filepath.

/tmp/user/webalizer/index.html
sslBoolean

Whether the function generates statistics from SSL requests. 

  • 1 — Generates statistics for SSL requests.
  • 0 — Generates statistics for non-SSL requests.
1
domainstringThe domain for which to display statistics.A domain on the cPanel account.example.com
all_domains BooleanWhether the statistics file's filepath is for all the domains on a cPanel account.
  • 1 — All domains.
  • 0 — An individual domain.


1