You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

93 lines
5.1 KiB

4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
  1. <h1>Pinging API</h1>
  2. <p>With the Pinging API, you can signal <strong>success</strong>, <strong>fail</strong>, and <strong>start</strong> events from
  3. your systems.</p>
  4. <h2>General Notes</h2>
  5. <p>All ping endpoints support:</p>
  6. <ul>
  7. <li>HTTP and HTTPS</li>
  8. <li>HTTP 1.0, HTTP 1.1 and HTTP 2</li>
  9. <li>IPv4 and IPv6</li>
  10. <li>HEAD, GET, and POST requests methods. The HTTP POST requests
  11. can optionally include diagnostic information in the request body.
  12. If the request body looks like a UTF-8 string, SITE_NAME stores the request body
  13. (limited to the first 10KB for each received ping).</li>
  14. </ul>
  15. <p>Successful responses will have the "200 OK" HTTP response status code and a short
  16. "OK" string in the response body.</p>
  17. <h2>Send a "success" Signal</h2>
  18. <div class="text highlight"><pre><span></span><code>HEAD|GET|POST PING_ENDPOINT{uuid}
  19. </code></pre></div>
  20. <p>Signals to SITE_NAME that the job has completed successfully (or,
  21. continuously running processes are still running and healthy). The <code>uuid</code> parameter
  22. is unique for each check.</p>
  23. <p><strong>Example</strong></p>
  24. <div class="http highlight"><pre><span></span><code><span class="nf">GET</span> <span class="nn">/5bf66975-d4c7-4bf5-bcc8-b8d8a82ea278</span> <span class="kr">HTTP</span><span class="o">/</span><span class="m">1.0</span>
  25. <span class="na">Host</span><span class="o">:</span> <span class="l">hc-ping.com</span>
  26. </code></pre></div>
  27. <div class="http highlight"><pre><span></span><code><span class="kr">HTTP</span><span class="o">/</span><span class="m">1.1</span> <span class="m">200</span> <span class="ne">OK</span>
  28. <span class="na">Server</span><span class="o">:</span> <span class="l">nginx</span>
  29. <span class="na">Date</span><span class="o">:</span> <span class="l">Wed, 29 Jan 2020 09:58:23 GMT</span>
  30. <span class="na">Content-Type</span><span class="o">:</span> <span class="l">text/plain; charset=utf-8</span>
  31. <span class="na">Content-Length</span><span class="o">:</span> <span class="l">2</span>
  32. <span class="na">Connection</span><span class="o">:</span> <span class="l">close</span>
  33. <span class="na">Access-Control-Allow-Origin</span><span class="o">:</span> <span class="l">*</span>
  34. OK
  35. </code></pre></div>
  36. <h2>Send a "fail" Signal</h2>
  37. <div class="text highlight"><pre><span></span><code>HEAD|GET|POST PING_ENDPOINT{uuid}/fail
  38. </code></pre></div>
  39. <p>Signals to SITE_NAME that the job has failed. Actively signaling a failure
  40. minimizes the delay from your monitored service failing to you receiving an alert.</p>
  41. <p><strong>Example</strong></p>
  42. <div class="http highlight"><pre><span></span><code><span class="nf">GET</span> <span class="nn">/5bf66975-d4c7-4bf5-bcc8-b8d8a82ea278/fail</span> <span class="kr">HTTP</span><span class="o">/</span><span class="m">1.0</span>
  43. <span class="na">Host</span><span class="o">:</span> <span class="l">hc-ping.com</span>
  44. </code></pre></div>
  45. <div class="http highlight"><pre><span></span><code><span class="kr">HTTP</span><span class="o">/</span><span class="m">1.1</span> <span class="m">200</span> <span class="ne">OK</span>
  46. <span class="na">Server</span><span class="o">:</span> <span class="l">nginx</span>
  47. <span class="na">Date</span><span class="o">:</span> <span class="l">Wed, 29 Jan 2020 09:58:23 GMT</span>
  48. <span class="na">Content-Type</span><span class="o">:</span> <span class="l">text/plain; charset=utf-8</span>
  49. <span class="na">Content-Length</span><span class="o">:</span> <span class="l">2</span>
  50. <span class="na">Connection</span><span class="o">:</span> <span class="l">close</span>
  51. <span class="na">Access-Control-Allow-Origin</span><span class="o">:</span> <span class="l">*</span>
  52. OK
  53. </code></pre></div>
  54. <h2>Send a "start" Signal</h2>
  55. <div class="text highlight"><pre><span></span><code>HEAD|GET|POST PING_ENDPOINT{uuid}/start
  56. </code></pre></div>
  57. <p>Sends a "job has started!" message to SITE_NAME. This is
  58. optional but enables a few extra features:</p>
  59. <ul>
  60. <li>SITE_NAME will measure and display job execution times</li>
  61. <li>SITE_NAME will detect if the job runs longer than its configured grace time</li>
  62. </ul>
  63. <p><strong>Example</strong></p>
  64. <div class="http highlight"><pre><span></span><code><span class="nf">GET</span> <span class="nn">/5bf66975-d4c7-4bf5-bcc8-b8d8a82ea278/start</span> <span class="kr">HTTP</span><span class="o">/</span><span class="m">1.0</span>
  65. <span class="na">Host</span><span class="o">:</span> <span class="l">hc-ping.com</span>
  66. </code></pre></div>
  67. <div class="http highlight"><pre><span></span><code><span class="kr">HTTP</span><span class="o">/</span><span class="m">1.1</span> <span class="m">200</span> <span class="ne">OK</span>
  68. <span class="na">Server</span><span class="o">:</span> <span class="l">nginx</span>
  69. <span class="na">Date</span><span class="o">:</span> <span class="l">Wed, 29 Jan 2020 09:58:23 GMT</span>
  70. <span class="na">Content-Type</span><span class="o">:</span> <span class="l">text/plain; charset=utf-8</span>
  71. <span class="na">Content-Length</span><span class="o">:</span> <span class="l">2</span>
  72. <span class="na">Connection</span><span class="o">:</span> <span class="l">close</span>
  73. <span class="na">Access-Control-Allow-Origin</span><span class="o">:</span> <span class="l">*</span>
  74. OK
  75. </code></pre></div>