Child pages
  • WHM API 1 Functions - create_cphulk_record
Skip to end of metadata
Go to start of metadata

Description

This function adds a new record or records to cPHulk's whitelist or blacklist.

Examples


 JSON API
https://hostname.example.com:2087/cpsess##########/json-api/create_cphulk_record?api.version=1&list_name=white&ip=192.168.0.1&comment=George%20Wendt%20flying%20through%20the%20air.
 XML API
https://hostname.example.com:2087/cpsess##########/xml-api/create_cphulk_record?api.version=1&list_name=white&ip=192.168.0.1&comment=George%20Wendt%20flying%20through%20the%20air.
 Command Line
whmapi1 create_cphulk_record list_name=white ip=192.168.0.1 comment=George%20Wendt%20flying%20through%20the%20air.


Notes:

  • You must URI-encode values.
  • For more information and additional output options, read our Guide to WHM API 1 documentation or run the whmapi1 --help command.
  • If you run CloudLinux™, you must use the full path of the whmapi1 command:

    /usr/local/cpanel/bin/whmapi1

 Output (JSON)
{  
   "data":{  
      "comment":"George Wendt flying through the air.",
      "ips_failed":{  

      },
      "requester_ip":"10.1.1.1",
      "list_name":"white",
      "ips_added":[  
         "192.168.0.1"
      ]
   },
   "metadata":{  
      "version":1,
      "reason":"OK",
      "result":1,
      "command":"create_cphulk_record"
   }
}
 Output (XML)
<result>
    <data>
        <comment>George Wendt flying through the air</comment>
        <ips_failed/>
        <list_name>white</list_name>
        <requester_ip>10.1.4.228</requester_ip>
        <ips_added>192.168.0.1</ips_added>
    </data>
    <metadata>
        <version>1</version>
        <reason>OK</reason>
        <result>1</result>
        <command>create_cphulk_record</command>
    </metadata>
</result>


Note:

Use WHM's API Shell interface (WHM >> Home >> Development >> API Shell) to directly test WHM API calls.

Parameters

ParameterTypeDescriptionPossible valuesExample
list_namestring

Required

The cPHulk list's name.

  • black
  • white
white
ipstring

Required

The record's IP address, if there is only one IP address to add.

Note:

To add multiple IP addresses, increment the parameter name. For example, ip-1, ip-2, ip-3

A valid IP address.192.168.0.1
commentstringA comment to include.A valid string with a maximum length of 255 characters.George Wendt flying through the air.

Returns

ReturnTypeDescriptionPossible valuesExample
commentstringThe comment that you included when you called the function.The comment input parameter's value.George Wendt flying through the air.

list_name

stringThe cPHulk list's name.
  • black
  • white
white
requester_ipstringThe IP address of the user or system that requested the addition.A valid IP address.
10.1.4.228
              
ips_addedarray of stringsAn array of the IP addresses that the function removed from the list.An array of IP addresses.192.168.0.1
ips_failedhashA hash of the IP addresses that the system failed to add to the list.This hash contains one or more IP address returns. 

IP address

string

The reason why the system failed to add an IP address to the list.

Note:

The IP address is the return's name.

The function returns this value in the ips_failed hash.

A valid string.Invalid IP address or range: "192.68.0.1"