Child pages
  • UAPI Functions - Features::has_feature
Skip to end of metadata
Go to start of metadata

Description

This function checks whether a cPanel account has access to a feature.

Examples


 cPanel or Webmail Session URL
https://hostname.example.com:2083/cpsess##########/execute/Features/has_feature?name=autossl


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.
 
// Check if the cPanel account can access a feature.
$instances = $cpanel->uapi(
    'Features', 'has_features',
		array(
			'name'    => 'autossl',
		)
);


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.
 
# Check if the cPanel account can access a feature.
my $instances = $cpliveapi->uapi(
    'Features', 'has_feature',
		{
			'name'    => 'autossl',
		}
);


Note:

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

 Command Line
uapi --user=username Features has_feature name=autossl


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)

The account does not have a feature:

{
   "result":{
      "errors":null,
      "metadata":{
      },
      "status":0,
      "warnings":null,
      "data":null,
      "messages":null
   }
}

The account has a feature:

{
   "result":{
      "errors":null,
      "metadata":{
      },
      "status":1,
      "warnings":null,
      "data":null,
      "messages":null
   }
}

The feature exists but the account does not have it enabled:

{
   "result":{
      "data":null,
      "metadata":{
      },
      "warnings":null,
      "errors":null,
      "messages":[
         "The feature “autossl” exists but is not enabled."
      ],
      "status":0
   }
}


Note:

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

Parameters

ParameterTypeDescriptionPossible valuesExample
namestring

Required

The feature's name.

A valid string.
autossl

Returns

ReturnTypeDescriptionPossible valuesExample
messagesarray of stringsA message about the feature's status.
  • A status message.

    Note:

    The system only returns a message when a feature exists but it is not enabled.

  • null

null

statusBooleanWhether the feature exists on the system.
  • 1 — The feature exists on the system and it is enabled.
  • 0 — The feature exists on the system, but the user does not have it.

  • undef — The feature is not installed on the system.

1