Description

This function checks whether news of a specified type exists.

Examples 


https://hostname.example.com:2087/cpsess##########/json-api/cpanel?cpanel_jsonapi_user=user&cpanel_jsonapi_apiversion=2&cpanel_jsonapi_module=News&cpanel_jsonapi_func=does_news_type_exist&type=global

$cpanel = new CPANEL(); // Connect to cPanel - only do this once.
 
// Add the "addondomain.com" addon domain.
$add_addon = $cpanel->api2(
    'News', 'does_news_type_exist', 
    array(
        'type' => 'global',
    ) 
);

 

my $cpliveapi = Cpanel::LiveAPI->new(); # Connect to cPanel - only do this once.
 
# Add the "addondomain.com" addon domain.
my $add_addon = $cpliveapi->api2(
    'News', 'does_news_type_exist',
    { 
        'type' => 'global', 
    }
);

 

cpapi2 --user=username News does_news_type_exist type=global

{
 "cpanelresult": {
   "apiversion": 2,
   "data": [
     1
   ],
   "func": "does_news_type_exist",
   "event": {
     "result": 1
   },
   "module": "News"
 }

   

Parameters

ParameterTypeDescriptionPossible valuesExample
typestring

Required

The type of news.

  • global
  • cpanel
  • resold
global

Returns

ReturnTypeDescriptionPossible valuesExample
resultBoolean

Whether there is news of the specified type available.

  • 1 — News available.
  • 0 — No news available.
1
reasonstring

A reason for failure.

This function only returns a value if it failed.

A string that describes the error.

This is an error message.