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.

864 lines
22 KiB

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