You can find our user documentation at docs.cpanel.net.

Check out our new API beta site!

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

Description

This function calls the WHM API 1 send_test_posturl function for your specified POST notification URLs. Users can specify POST notification URLs in the Contact Information section of WHM's Basic WebHost Manager Setup interface (WHM >> Home >> Server Configuration >> Basic WebHost Manager Setup).

Examples 


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


Notes:

  • Unless otherwise noted, 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":{
      "results":[
         {
            "url":"https://postman-echo.com/post",
            "result":{
               "payload":{
                  "headers":{
                     "set-cookie":"sails.sid=s%3Arpjt9JrVXDIYMxpjyUqLuCtcUxSwbEWX.6ldYuWKV2zqn%2BhmsUlAi7PtsIEd9RXI32y6gjg0gwJA; Path=/; HttpOnly",
                     "connection":"keep-alive",
                     "server":"nginx",
                     "vary":"Accept-Encoding",
                     "content-type":"application/json; charset=utf-8",
                     "content-length":"743",
                     "etag":"W/\"2e7-Klmw/9Djp5E2M7VZdH2LwFWXX6s\"",
                     "date":"Tue, 05 May 2020 19:10:13 GMT"
                  },
                  "content":"{\"args\":{},\"data\":\"\",\"files\":{},\"form\":{\"body\":\"This message confirms that “colins-dev.cpanel.net” (172.16.1.6) can send a message to you via Posturl.\\n\\nThis message was sent on Tuesday, May 5, 2020 at 7:10:13 PM UTC.\",\"subject\":\"Test message (ID: 88M7)\"},\"headers\":{\"x-forwarded-proto\":\"https\",\"host\":\"postman-echo.com\",\"content-length\":\"243\",\"content-type\":\"application/x-www-form-urlencoded\",\"user-agent\":\"Cpanel-HTTP-Tiny-FastSSLVerify/1.0\",\"x-forwarded-port\":\"443\"},\"json\":{\"body\":\"This message confirms that “colins-dev.cpanel.net” (172.16.1.6) can send a message to you via Posturl.\\n\\nThis message was sent on Tuesday, May 5, 2020 at 7:10:13 PM UTC.\",\"subject\":\"Test message (ID: 88M7)\"},\"url\":\"https://postman-echo.com/post\"}",
                  "status":"200",
                  "url":"https://postman-echo.com/post",
                  "reason":"OK",
                  "protocol":"HTTP/1.1",
                  "success":"1"
               },
               "message_id":"88M7"
            }
         }
      ]
   },
   "metadata":{
      "command":"verify_posturl_access",
      "result":1,
      "reason":"OK",
      "version":1
   }
}
 Output (XML)
<result>
   <data>
      <results>
         <element>
            <result>
               <message_id>88M7</message_id>
               <payload>
                  <content>
                     <args />
                     <data />
                     <files />
                     <form>
                        <body>This message confirms that “colins-dev.cpanel.net” (172.16.1.6) can send a message to you via Posturl.

This message was sent on Tuesday, May 5, 2020 at 7:10:13 PM UTC.</body>
                        <subject>Test message (ID: 88M7)</subject>
                     </form>
                     <headers>
                        <content-length>243</content-length>
                        <content-type>application/x-www-form-urlencoded</content-type>
                        <host>postman-echo.com</host>
                        <user-agent>Cpanel-HTTP-Tiny-FastSSLVerify/1.0</user-agent>
                        <x-forwarded-port>443</x-forwarded-port>
                        <x-forwarded-proto>https</x-forwarded-proto>
                     </headers>
                     <json>
                        <body>This message confirms that “colins-dev.cpanel.net” (172.16.1.6) can send a message to you via Posturl.

This message was sent on Tuesday, May 5, 2020 at 7:10:13 PM UTC.</body>
                        <subject>Test message (ID: 88M7)</subject>
                     </json>
                     <url>https://postman-echo.com/post</url>
                  </content>
                  <headers>
                     <connection>keep-alive</connection>
                     <content-length>743</content-length>
                     <content-type>application/json; charset=utf-8</content-type>
                     <date>Tue, 05 May 2020 19:10:13 GMT</date>
                     <etag>W/"2e7-Klmw/9Djp5E2M7VZdH2LwFWXX6s"</etag>
                     <server>nginx</server>
                     <set-cookie>sails.sid=s%3Arpjt9JrVXDIYMxpjyUqLuCtcUxSwbEWX.6ldYuWKV2zqn%2BhmsUlAi7PtsIEd9RXI32y6gjg0gwJA; Path=/; HttpOnly</set-cookie>
                     <vary>Accept-Encoding</vary>
                  </headers>
                  <protocol>HTTP/1.1</protocol>
                  <reason>OK</reason>
                  <status>200</status>
                  <success>1</success>
                  <url>https://postman-echo.com/post</url>
               </payload>
            </result>
            <url>https://postman-echo.com/post</url>
         </element>
      </results>
   </data>
   <metadata>
      <command>verify_posturl_access</command>
      <reason>OK</reason>
      <result>1</result>
      <version>1</version>
   </metadata>
</result>


Note:

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

Parameters

This function does not accept parameters.

Returns

Note:

If the Contact Information section of WHM's Basic WebHost Manager Setup interface (Home >> Server Configuration >> Basic WebHost Manager Setup) contains multiple POST URLs, the function will return an array that contains the results for each URL.

ReturnTypeDescriptionPossible valuesExample
results array of hashesAn array of hashes that contain POST notification URL data. This array of hashes contains the result hash and the url return.

result

 
hash

A hash of data about the POST notification URLs.

The function returns this value in the results array of hashes.

This hash includes the message_id return and payload hash.

message_id 

string

The test message's ID.

The function returns this value in the result hash.

A valid string.

88M7 

payload 

hash

A hash that contains information about a POST notification URL.

The function returns this value in the result hash.

This hash includes the content, reason, status, success, URL, and protocol returns and the headers hash.

headers 

hash

A hash of the header fields that the request returned.

The function returns this value in the payload hash.

A hash of valid header fields.

Note:

This hash's returns vary based on the URL's headers.

content

string

The URL's content.

The function returns this value in the payload hash.

A valid string.

 Click to view...
<!doctype html>\n<html>\n<head>\n    <title>Example Domain</title>\n\n    <meta charset=\"utf-8\" />\n    <meta http-equiv=\"Content-type\" content=\"text/html; charset=utf-8\" />\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\" />\n    <style type=\"text/css\">\n    body {\n        background-color: #f0f0f2;\n        margin: 0;\n        padding: 0;\n        font-family: -apple-system, system-ui, BlinkMacSystemFont, \"Segoe UI\", \"Open Sans\", \"Helvetica Neue\", Helvetica, Arial, sans-serif;\n        \n    }\n    div {\n        width: 600px;\n        margin: 5em auto;\n        padding: 2em;\n        background-color: #fdfdff;\n        border-radius: 0.5em;\n        box-shadow: 2px 3px 7px 2px rgba(0,0,0,0.02);\n    }\n    a:link, a:visited {\n        color: #38488f;\n        text-decoration: none;\n    }\n    @media (max-width: 700px) {\n        div {\n            margin: 0 auto;\n            width: auto;\n        }\n    }\n    </style>    \n</head>\n\n<body>\n<div>\n    <h1>Example Domain</h1>\n    <p>This domain is for use in illustrative examples in documents. You may use this\n    domain in literature without prior coordination or asking for permission.</p>\n    <p><a href=\"https://www.iana.org/domains/example\">More information...</a></p>\n</div>\n</body>\n</html>\n

status

string

The response's HTTP status code.

The function returns this value in the payload hash.

A valid HTTP status code.200 

url

string

The URL that provided the response.

The function returns this value in the payload hash.

A valid URL. http://www.example.com

reason

string

The response that the server returned.

The function returns this value in the payload hash.

A valid string.OK

protocol

string

The URL's HTTP protocol.

The function returns this value in the payload hash.

A valid HTTP protocol.

HTTP/1

success

Boolean

Whether the function returned a 2XX HTTP status code.

The function returns this value in the payload hash.

  • 1 — Success.
  • 0 — Failure.


1

url

string

The URL and query string for the POST notification URL.

The function returns this value in the results array of hashes.

A valid URL. https://postman-echo.com/post