Browse Source

Document more response codes.

pull/340/head
Pēteris Caune 5 years ago
parent
commit
35e476be59
No known key found for this signature in database GPG Key ID: E28D7679E9A9EDE2
3 changed files with 124 additions and 9 deletions
  1. +1
    -1
      static/css/docs.css
  2. +54
    -4
      templates/docs/api.html
  3. +69
    -4
      templates/docs/api.md

+ 1
- 1
static/css/docs.css View File

@ -114,7 +114,7 @@ h2.rule {
.docs-api dl { .docs-api dl {
display: grid; display: grid;
grid-template-columns: 120px auto;
grid-template-columns: 150px auto;
} }
.docs-api dt { .docs-api dt {


+ 54
- 4
templates/docs/api.html View File

@ -89,6 +89,13 @@ specified value.</p>
<p><code>SITE_ROOT/api/v1/checks/?tag=foo&amp;tag=bar</code></p> <p><code>SITE_ROOT/api/v1/checks/?tag=foo&amp;tag=bar</code></p>
</dd> </dd>
</dl> </dl>
<h3>Response Codes</h3>
<dl>
<dt>200 OK</dt>
<dd>The request succeeded.</dd>
<dt>401 Unauthorized</dt>
<dd>The API key is either missing or invalid.</dd>
</dl>
<h3>Example Request</h3> <h3>Example Request</h3>
<div class="highlight"><pre><span></span><code>curl --header <span class="s2">&quot;X-Api-Key: your-api-key&quot;</span> SITE_ROOT/api/v1/checks/ <div class="highlight"><pre><span></span><code>curl --header <span class="s2">&quot;X-Api-Key: your-api-key&quot;</span> SITE_ROOT/api/v1/checks/
</code></pre></div> </code></pre></div>
@ -254,11 +261,16 @@ Otherwise, a new check will be created and returned.</p>
<h3>Response Codes</h3> <h3>Response Codes</h3>
<dl> <dl>
<dt>201 Created</dt> <dt>201 Created</dt>
<dd>Returned if the check was successfully created.</dd>
<dd>The check was successfully created.</dd>
<dt>200 OK</dt> <dt>200 OK</dt>
<dd>Returned if the <code>unique</code> parameter was used and an existing check was matched.</dd>
<dd>The <code>unique</code> parameter was used and an existing check was matched.</dd>
<dt>400 Bad Request</dt>
<dd>The request is not well-formed, violates schema, or uses invalid
field values.</dd>
<dt>401 Unauthorized</dt>
<dd>The API key is either missing or invalid.</dd>
<dt>403 Forbidden</dt> <dt>403 Forbidden</dt>
<dd>Returned if the account's check limit has been reached. For free accounts,
<dd>The account's check limit has been reached. For free accounts,
the limit is 20 checks per account.</dd> the limit is 20 checks per account.</dd>
</dl> </dl>
<h3>Example Request</h3> <h3>Example Request</h3>
@ -364,7 +376,16 @@ specific notification channels.</p>
<h3>Response Codes</h3> <h3>Response Codes</h3>
<dl> <dl>
<dt>200 OK</dt> <dt>200 OK</dt>
<dd>Returned if the check was successfully updated.</dd>
<dd>The check was successfully updated.</dd>
<dt>400 Bad Request</dt>
<dd>The request is not well-formed, violates schema, or uses invalid
field values.</dd>
<dt>401 Unauthorized</dt>
<dd>The API key is either missing or invalid.</dd>
<dt>403 Forbidden</dt>
<dd>Access denied, wrong API key.</dd>
<dt>404 Not Found</dt>
<dd>The specified check does not exist.</dd>
</dl> </dl>
<h3>Example Request</h3> <h3>Example Request</h3>
<div class="highlight"><pre><span></span><code>curl SITE_ROOT/api/v1/checks/f618072a-7bde-4eee-af63-71a77c5723bc <span class="se">\</span> <div class="highlight"><pre><span></span><code>curl SITE_ROOT/api/v1/checks/f618072a-7bde-4eee-af63-71a77c5723bc <span class="se">\</span>
@ -403,6 +424,17 @@ specific notification channels.</p>
<p>Disables monitoring for a check, without removing it. The check goes into a "paused" <p>Disables monitoring for a check, without removing it. The check goes into a "paused"
state. You can resume monitoring of the check by pinging it.</p> state. You can resume monitoring of the check by pinging it.</p>
<p>This API call has no request parameters.</p> <p>This API call has no request parameters.</p>
<h3>Response Codes</h3>
<dl>
<dt>200 OK</dt>
<dd>The check was successfully paused.</dd>
<dt>401 Unauthorized</dt>
<dd>The API key is either missing or invalid.</dd>
<dt>403 Forbidden</dt>
<dd>Access denied, wrong API key.</dd>
<dt>404 Not Found</dt>
<dd>The specified check does not exist.</dd>
</dl>
<h3>Example Request</h3> <h3>Example Request</h3>
<div class="highlight"><pre><span></span><code>curl SITE_ROOT/api/v1/checks/0c8983c9-9d73-446f-adb5-0641fdacc9d4/pause <span class="se">\</span> <div class="highlight"><pre><span></span><code>curl SITE_ROOT/api/v1/checks/0c8983c9-9d73-446f-adb5-0641fdacc9d4/pause <span class="se">\</span>
--request POST --header <span class="s2">&quot;X-Api-Key: your-api-key&quot;</span> --data <span class="s2">&quot;&quot;</span> --request POST --header <span class="s2">&quot;X-Api-Key: your-api-key&quot;</span> --data <span class="s2">&quot;&quot;</span>
@ -436,6 +468,17 @@ header is sometimes required by some network proxies and web servers.</p>
<p>Permanently deletes the check from user's account. Returns JSON representation of the <p>Permanently deletes the check from user's account. Returns JSON representation of the
check that was just deleted.</p> check that was just deleted.</p>
<p>This API call has no request parameters.</p> <p>This API call has no request parameters.</p>
<h3>Response Codes</h3>
<dl>
<dt>200 OK</dt>
<dd>The check was successfully deleted.</dd>
<dt>401 Unauthorized</dt>
<dd>The API key is either missing or invalid.</dd>
<dt>403 Forbidden</dt>
<dd>Access denied, wrong API key.</dd>
<dt>404 Not Found</dt>
<dd>The specified check does not exist.</dd>
</dl>
<h3>Example Request</h3> <h3>Example Request</h3>
<div class="highlight"><pre><span></span><code>curl SITE_ROOT/api/v1/checks/f618072a-7bde-4eee-af63-71a77c5723bc <span class="se">\</span> <div class="highlight"><pre><span></span><code>curl SITE_ROOT/api/v1/checks/f618072a-7bde-4eee-af63-71a77c5723bc <span class="se">\</span>
--request DELETE --header <span class="s2">&quot;X-Api-Key: your-api-key&quot;</span> --request DELETE --header <span class="s2">&quot;X-Api-Key: your-api-key&quot;</span>
@ -464,6 +507,13 @@ check that was just deleted.</p>
<h2 class="rule" id="list-channels">Get a List of Existing Integrations</h2> <h2 class="rule" id="list-channels">Get a List of Existing Integrations</h2>
<p><code>GET SITE_ROOT/api/v1/channels/</code></p> <p><code>GET SITE_ROOT/api/v1/channels/</code></p>
<p>Returns a list of integrations belonging to the user.</p> <p>Returns a list of integrations belonging to the user.</p>
<h3>Response Codes</h3>
<dl>
<dt>200 OK</dt>
<dd>The request succeeded.</dd>
<dt>401 Unauthorized</dt>
<dd>The API key is either missing or invalid.</dd>
</dl>
<h3>Example Request</h3> <h3>Example Request</h3>
<div class="highlight"><pre><span></span><code>curl --header <span class="s2">&quot;X-Api-Key: your-api-key&quot;</span> SITE_ROOT/api/v1/channels/ <div class="highlight"><pre><span></span><code>curl --header <span class="s2">&quot;X-Api-Key: your-api-key&quot;</span> SITE_ROOT/api/v1/channels/
</code></pre></div> </code></pre></div>


+ 69
- 4
templates/docs/api.md View File

@ -68,6 +68,14 @@ tag=&lt;value&gt;
`SITE_ROOT/api/v1/checks/?tag=foo&tag=bar` `SITE_ROOT/api/v1/checks/?tag=foo&tag=bar`
### Response Codes
200 OK
: The request succeeded.
401 Unauthorized
: The API key is either missing or invalid.
### Example Request ### Example Request
```bash ```bash
@ -255,13 +263,20 @@ unique
### Response Codes ### Response Codes
201 Created 201 Created
: Returned if the check was successfully created.
: The check was successfully created.
200 OK 200 OK
: Returned if the `unique` parameter was used and an existing check was matched.
: The `unique` parameter was used and an existing check was matched.
400 Bad Request
: The request is not well-formed, violates schema, or uses invalid
field values.
401 Unauthorized
: The API key is either missing or invalid.
403 Forbidden 403 Forbidden
: Returned if the account's check limit has been reached. For free accounts,
: The account's check limit has been reached. For free accounts,
the limit is 20 checks per account. the limit is 20 checks per account.
### Example Request ### Example Request
@ -388,7 +403,21 @@ channels
### Response Codes ### Response Codes
200 OK 200 OK
: Returned if the check was successfully updated.
: The check was successfully updated.
400 Bad Request
: The request is not well-formed, violates schema, or uses invalid
field values.
401 Unauthorized
: The API key is either missing or invalid.
403 Forbidden
: Access denied, wrong API key.
404 Not Found
: The specified check does not exist.
### Example Request ### Example Request
@ -434,6 +463,20 @@ state. You can resume monitoring of the check by pinging it.
This API call has no request parameters. This API call has no request parameters.
### Response Codes
200 OK
: The check was successfully paused.
401 Unauthorized
: The API key is either missing or invalid.
403 Forbidden
: Access denied, wrong API key.
404 Not Found
: The specified check does not exist.
### Example Request ### Example Request
```bash ```bash
@ -474,6 +517,20 @@ check that was just deleted.
This API call has no request parameters. This API call has no request parameters.
### Response Codes
200 OK
: The check was successfully deleted.
401 Unauthorized
: The API key is either missing or invalid.
403 Forbidden
: Access denied, wrong API key.
404 Not Found
: The specified check does not exist.
### Example Request ### Example Request
```bash ```bash
@ -507,6 +564,14 @@ curl SITE_ROOT/api/v1/checks/f618072a-7bde-4eee-af63-71a77c5723bc \
Returns a list of integrations belonging to the user. Returns a list of integrations belonging to the user.
### Response Codes
200 OK
: The request succeeded.
401 Unauthorized
: The API key is either missing or invalid.
### Example Request ### Example Request
```bash ```bash


Loading…
Cancel
Save