Browse Source

Update the section about read-write and read-only API keys.

pull/399/head
Pēteris Caune 4 years ago
parent
commit
c160045bda
No known key found for this signature in database GPG Key ID: E28D7679E9A9EDE2
2 changed files with 39 additions and 49 deletions
  1. +22
    -33
      templates/docs/api.html
  2. +17
    -16
      templates/docs/api.md

+ 22
- 33
templates/docs/api.html View File

@ -16,11 +16,7 @@ checks in user's account.</p>
</tr>
<tr>
<td><a href="#get-check">Get a single check</a></td>
<td><code>GET SITE_ROOT/api/v1/checks/&lt;uuid&gt;</code></td>
</tr>
<tr>
<td><a href="#get-check">Get a check by its unique_key</a></td>
<td><code>GET SITE_ROOT/api/v1/checks/&lt;unique_key&gt;</code></td>
<td><code>GET SITE_ROOT/api/v1/checks/&lt;uuid&gt;</code><br><code>GET SITE_ROOT/api/v1/checks/&lt;unique_key&gt;</code></td>
</tr>
<tr>
<td><a href="#create-check">Create a new check</a></td>
@ -44,7 +40,7 @@ checks in user's account.</p>
</tr>
<tr>
<td><a href="#list-flips">Get a list of check's status changes</a></td>
<td><code>GET SITE_ROOT/api/v1/checks/&lt;uuid&gt;/flips/</code></td>
<td><code>GET SITE_ROOT/api/v1/checks/&lt;uuid&gt;/flips/</code><br><code>GET SITE_ROOT/api/v1/checks/&lt;unique_key&gt;/flips/</code></td>
</tr>
<tr>
<td><a href="#list-channels">Get a list of existing integrations</a></td>
@ -54,34 +50,27 @@ checks in user's account.</p>
</table>
<h2>Authentication</h2>
<p>Your requests to SITE_NAME Management API must authenticate using an
API key. Each project in your SITE_NAME account has separate API keys.
There are no account-wide API keys. By default, a project on SITE_NAME doesn't have
an API key. You can create read-write and read-only API keys in the
<strong>Project Settings</strong> page.</p>
<table>
<thead>
<tr>
<th>Key Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>Regular API key</td>
<td>Has full access to all documented API endpoints.</td>
</tr>
<tr>
<td>Read-only API key</td>
<td>Only works with the <a href="#list-checks">Get a list of existing checks</a> and <a href="#get-check">Get a single check</a> endpoints. Some fields are omitted from the API responses.</td>
</tr>
</tbody>
</table>
<p>The client can authenticate itself by sending an appropriate HTTP
request header. The header's name should be <code>X-Api-Key</code> and
its value should be your API key.</p>
<p>Alternatively, for POST requests with a JSON request body,
API key. API keys are project-specific, there are no account-wide API keys.
By default, a project on SITE_NAME doesn't have an API key. You can create read-write
and read-only API keys in the <strong>Project Settings</strong> page.</p>
<dl>
<dt>read-write key</dt>
<dd>Has full access to all documented API endpoints.</dd>
<dt>read-only key</dt>
<dd>
<p>Only works with the following API endpoints:</p>
<ul>
<li><a href="#list-checks">Get a list of existing checks</a></li>
<li><a href="#get-check">Get a single check</a></li>
<li><a href="#list-flips">Get a list of check's status changes</a></li>
</ul>
<p>Omits some fields from the API responses (documented below).</p>
</dd>
</dl>
<p>The client can authenticate itself by including an <code>X-Api-Key: &lt;your-api-key&gt;</code>
header in a HTTP request. Alternatively, for POST requests with a JSON request body,
the client can include an <code>api_key</code> field in the JSON document.
See below the "Create a check" section for an example.</p>
See the <a href="#create-check">Create a new check</a> section for an example.</p>
<h2>API Requests</h2>
<p>For POST requests, the SITE_NAME API expects request body to be
a JSON document (<em>not</em> a <code>multipart/form-data</code> encoded form data).</p>


+ 17
- 16
templates/docs/api.md View File

@ -8,37 +8,38 @@ checks in user's account.
Endpoint Name | Endpoint Address
------------------------------------------------------|-------
[Get a list of existing checks](#list-checks) | `GET SITE_ROOT/api/v1/checks/`
[Get a single check](#get-check) | `GET SITE_ROOT/api/v1/checks/<uuid>`
[Get a check by its unique_key](#get-check) | `GET SITE_ROOT/api/v1/checks/<unique_key>`
[Get a single check](#get-check) | `GET SITE_ROOT/api/v1/checks/<uuid>`<br>`GET SITE_ROOT/api/v1/checks/<unique_key>`
[Create a new check](#create-check) | `POST SITE_ROOT/api/v1/checks/`
[Update an existing check](#update-check) | `POST SITE_ROOT/api/v1/checks/<uuid>`
[Pause monitoring of a check](#pause-check) | `POST SITE_ROOT/api/v1/checks/<uuid>/pause`
[Delete check](#delete-check) | `DELETE SITE_ROOT/api/v1/checks/<uuid>`
[Get a list of check's logged pings](#list-pings) | `GET SITE_ROOT/api/v1/checks/<uuid>/pings/`
[Get a list of check's status changes](#list-flips) | `GET SITE_ROOT/api/v1/checks/<uuid>/flips/`
[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/`
[Get a list of existing integrations](#list-channels) | `GET SITE_ROOT/api/v1/channels/`
## Authentication
Your requests to SITE_NAME Management API must authenticate using an
API key. Each project in your SITE_NAME account has separate API keys.
There are no account-wide API keys. By default, a project on SITE_NAME doesn't have
an API key. You can create read-write and read-only API keys in the
**Project Settings** page.
API key. API keys are project-specific, there are no account-wide API keys.
By default, a project on SITE_NAME doesn't have an API key. You can create read-write
and read-only API keys in the **Project Settings** page.
Key Type | Description
-------------------|------------
Regular API key | Has full access to all documented API endpoints.
Read-only API key | Only works with the [Get a list of existing checks](#list-checks) and [Get a single check](#get-check) endpoints. Some fields are omitted from the API responses.
read-write key
: Has full access to all documented API endpoints.
The client can authenticate itself by sending an appropriate HTTP
request header. The header's name should be `X-Api-Key` and
its value should be your API key.
read-only key
: Only works with the following API endpoints:
* [Get a list of existing checks](#list-checks)
* [Get a single check](#get-check)
* [Get a list of check's status changes](#list-flips)
Alternatively, for POST requests with a JSON request body,
Omits some fields from the API responses (documented below).
The client can authenticate itself by including an `X-Api-Key: <your-api-key>`
header in a HTTP request. Alternatively, for POST requests with a JSON request body,
the client can include an `api_key` field in the JSON document.
See below the "Create a check" section for an example.
See the [Create a new check](#create-check) section for an example.
## API Requests


Loading…
Cancel
Save