Child pages
  • WHM API 1 Functions - create_cpgreylist_trusted_host

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

 

Description

Excerpt

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

Panel
bgColor#F2F2F2
borderStylenone

Examples 


Panel
bgColor#FFFFFF
borderStylenone
Expand
titleJSON API
Code Block
languagexml
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
Expand
titleXML API
Code Block
languagexml
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
Expand
titleCommand Line
Code Block
languagebash
whmapi1 create_cpgreylist_trusted_host ip=1.2.3.4 ip-1=2.3.4.5

Include Page
LIB:_WHMAPI1CLINote
LIB:_WHMAPI1CLINote

Expand
titleOutput (JSON)
Code Block
languagetext
linenumberstrue
{
  "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"
  }
}
Expand
titleOutput (XML)
Code Block
languagetext
linenumberstrue
<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>

Include Page
LIB:_WHMAPIShellNote
LIB:_WHMAPIShellNote

Parameters

ParameterTypeDescriptionPossible valuesExample
ipstring

Required

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

Note
titleNote:

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