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.

1037 lines
28 KiB

3 years ago
3 years ago
4 years ago
  1. # Management API
  2. With the Management API, you can programmatically manage checks and integrations
  3. in your account.
  4. ## API Endpoints
  5. Endpoint Name | Endpoint Address
  6. ------------------------------------------------------|-------
  7. [Get a list of existing checks](#list-checks) | `GET SITE_ROOT/api/v1/checks/`
  8. [Get a single check](#get-check) | `GET SITE_ROOT/api/v1/checks/<uuid>`<br>`GET SITE_ROOT/api/v1/checks/<unique_key>`
  9. [Create a new check](#create-check) | `POST SITE_ROOT/api/v1/checks/`
  10. [Update an existing check](#update-check) | `POST SITE_ROOT/api/v1/checks/<uuid>`
  11. [Pause monitoring of a check](#pause-check) | `POST SITE_ROOT/api/v1/checks/<uuid>/pause`
  12. [Delete check](#delete-check) | `DELETE SITE_ROOT/api/v1/checks/<uuid>`
  13. [Get a list of check's logged pings](#list-pings) | `GET SITE_ROOT/api/v1/checks/<uuid>/pings/`
  14. [Get a list of check's status changes](#list-flips) | `GET SITE_ROOT/api/v1/checks/<uuid>/flips/`<br>`GET SITE_ROOT/api/v1/checks/<unique_key>/flips/`
  15. [Get a list of existing integrations](#list-channels) | `GET SITE_ROOT/api/v1/channels/`
  16. [Get project's badges](#list-badges) | `GET SITE_ROOT/api/v1/badges/`
  17. ## Authentication
  18. Your requests to SITE_NAME Management API must authenticate using an
  19. API key. All API keys are project-specific. There are no account-wide API keys.
  20. By default, a project on SITE_NAME doesn't have an API key. You can create read-write
  21. and read-only API keys on the **Project Settings** page.
  22. read-write key
  23. : Has full access to all documented API endpoints.
  24. read-only key
  25. : Only works with the following API endpoints:
  26. * [Get a list of existing checks](#list-checks)
  27. * [Get a single check](#get-check)
  28. * [Get a list of check's status changes](#list-flips)
  29. * [Get project's badges](#list-badges)
  30. Omits sensitive information from the API responses. See the documentation of
  31. individual API endpoints for details.
  32. The client can authenticate itself by including an `X-Api-Key: <your-api-key>`
  33. header in an HTTP request. Alternatively, for POST requests with a JSON request body,
  34. the client can put an `api_key` field in the JSON document.
  35. See the [Create a new check](#create-check) section for an example.
  36. ## API Requests
  37. For POST requests, the SITE_NAME API expects the request body to be
  38. a JSON document (*not* a `multipart/form-data` encoded form data).
  39. ## API Responses
  40. SITE_NAME uses HTTP status codes wherever possible.
  41. In general, 2xx class indicates success, 4xx indicates a client error,
  42. and 5xx indicates a server error.
  43. The response may contain a JSON document with additional data.
  44. ## Get a List of Existing Checks {: #list-checks .rule }
  45. `GET SITE_ROOT/api/v1/checks/`
  46. Returns a list of checks belonging to the user, optionally filtered by
  47. one or more tags.
  48. ### Query String Parameters
  49. tag=&lt;value&gt;
  50. : Filters the checks and returns only the checks that are tagged with the
  51. specified value.
  52. This parameter can be repeated multiple times.
  53. Example:
  54. `SITE_ROOT/api/v1/checks/?tag=foo&tag=bar`
  55. ### Response Codes
  56. 200 OK
  57. : The request succeeded.
  58. 401 Unauthorized
  59. : The API key is either missing or invalid.
  60. ### Example Request
  61. ```bash
  62. curl --header "X-Api-Key: your-api-key" SITE_ROOT/api/v1/checks/
  63. ```
  64. ### Example Response
  65. ```json
  66. {
  67. "checks": [
  68. {
  69. "name": "Filesystem Backup",
  70. "slug": "filesystem-backup",
  71. "tags": "backup fs",
  72. "desc": "Runs incremental backup every hour",
  73. "grace": 600,
  74. "n_pings": 1,
  75. "status": "up",
  76. "last_ping": "2020-03-24T14:02:03+00:00",
  77. "next_ping": "2020-03-24T15:02:03+00:00",
  78. "manual_resume": false,
  79. "methods": "",
  80. "ping_url": "PING_ENDPOINT31365bce-8da9-4729-8ff3-aaa71d56b712",
  81. "update_url": "SITE_ROOT/api/v1/checks/31365bce-8da9-4729-8ff3-aaa71d56b712",
  82. "pause_url": "SITE_ROOT/api/v1/checks/31365bce-8da9-4729-8ff3-aaa71d56b712/pause",
  83. "channels": "1bdea468-03bf-47b8-ab27-29a9dd0e4b94,51c6eb2b-2ae1-456b-99fe-6f1e0a36cd3c",
  84. "timeout": 3600
  85. },
  86. {
  87. "name": "Database Backup",
  88. "slug": "database-backup",
  89. "tags": "production db",
  90. "desc": "Runs ~/db-backup.sh",
  91. "grace": 1200,
  92. "n_pings": 7,
  93. "status": "down",
  94. "last_ping": "2020-03-23T10:19:32+00:00",
  95. "next_ping": null,
  96. "manual_resume": false,
  97. "methods": "",
  98. "ping_url": "PING_ENDPOINT803f680d-e89b-492b-82ef-2be7b774a92d",
  99. "update_url": "SITE_ROOT/api/v1/checks/803f680d-e89b-492b-82ef-2be7b774a92d",
  100. "pause_url": "SITE_ROOT/api/v1/checks/803f680d-e89b-492b-82ef-2be7b774a92d/pause",
  101. "channels": "1bdea468-03bf-47b8-ab27-29a9dd0e4b94,51c6eb2b-2ae1-456b-99fe-6f1e0a36cd3c",
  102. "schedule": "15 5 * * *",
  103. "tz": "UTC"
  104. }
  105. ]
  106. }
  107. ```
  108. The possible values for the `status` field are: `new`, `started`, `up`, `grace`, `down`,
  109. and `paused`.
  110. When using the read-only API key, SITE_NAME omits the following fields from responses:
  111. `ping_url`, `update_url`, `pause_url`, `channels`. It adds an extra
  112. `unique_key` field. The `unique_key` identifier is stable across API calls, and
  113. you can use it in the [Get a single check](#get-check)
  114. and [Get a list of check's status changes](#list-flips) API calls.
  115. Example:
  116. ```json
  117. {
  118. "checks": [
  119. {
  120. "name": "Filesystem Backup",
  121. "slug": "filesystem-backup",
  122. "tags": "backup fs",
  123. "desc": "Runs incremental backup every hour",
  124. "grace": 600,
  125. "n_pings": 1,
  126. "status": "up",
  127. "last_ping": "2020-03-24T14:02:03+00:00",
  128. "next_ping": "2020-03-24T15:02:03+00:00",
  129. "manual_resume": false,
  130. "methods": "",
  131. "unique_key": "a6c7b0a8a66bed0df66abfdab3c77736861703ee",
  132. "timeout": 3600
  133. },
  134. {
  135. "name": "Database Backup",
  136. "slug": "database-backup",
  137. "tags": "production db",
  138. "desc": "Runs ~/db-backup.sh",
  139. "grace": 1200,
  140. "n_pings": 7,
  141. "status": "down",
  142. "last_ping": "2020-03-23T10:19:32+00:00",
  143. "next_ping": null,
  144. "manual_resume": false,
  145. "methods": "",
  146. "unique_key": "124f983e0e3dcaeba921cfcef46efd084576e783",
  147. "schedule": "15 5 * * *",
  148. "tz": "UTC"
  149. }
  150. ]
  151. }
  152. ```
  153. ## Get a Single Check {: #get-check .rule }
  154. `GET SITE_ROOT/api/v1/checks/<uuid>`<br>
  155. `GET SITE_ROOT/api/v1/checks/<unique_key>`
  156. Returns a JSON representation of a single check. Accepts either check's UUID or
  157. the `unique_key` (a field derived from UUID and returned by API responses when
  158. using the read-only API key) as an identifier.
  159. ### Response Codes
  160. 200 OK
  161. : The request succeeded.
  162. 401 Unauthorized
  163. : The API key is either missing or invalid.
  164. 403 Forbidden
  165. : Access denied, wrong API key.
  166. 404 Not Found
  167. : The specified check does not exist.
  168. ### Example Request
  169. ```bash
  170. curl --header "X-Api-Key: your-api-key" SITE_ROOT/api/v1/checks/<uuid>
  171. ```
  172. ### Example Response
  173. ```json
  174. {
  175. "name": "Database Backup",
  176. "slug": "database-backup",
  177. "tags": "production db",
  178. "desc": "Runs ~/db-backup.sh",
  179. "grace": 1200,
  180. "n_pings": 7,
  181. "status": "down",
  182. "last_ping": "2020-03-23T10:19:32+00:00",
  183. "next_ping": null,
  184. "manual_resume": false,
  185. "methods": "",
  186. "ping_url": "PING_ENDPOINT803f680d-e89b-492b-82ef-2be7b774a92d",
  187. "update_url": "SITE_ROOT/api/v1/checks/803f680d-e89b-492b-82ef-2be7b774a92d",
  188. "pause_url": "SITE_ROOT/api/v1/checks/803f680d-e89b-492b-82ef-2be7b774a92d/pause",
  189. "channels": "1bdea468-03bf-47b8-ab27-29a9dd0e4b94,51c6eb2b-2ae1-456b-99fe-6f1e0a36cd3c",
  190. "schedule": "15 5 * * *",
  191. "tz": "UTC"
  192. }
  193. ```
  194. The possible values for the `status` field are: `new`, `started`, `up`, `grace`, `down`,
  195. and `paused`.
  196. ### Example Read-Only Response
  197. When using the read-only API key, SITE_NAME omits the following fields from responses:
  198. `ping_url`, `update_url`, `pause_url`, `channels`. It adds an extra
  199. `unique_key` field. This identifier is stable across API calls.
  200. Note: although API omits the `ping_url`, `update_url`, and `pause_url` in read-only
  201. API responses, the client can easily construct these URLs themselves *if* they know the
  202. check's unique UUID.
  203. ```json
  204. {
  205. "name": "Database Backup",
  206. "slug": "database-backup",
  207. "tags": "production db",
  208. "desc": "Runs ~/db-backup.sh",
  209. "grace": 1200,
  210. "n_pings": 7,
  211. "status": "down",
  212. "last_ping": "2020-03-23T10:19:32+00:00",
  213. "next_ping": null,
  214. "manual_resume": false,
  215. "methods": "",
  216. "unique_key": "124f983e0e3dcaeba921cfcef46efd084576e783",
  217. "schedule": "15 5 * * *",
  218. "tz": "UTC"
  219. }
  220. ```
  221. ## Create a Check {: #create-check .rule }
  222. `POST SITE_ROOT/api/v1/checks/`
  223. Creates a new check and returns its ping URL.
  224. All request parameters are optional and will use their default
  225. values if omitted.
  226. With this API call, you can create both Simple and Cron checks:
  227. * To create a Simple check, specify the `timeout` parameter.
  228. * To create a Cron check, specify the `schedule` and `tz` parameters.
  229. ### Request Parameters
  230. name
  231. : string, optional, default value: ""
  232. Name for the new check.
  233. tags
  234. : string, optional, default value: ""
  235. A space-delimited list of tags for the new check.
  236. Example:
  237. <pre>{"tags": "reports staging"}</pre>
  238. desc
  239. : string, optional.
  240. Description of the check.
  241. timeout
  242. : number, optional, default value: {{ default_timeout }}.
  243. A number of seconds, the expected period of this check.
  244. Minimum: 60 (one minute), maximum: 2592000 (30 days).
  245. Example for a 5-minute timeout:
  246. <pre>{"kind": "simple", "timeout": 300}</pre>
  247. grace
  248. : number, optional, default value: {{ default_grace }}.
  249. A number of seconds, the grace period for this check.
  250. Minimum: 60 (one minute), maximum: 2592000 (30 days).
  251. schedule
  252. : string, optional, default value: "`* * * * *`".
  253. A cron expression defining this check's schedule.
  254. If you specify both `timeout` and `schedule` parameters,
  255. SITE_NAME will create a Cron check and ignore
  256. the `timeout` value.
  257. Example for a check running every half-hour:
  258. <pre>{"schedule": "0,30 * * * *"}</pre>
  259. tz
  260. : string, optional, default value: "UTC".
  261. Server's timezone. This setting only has an effect in combination with the
  262. `schedule` parameter.
  263. Example:
  264. <pre>{"tz": "Europe/Riga"}</pre>
  265. manual_resume
  266. : boolean, optional, default value: false.
  267. Controls whether a paused check automatically resumes when pinged (the default)
  268. or not. If set to false, a paused check will leave the paused state when it receives
  269. a ping. If set to true, a paused check will ignore pings and stay paused until
  270. you manually resume it from the web dashboard.
  271. methods
  272. : string, optional, default value: "".
  273. Specifies the allowed HTTP methods for making ping requests.
  274. Must be one of the two values: "" (an empty string) or "POST".
  275. Set this field to "" (an empty string) to allow HEAD, GET,
  276. and POST requests.
  277. Set this field to "POST" to allow only POST requests.
  278. Example:
  279. <pre>{"methods": "POST"}</pre>
  280. channels
  281. : string, optional
  282. By default, this API call assigns no integrations to the newly created
  283. check.
  284. Set this field to a special value "*" to automatically assign all existing
  285. integrations. Example:
  286. <pre>{"channels": "*"}</pre>
  287. To assign specific integrations, use a comma-separated list of integration
  288. UUIDs. You can look up integration UUIDs using the
  289. [Get a List of Existing Integrations](#list-channels) API call.
  290. Example:
  291. <pre>{"channels":
  292. "4ec5a071-2d08-4baa-898a-eb4eb3cd6941,746a083e-f542-4554-be1a-707ce16d3acc"}</pre>
  293. Alternatively, if you have named your integrations in SITE_NAME dashboard,
  294. you can specify integrations by their names. For this to work, your integrations
  295. need non-empty unique names, and they must not contain commas.
  296. The names must match exactly, whitespace is significant.
  297. Example:
  298. <pre>{"channels": "Email to Alice,SMS to Alice"}</pre>
  299. unique
  300. : array of string values, optional, default value: [].
  301. Enables "upsert" functionality. Before creating a check, SITE_NAME looks for
  302. existing checks, filtered by fields listed in `unique`.
  303. If SITE_NAME does not find a matching check, it creates a new check and returns it
  304. with the HTTP status code 201.
  305. If SITE_NAME finds a matching check, it updates the existing check and
  306. returns it with HTTP status code 200.
  307. The accepted values for the `unique` field are
  308. `name`, `tags`, `timeout`, and `grace`.
  309. Example:
  310. <pre>{"name": "Backups", unique: ["name"]}</pre>
  311. In this example, if a check named "Backups" exists, it will be returned.
  312. Otherwise, a new check will be created and returned.
  313. ### Response Codes
  314. 201 Created
  315. : A new check was successfully created.
  316. 200 OK
  317. : An existing check was found and updated.
  318. 400 Bad Request
  319. : The request is not well-formed, violates schema, or uses invalid
  320. field values.
  321. 401 Unauthorized
  322. : The API key is either missing or invalid.
  323. 403 Forbidden
  324. : The account has hit its check limit. For free accounts,
  325. the limit is 20 checks per account.
  326. ### Example Request
  327. ```bash
  328. curl SITE_ROOT/api/v1/checks/ \
  329. --header "X-Api-Key: your-api-key" \
  330. --data '{"name": "Backups", "tags": "prod www", "timeout": 3600, "grace": 60}'
  331. ```
  332. Or, alternatively:
  333. ```bash
  334. curl SITE_ROOT/api/v1/checks/ \
  335. --data '{"api_key": "your-api-key", "name": "Backups", "tags": "prod www", "timeout": 3600, "grace": 60}'
  336. ```
  337. ### Example Response
  338. ```json
  339. {
  340. "channels": "",
  341. "desc": "",
  342. "grace": 60,
  343. "last_ping": null,
  344. "n_pings": 0,
  345. "name": "Backups",
  346. "slug": "backups",
  347. "next_ping": null,
  348. "manual_resume": false,
  349. "methods": "",
  350. "pause_url": "SITE_ROOT/api/v1/checks/f618072a-7bde-4eee-af63-71a77c5723bc/pause",
  351. "ping_url": "PING_ENDPOINTf618072a-7bde-4eee-af63-71a77c5723bc",
  352. "status": "new",
  353. "tags": "prod www",
  354. "timeout": 3600,
  355. "update_url": "SITE_ROOT/api/v1/checks/f618072a-7bde-4eee-af63-71a77c5723bc",
  356. }
  357. ```
  358. ## Update an Existing Check {: #update-check .rule }
  359. `POST SITE_ROOT/api/v1/checks/<uuid>`
  360. Updates an existing check. All request parameters are optional. If you omit any
  361. parameter, SITE_NAME will leave its value unchanged.
  362. ### Request Parameters
  363. name
  364. : string, optional.
  365. Name for the check.
  366. tags
  367. : string, optional.
  368. A space-delimited list of tags for the check.
  369. Example:
  370. <pre>{"tags": "reports staging"}</pre>
  371. desc
  372. : string, optional.
  373. Description of the check.
  374. timeout
  375. : number, optional.
  376. A number of seconds, the expected period of this check.
  377. Minimum: 60 (one minute), maximum: 2592000 (30 days).
  378. Example for a 5-minute timeout:
  379. <pre>{"kind": "simple", "timeout": 300}</pre>
  380. grace
  381. : number, optional.
  382. A number of seconds, the grace period for this check.
  383. Minimum: 60 (one minute), maximum: 2592000 (30 days).
  384. schedule
  385. : string, optional.
  386. A cron expression defining this check's schedule.
  387. If you specify both `timeout` and `schedule` parameters,
  388. SITE_NAME will save the `schedule` parameter and ignore
  389. the `timeout`.
  390. Example for a check running every half-hour:
  391. <pre>{"schedule": "0,30 * * * *"}</pre>
  392. tz
  393. : string, optional.
  394. Server's timezone. This setting only has an effect in combination with the
  395. "schedule" parameter.
  396. Example:
  397. <pre>{"tz": "Europe/Riga"}</pre>
  398. manual_resume
  399. : boolean, optional, default value: false.
  400. Controls whether a paused ping automatically resumes when pinged (the default),
  401. or not. If set to false, a paused check will leave the paused state when it receives
  402. a ping. If set to true, a paused check will ignore pings and stay paused until
  403. you manually resume it from the web dashboard.
  404. methods
  405. : string, optional, default value: "".
  406. Specifies the allowed HTTP methods for making ping requests.
  407. Must be one of the two values: "" (an empty string) or "POST".
  408. Set this field to "" (an empty string) to allow HEAD, GET,
  409. and POST requests.
  410. Set this field to "POST" to allow only POST requests.
  411. Example:
  412. <pre>{"methods": "POST"}</pre>
  413. channels
  414. : string, optional.
  415. Set this field to a special value "*" to automatically assign all existing
  416. integrations. Example:
  417. <pre>{"channels": "*"}</pre>
  418. Set this field to a special value "" (empty string) to automatically *unassign*
  419. all existing integrations. Example:
  420. <pre>{"channels": ""}</pre>
  421. To assign specific integrations, use a comma-separated list of integration
  422. UUIDs. You can look up integration UUIDs using the
  423. [Get a List of Existing Integrations](#list-channels) API call.
  424. Example:
  425. <pre>{"channels":
  426. "4ec5a071-2d08-4baa-898a-eb4eb3cd6941,746a083e-f542-4554-be1a-707ce16d3acc"}</pre>
  427. Alternatively, if you have named your integrations in SITE_NAME dashboard,
  428. you can specify integrations by their names. For this to work, your integrations
  429. need non-empty and unique names, and they must not contain commas. The names
  430. must match exactly, whitespace is significant.
  431. Example:
  432. <pre>{"channels": "Email to Alice,SMS to Alice"}</pre>
  433. ### Response Codes
  434. 200 OK
  435. : The check was successfully updated.
  436. 400 Bad Request
  437. : The request is not well-formed, violates schema, or uses invalid
  438. field values.
  439. 401 Unauthorized
  440. : The API key is either missing or invalid.
  441. 403 Forbidden
  442. : Access denied, wrong API key.
  443. 404 Not Found
  444. : The specified check does not exist.
  445. ### Example Request
  446. ```bash
  447. curl SITE_ROOT/api/v1/checks/f618072a-7bde-4eee-af63-71a77c5723bc \
  448. --header "X-Api-Key: your-api-key" \
  449. --data '{"name": "Backups", "tags": "prod www", "timeout": 3600, "grace": 60}'
  450. ```
  451. Or, alternatively:
  452. ```bash
  453. curl SITE_ROOT/api/v1/checks/f618072a-7bde-4eee-af63-71a77c5723bc \
  454. --data '{"api_key": "your-api-key", "name": "Backups", "tags": "prod www", "timeout": 3600, "grace": 60}'
  455. ```
  456. ### Example Response
  457. ```json
  458. {
  459. "channels": "",
  460. "desc": "",
  461. "grace": 60,
  462. "last_ping": null,
  463. "n_pings": 0,
  464. "name": "Backups",
  465. "slug": "backups",
  466. "next_ping": null,
  467. "manual_resume": false,
  468. "methods": "",
  469. "pause_url": "SITE_ROOT/api/v1/checks/f618072a-7bde-4eee-af63-71a77c5723bc/pause",
  470. "ping_url": "PING_ENDPOINTf618072a-7bde-4eee-af63-71a77c5723bc",
  471. "status": "new",
  472. "tags": "prod www",
  473. "timeout": 3600,
  474. "update_url": "SITE_ROOT/api/v1/checks/f618072a-7bde-4eee-af63-71a77c5723bc",
  475. }
  476. ```
  477. ## Pause Monitoring of a Check {: #pause-check .rule }
  478. `POST SITE_ROOT/api/v1/checks/<uuid>/pause`
  479. Disables monitoring for a check without removing it. The check goes into a "paused"
  480. state. You can resume monitoring of the check by pinging it.
  481. This API call has no request parameters.
  482. ### Response Codes
  483. 200 OK
  484. : The check was successfully paused.
  485. 401 Unauthorized
  486. : The API key is either missing or invalid.
  487. 403 Forbidden
  488. : Access denied, wrong API key.
  489. 404 Not Found
  490. : The specified check does not exist.
  491. ### Example Request
  492. ```bash
  493. curl SITE_ROOT/api/v1/checks/0c8983c9-9d73-446f-adb5-0641fdacc9d4/pause \
  494. --request POST --header "X-Api-Key: your-api-key" --data ""
  495. ```
  496. Note: the `--data ""` argument forces curl to send a `Content-Length` request header
  497. even though the request body is empty. For HTTP POST requests, the `Content-Length`
  498. header is sometimes required by some network proxies and web servers.
  499. ### Example Response
  500. ```json
  501. {
  502. "channels": "",
  503. "desc": "",
  504. "grace": 60,
  505. "last_ping": null,
  506. "n_pings": 0,
  507. "name": "Backups",
  508. "slug": "backups",
  509. "next_ping": null,
  510. "manual_resume": false,
  511. "methods": "",
  512. "pause_url": "SITE_ROOT/api/v1/checks/f618072a-7bde-4eee-af63-71a77c5723bc/pause",
  513. "ping_url": "PING_ENDPOINTf618072a-7bde-4eee-af63-71a77c5723bc",
  514. "status": "paused",
  515. "tags": "prod www",
  516. "timeout": 3600,
  517. "update_url": "SITE_ROOT/api/v1/checks/f618072a-7bde-4eee-af63-71a77c5723bc"
  518. }
  519. ```
  520. ## Delete Check {: #delete-check .rule }
  521. `DELETE SITE_ROOT/api/v1/checks/<uuid>`
  522. Permanently deletes the check from the user's account. Returns JSON representation of the
  523. check that was just deleted.
  524. This API call has no request parameters.
  525. ### Response Codes
  526. 200 OK
  527. : The check was successfully deleted.
  528. 401 Unauthorized
  529. : The API key is either missing or invalid.
  530. 403 Forbidden
  531. : Access denied, wrong API key.
  532. 404 Not Found
  533. : The specified check does not exist.
  534. ### Example Request
  535. ```bash
  536. curl SITE_ROOT/api/v1/checks/f618072a-7bde-4eee-af63-71a77c5723bc \
  537. --request DELETE --header "X-Api-Key: your-api-key"
  538. ```
  539. ### Example Response
  540. ```json
  541. {
  542. "channels": "",
  543. "desc": "",
  544. "grace": 60,
  545. "last_ping": null,
  546. "n_pings": 0,
  547. "name": "Backups",
  548. "slug": "backups",
  549. "next_ping": null,
  550. "manual_resume": false,
  551. "methods": "",
  552. "pause_url": "SITE_ROOT/api/v1/checks/f618072a-7bde-4eee-af63-71a77c5723bc/pause",
  553. "ping_url": "PING_ENDPOINTf618072a-7bde-4eee-af63-71a77c5723bc",
  554. "status": "new",
  555. "tags": "prod www",
  556. "timeout": 3600,
  557. "update_url": "SITE_ROOT/api/v1/checks/f618072a-7bde-4eee-af63-71a77c5723bc",
  558. }
  559. ```
  560. ## Get a list of check's logged pings {: #list-pings .rule }
  561. `GET SITE_ROOT/api/v1/checks/<uuid>/pings/`
  562. Returns a list of pings this check has received.
  563. This endpoint returns pings in reverse order (most recent first), and the total
  564. number of returned pings depends on the account's billing plan: 100 for free accounts,
  565. 1000 for paid accounts.
  566. ### Response Codes
  567. 200 OK
  568. : The request succeeded.
  569. 401 Unauthorized
  570. : The API key is either missing or invalid.
  571. 403 Forbidden
  572. : Access denied, wrong API key.
  573. 404 Not Found
  574. : The specified check does not exist.
  575. ### Example Request
  576. ```bash
  577. curl SITE_ROOT/api/v1/checks/f618072a-7bde-4eee-af63-71a77c5723bc/pings/ \
  578. --header "X-Api-Key: your-api-key"
  579. ```
  580. ### Example Response
  581. ```json
  582. {
  583. "pings": [
  584. {
  585. "type": "success",
  586. "date": "2020-06-09T14:51:06.113073+00:00",
  587. "n": 4,
  588. "scheme": "http",
  589. "remote_addr": "192.0.2.0",
  590. "method": "GET",
  591. "ua": "curl/7.68.0",
  592. "duration": 2.896736
  593. },
  594. {
  595. "type": "start",
  596. "date": "2020-06-09T14:51:03.216337+00:00",
  597. "n": 3,
  598. "scheme": "http",
  599. "remote_addr": "192.0.2.0",
  600. "method": "GET",
  601. "ua": "curl/7.68.0"
  602. },
  603. {
  604. "type": "success",
  605. "date": "2020-06-09T14:50:59.633577+00:00",
  606. "n": 2,
  607. "scheme": "http",
  608. "remote_addr": "192.0.2.0",
  609. "method": "GET",
  610. "ua": "curl/7.68.0",
  611. "duration": 2.997976
  612. },
  613. {
  614. "type": "start",
  615. "date": "2020-06-09T14:50:56.635601+00:00",
  616. "n": 1,
  617. "scheme": "http",
  618. "remote_addr": "192.0.2.0",
  619. "method": "GET",
  620. "ua": "curl/7.68.0"
  621. }
  622. ]
  623. }
  624. ```
  625. ## Get a list of check's status changes {: #list-flips .rule }
  626. `GET SITE_ROOT/api/v1/checks/<uuid>/flips/`<br>
  627. `GET SITE_ROOT/api/v1/checks/<unique_key>/flips/`
  628. Returns a list of "flips" this check has experienced. A flip is a change of status
  629. (from "down" to "up," or from "up" to "down").
  630. ### Query String Parameters
  631. seconds=&lt;value&gt;
  632. : Returns the flips from the last `value` seconds
  633. Example:
  634. `SITE_ROOT/api/v1/checks/<uuid|unique_key>/flips/?seconds=3600`
  635. start=&lt;value&gt;
  636. : Returns flips that are newer than the specified UNIX timestamp.
  637. Example:
  638. `SITE_ROOT/api/v1/checks/<uuid|unique_key>/flips/?start=1592214380`
  639. end=&lt;value&gt;
  640. : Returns flips that are older than the specified UNIX timestamp.
  641. Example:
  642. `SITE_ROOT/api/v1/checks/<uuid|unique_key>/flips/?end=1592217980`
  643. ### Response Codes
  644. 200 OK
  645. : The request succeeded.
  646. 400 Bad Request
  647. : Invalid query parameters.
  648. 401 Unauthorized
  649. : The API key is either missing or invalid.
  650. 403 Forbidden
  651. : Access denied, wrong API key.
  652. 404 Not Found
  653. : The specified check does not exist.
  654. ### Example Request
  655. ```bash
  656. curl SITE_ROOT/api/v1/checks/f618072a-7bde-4eee-af63-71a77c5723bc/flips/ \
  657. --header "X-Api-Key: your-api-key"
  658. ```
  659. ### Example Response
  660. ```json
  661. [
  662. {
  663. "timestamp": "2020-03-23T10:18:23+00:00",
  664. "up": 1
  665. },
  666. {
  667. "timestamp": "2020-03-23T10:17:15+00:00",
  668. "up": 0
  669. },
  670. {
  671. "timestamp": "2020-03-23T10:16:18+00:00",
  672. "up": 1
  673. }
  674. ]
  675. ```
  676. ## Get a List of Existing Integrations {: #list-channels .rule }
  677. `GET SITE_ROOT/api/v1/channels/`
  678. Returns a list of integrations belonging to the project.
  679. ### Response Codes
  680. 200 OK
  681. : The request succeeded.
  682. 401 Unauthorized
  683. : The API key is either missing or invalid.
  684. ### Example Request
  685. ```bash
  686. curl --header "X-Api-Key: your-api-key" SITE_ROOT/api/v1/channels/
  687. ```
  688. ### Example Response
  689. ```json
  690. {
  691. "channels": [
  692. {
  693. "id": "4ec5a071-2d08-4baa-898a-eb4eb3cd6941",
  694. "name": "My Work Email",
  695. "kind": "email"
  696. },
  697. {
  698. "id": "746a083e-f542-4554-be1a-707ce16d3acc",
  699. "name": "My Phone",
  700. "kind": "sms"
  701. }
  702. ]
  703. }
  704. ```
  705. ## Get Project's Badges {: #list-badges .rule }
  706. `GET SITE_ROOT/api/v1/badges/`
  707. Returns a map of all tags in the project, with badge URLs for each tag. SITE_NAME
  708. provides badges in a few different formats:
  709. * `svg`: returns the badge as a SVG document.
  710. * `json`: returns a JSON document which you can use to generate a custom badge
  711. yourself.
  712. * `shields`: returns JSON in a [Shields.io compatible format](https://shields.io/endpoint).
  713. In addition, badges have 2-state and 3-state variations:
  714. * `svg`, `json`, `shields`: reports two states: "up" and "down". It
  715. considers any checks in the grace period as still "up".
  716. * `svg3`, `json3`, `shields3`: reports three states: "up", "late", and "down".
  717. The response includes a special `*` entry: this pseudo-tag reports the overal status
  718. of all checks in the project.
  719. ### Response Codes
  720. 200 OK
  721. : The request succeeded.
  722. 401 Unauthorized
  723. : The API key is either missing or invalid.
  724. ### Example Request
  725. ```bash
  726. curl --header "X-Api-Key: your-api-key" SITE_ROOT/api/v1/badges/
  727. ```
  728. ### Example Response
  729. ```json
  730. {
  731. "badges": {
  732. "backup": {
  733. "svg": "SITE_ROOT/badge/67541b37-8b9c-4d17-b952-690eae/LOegDs5M-2/backup.svg",
  734. "svg3": "SITE_ROOT/badge/67541b37-8b9c-4d17-b952-690eae/LOegDs5M/backup.svg",
  735. "json": "SITE_ROOT/badge/67541b37-8b9c-4d17-b952-690eae/LOegDs5M-2/backup.json",
  736. "json3": "SITE_ROOT/badge/67541b37-8b9c-4d17-b952-690eae/LOegDs5M/backup.json",
  737. "shields": "SITE_ROOT/badge/67541b37-8b9c-4d17-b952-690eae/LOegDs5M-2/backup.shields",
  738. "shields3": "SITE_ROOT/badge/67541b37-8b9c-4d17-b952-690eae/LOegDs5M/backup.shields"
  739. },
  740. "db": {
  741. "svg": "SITE_ROOT/badge/67541b37-8b9c-4d17-b952-690eae/99MuQaKm-2/db.svg",
  742. "svg3": "SITE_ROOT/badge/67541b37-8b9c-4d17-b952-690eae/99MuQaKm/db.svg",
  743. "json": "SITE_ROOT/badge/67541b37-8b9c-4d17-b952-690eae/99MuQaKm-2/db.json",
  744. "json3": "SITE_ROOT/badge/67541b37-8b9c-4d17-b952-690eae/99MuQaKm/db.json",
  745. "shields": "SITE_ROOT/badge/67541b37-8b9c-4d17-b952-690eae/99MuQaKm-2/db.shields",
  746. "shields3": "SITE_ROOT/badge/67541b37-8b9c-4d17-b952-690eae/99MuQaKm/db.shields"
  747. },
  748. "prod": {
  749. "svg": "SITE_ROOT/badge/67541b37-8b9c-4d17-b952-690eae/1TEhqie8-2/prod.svg",
  750. "svg3": "SITE_ROOT/badge/67541b37-8b9c-4d17-b952-690eae/1TEhqie8/prod.svg",
  751. "json": "SITE_ROOT/badge/67541b37-8b9c-4d17-b952-690eae/1TEhqie8-2/prod.json",
  752. "json3": "SITE_ROOT/badge/67541b37-8b9c-4d17-b952-690eae/1TEhqie8/prod.json",
  753. "shields": "SITE_ROOT/badge/67541b37-8b9c-4d17-b952-690eae/1TEhqie8-2/prod.shields",
  754. "shields3": "SITE_ROOT/badge/67541b37-8b9c-4d17-b952-690eae/1TEhqie8/prod.shields"
  755. },
  756. "*": {
  757. "svg": "SITE_ROOT/badge/67541b37-8b9c-4d17-b952-690eae/9X7kcZoe-2.svg",
  758. "svg3": "SITE_ROOT/badge/67541b37-8b9c-4d17-b952-690eae/9X7kcZoe.svg",
  759. "json": "SITE_ROOT/badge/67541b37-8b9c-4d17-b952-690eae/9X7kcZoe-2.json",
  760. "json3": "SITE_ROOT/badge/67541b37-8b9c-4d17-b952-690eae/9X7kcZoe.json",
  761. "shields": "SITE_ROOT/badge/67541b37-8b9c-4d17-b952-690eae/9X7kcZoe-2.shields",
  762. "shields3": "SITE_ROOT/badge/67541b37-8b9c-4d17-b952-690eae/9X7kcZoe.shields"
  763. }
  764. }
  765. }
  766. ```