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

 

Description

This function adds an IP address to the Greylisting Trusted Hosts list.

Examples 


 JSON API
https://hostname.example.com:2087/cpsess##########/json-api/create_cpgreylist_trusted_host?api.version=1&ip=1.2.3.4&ip-1=2.3.4.5
 XML API
https://hostname.example.com:2087/cpsess##########/xml-api/create_cpgreylist_trusted_host?api.version=1&ip=1.2.3.4&ip-1=2.3.4.5
 Command Line
whmapi1 create_cpgreylist_trusted_host ip=1.2.3.4 ip-1=2.3.4.5


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": "",
    "ips_failed": {
      
    },
    "ips_added": [
      {
        "comment": null,
        "create_time": "2015-02-17 10:07:06",
        "id": 2,
        "host_ip": "1.2.3.4"
      },
      {
        "comment": null,
        "create_time": "2015-02-17 10:07:06",
        "id": 3,
        "host_ip": "2.3.4.5"
      }
    ]
  },
  "metadata": {
    "version": 1,
    "reason": "OK",
    "result": 1,
    "command": "create_cpgreylist_trusted_host"
  }
}
 Output (XML)
<result>
    <data>
        <comment/>
        <ips_failed/>
        <ips_added>
            <comment/>
            <create_time>2015-02-17 10:08:26</create_time>
            <id>4</id>
            <host_ip>1.2.3.4</host_ip>
        </ips_added>
        <ips_added>
            <comment/>
            <create_time>2015-02-17 10:08:26</create_time>
            <id>5</id>
            <host_ip>2.3.4.5</host_ip>
        </ips_added>
    </data>
    <metadata>
        <version>1</version>
        <reason>OK</reason>
        <result>1</result>
        <command>create_cpgreylist_trusted_host</command>
    </metadata>
</result>


Note:

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

Parameters

ParameterTypeDescriptionPossible valuesExample
ipstring

Required

The record's IP address, or a range of IP addresses.

Note:

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

A valid IP address or range of IP addresses.192.168.0.1
commentstringA comment.A valid string with a maximum length of 255 characters.NoComment

Returns

Return

TypeDescriptionPossible valuesExample
commentstringA comment for the batch.A valid string with a maximum length of 255 characters.NoComment
ips_failedhashA hash of the IP addresses that the function failed to add to the Trusted Hosts list.This hash includes the comment return. 

comment

string

The reason for the failure.

The function returns this value in the ips_failed hash.

A valid string.Sorry, 192.168 is not a valid IP address.
ips_addedarray of hashes

An array of hashes of the IP addresses that the function added to the Trusted Hosts list.

Each hash includes the comment, create_time, id, and host_ip returns.

 

comment

string

A comment for the individual record.

The function returns this value in the ips_added array.

A valid string with a maximum length of 255 characters.Fascinating

create_time

string

The date and time at which the function created the record.

The function returns this value in the ips_added array.

The date and time in YYYY-MM-DD HH:mm:SS format, where:

  • YYYY represents the year.
  • MM represents the month.
  • DD represents the date.
  • HH represents the hour.
  • mm represents the minute.
  • SS represents the second.
2015-02-17 10:08:26

id

integer

The host's record number.

The function returns this value in the ips_added array.

A valid positive integer.42

host_ip

string

The trusted host's IP address.

The function returns this value in the ips_added array.

A valid IP address. 192.168.0.1