Description

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


Examples




https://hostname.example.com:2083/cpsess##########/execute/Features/has_feature?name=autossl



$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',
		)
);

 



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',
		}
);



<!-- Check if the cPanel account can access a feature. -->
[% data = execute( 'Features', 'has_feature', { name => 'autossl'}  ); %]
[% FOREACH q = data.has_feature %]
     <p>
         [% q %]
     </p>
[% END %]



uapi --user=username Features has_feature name=autossl


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
   }
}



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.

    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