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

 

Description

This function uses the specified URL to send a test message through the POST method of HTTP as form data.

The function automatically generates a message title and body and includes a unique string in the test message. When the test message returns, the system searches for the ID string and returns it.

If the function does not detect the correct ID string in the returned message, the function fails.

The test's success or failure depends on various conditions. For example:

  • Valid access token.
  • Network configuration.
  • Service outages.
  • External server rate limit.

Examples 


 JSON API
https://hostname.example.com:2087/cpsess##########/json-api/send_test_posturl?api.version=1&url=https%3A%2F%2Fwww.example.com%2Fevents.cgi%3Fapikey%3D12345%26user%3Dusername*password%3D12345luggage
 XML API
https://hostname.example.com:2087/cpsess##########/xml-api/send_test_posturl?api.version=1&url=https%3A%2F%2Fwww.example.com%2Fevents.cgi%3Fapikey%3D12345%26user%3Dusername*password%3D12345luggage
 Command Line
whmapi1 send_test_posturl url=https%3A%2F%2Fwww.example.com%2Fevents.cgi%3Fapikey%3D12345%26user%3Dusername*password%3D12345luggage


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/api/whmapi1

 Output (JSON)
{  
   "data":{  
      "message_id":"555a3994-173a4a271062d"
   },
   "metadata":{  
      "version":1,
      "reason":"OK",
      "result":"1",
      "command":"send_test_posturl"
   }
}
 Output (XML)
<result>
    <data>
        <message_id>555a3b48-1b167d113be2c</message_id>
    </data>
    <metadata>
        <version>1</version>
        <reason>OK</reason>
        <result>1</result>
        <command>send_test_posturl</command>
    </metadata>
</result>


Note:

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

   

Parameters

ParameterTypeDescriptionPossible valuesExample
urlstring

Required

The URL and query string to send.

A valid URL in uuencoded format.

Note:

The system automatically sends the parameter's hostname, subject, and body with the relevant data from the alert.

  • To send additional parameters, include those keys after the URL. For example, to send the apikey parameter with a value of XXXXX, append ?apikey=XXXXX to the URL.
  • To add additional parameters and values, separate those additional values with the ampersand character ( & ) instead of the question mark character ( ? ). For example, to include a state parameter of Texas and a status parameter of CRITICAL, append ?apikey=XXXXX&state=Texas&status=CRITICAL to the URL.
  • If you enter a secure URL (https://), that site's certificate must be valid.
 Click to view...

https%3A%2F%2Fwww.example.com%2Fevents.cgi%3Fapikey%3D12345%26user%3Dusername*password%3D12345luggage

Returns

ReturnTypeDescriptionPossible valuesExample
message_idstring

The test message's ID.

A valid string.

554d2cbd-efe61da3cacb