forked from GithubBackups/healthchecks
Minor cleanup, update CHANGELOG
This commit is contained in:
parent
ffc7ccddf2
commit
da4cf5241e
@ -12,6 +12,7 @@ All notable changes to this project will be documented in this file.
|
||||
- Zulip integration (#202)
|
||||
- OpsGenie integration returns more detailed error messages
|
||||
- Telegram integration returns more detailed error messages
|
||||
- Added the "Get a single check" API call (#337)
|
||||
|
||||
### Bug Fixes
|
||||
- The "render_docs" command checks if markdown and pygments is installed (#329)
|
||||
|
@ -1,5 +1,4 @@
|
||||
from datetime import timedelta as td
|
||||
import uuid
|
||||
|
||||
from django.utils.timezone import now
|
||||
from hc.api.models import Channel, Check
|
||||
@ -52,4 +51,4 @@ class GetCheckTestCase(BaseTestCase):
|
||||
def test_it_handles_missing_check(self):
|
||||
made_up_code = "07c2f548-9850-4b27-af5d-6c9dc157ec02"
|
||||
r = self.get(made_up_code)
|
||||
self.assertEqual(r.status_code, 404)
|
||||
self.assertEqual(r.status_code, 404)
|
||||
|
@ -191,7 +191,7 @@ def single(request, code):
|
||||
try:
|
||||
validate(request.json, schemas.check)
|
||||
_update(check, request.json)
|
||||
except (BadChannelException,ValidationError) as e:
|
||||
except (BadChannelException, ValidationError) as e:
|
||||
return JsonResponse({"error": str(e)}, status=400)
|
||||
|
||||
return JsonResponse(check.to_dict())
|
||||
@ -208,14 +208,6 @@ def single(request, code):
|
||||
return HttpResponse(status=405)
|
||||
|
||||
|
||||
@csrf_exempt
|
||||
@cors("POST", "DELETE")
|
||||
@validate_json(schemas.check)
|
||||
@authorize
|
||||
def update(request, code):
|
||||
single(request, code)
|
||||
|
||||
|
||||
@cors("POST")
|
||||
@csrf_exempt
|
||||
@validate_json()
|
||||
|
@ -15,7 +15,7 @@ checks in user's account.</p>
|
||||
<td><code>GET SITE_ROOT/api/v1/checks/</code></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="#get-check">Create a single check</a></td>
|
||||
<td><a href="#get-check">Get a single check</a></td>
|
||||
<td><code>GET SITE_ROOT/api/v1/checks/<uuid></code></td>
|
||||
</tr>
|
||||
<tr>
|
||||
@ -178,15 +178,19 @@ is added. This identifier is stable across API calls. Example:</p>
|
||||
</code></pre></div>
|
||||
|
||||
|
||||
<h2 class="rule" id="get-check">Get a single Check</h2>
|
||||
<h2 class="rule" id="get-check">Get a Single Check</h2>
|
||||
<p><code>GET SITE_ROOT/api/v1/checks/<uuid></code></p>
|
||||
<p>Returns a JSON object containing information information from a single check.</p>
|
||||
<p>Returns a JSON representation of a single check.</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>
|
||||
<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>
|
||||
<div class="highlight"><pre><span></span><code>curl --header <span class="s2">"X-Api-Key: your-api-key"</span> SITE_ROOT/api/v1/checks/<uuid>
|
||||
|
@ -8,7 +8,7 @@ checks in user's account.
|
||||
Endpoint Name | Endpoint Address
|
||||
------------------------------------------------------|-------
|
||||
[Get a list of existing checks](#list-checks) | `GET SITE_ROOT/api/v1/checks/`
|
||||
[Create a single check](#get-check) | `GET SITE_ROOT/api/v1/checks/<uuid>`
|
||||
[Get a single check](#get-check) | `GET SITE_ROOT/api/v1/checks/<uuid>`
|
||||
[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`
|
||||
@ -158,10 +158,10 @@ is added. This identifier is stable across API calls. Example:
|
||||
}
|
||||
```
|
||||
|
||||
## Get a single Check {: #get-check .rule }
|
||||
## Get a Single Check {: #get-check .rule }
|
||||
`GET SITE_ROOT/api/v1/checks/<uuid>`
|
||||
|
||||
Returns a JSON object containing information information from a single check.
|
||||
Returns a JSON representation of a single check.
|
||||
|
||||
### Response Codes
|
||||
|
||||
@ -171,6 +171,13 @@ Returns a JSON object containing information information from a single check.
|
||||
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
|
||||
|
||||
```bash
|
||||
|
@ -1,5 +1,5 @@
|
||||
<h1>Cloning Checks</h1>
|
||||
<p>You can individually clone individual checks SITE_NAME from the "Check Details"
|
||||
<p>You can clone individual checks from the "Check Details"
|
||||
page:</p>
|
||||
<p><img alt="The "Create a Copy" button" src="IMG_URL/create_copy.png" /></p>
|
||||
<p>The "Create a Copy..." function creates a new check in the same project, and copies
|
||||
|
Loading…
x
Reference in New Issue
Block a user