[GH-ISSUE #337] API return single check #257

Closed
opened 2026-02-25 23:41:47 +03:00 by kerem · 7 comments
Owner

Originally created by @jameskirsop on GitHub (Feb 24, 2020).
Original GitHub issue: https://github.com/healthchecks/healthchecks/issues/337

Similar to, but not quite the same as, #256, it would be great if the hc-api-update URL (aka api/v1/checks/<uuid:code>) could be adjusted to support returning the data for a single check.

The current situation of providing a list of all checks and their status is great. However, I'm writing a datasource integration with Grafana, which will be significantly easier to do if the datasource can poll for a single check via a GET by uuid (after a user selects the check they wish to display in the panel).

Originally created by @jameskirsop on GitHub (Feb 24, 2020). Original GitHub issue: https://github.com/healthchecks/healthchecks/issues/337 Similar to, but not quite the same as, #256, it would be great if the `hc-api-update` URL (aka `api/v1/checks/<uuid:code>`) could be adjusted to support returning the data for a single check. The current situation of providing a list of all checks and their status is great. However, I'm writing a [datasource integration with Grafana](https://github.com/jameskirsop/grafana-healthchecksio-datasource), which will be significantly easier to do if the datasource can poll for a single check via a `GET` by uuid (after a user selects the check they wish to display in the panel).
kerem closed this issue 2026-02-25 23:41:47 +03:00
Author
Owner

@cuu508 commented on GitHub (Feb 24, 2020):

Thanks for the suggestion. Makes sense and should be relatively easy to support.

It will take me some time to get this done and deployed. In the meantime, you can use the POST /api/v1/checks/<uuid:code> call and send an empty JSON dictionary ("update the check but don't change any fields"). It's going to be less efficient, but should allow you to continue without waiting on me.

And – great to see you working on a Grafana datasource – looking forward to try it out!

<!-- gh-comment-id:590209605 --> @cuu508 commented on GitHub (Feb 24, 2020): Thanks for the suggestion. Makes sense and should be relatively easy to support. It will take me some time to get this done and deployed. In the meantime, you can use the `POST /api/v1/checks/<uuid:code>` call and send an empty JSON dictionary ("update the check but don't change any fields"). It's going to be less efficient, but should allow you to continue without waiting on me. And – great to see you working on a Grafana datasource – looking forward to try it out!
Author
Owner

@jameskirsop commented on GitHub (Feb 24, 2020):

@cuu508, I'm happy to fork and create a branch for these changes and do a PR for review.

I'll update this comment with a link to the fork/branch once I've made some meaningful changes.

Here's a diff showing the changes that I believe fully implement this feature request, and pass the pre-built tests.

The branch is over at https://github.com/jameskirsop/healthchecks/tree/api-single-check

Happy to create a PR if this looks OK. I wasn't quite sure how/where to update the documentation, so if that needs to be done - I'll need some pointers to look in the right place.

<!-- gh-comment-id:590574627 --> @jameskirsop commented on GitHub (Feb 24, 2020): @cuu508, I'm happy to fork and create a branch for these changes and do a PR for review. ~~I'll update this comment with a link to the fork/branch once I've made some meaningful changes.~~ [Here's a diff](https://github.com/jameskirsop/healthchecks/commit/d88f99a712454adbef7798b2415fc957263fa648) showing the changes that I believe fully implement this feature request, and pass the pre-built tests. The branch is over at https://github.com/jameskirsop/healthchecks/tree/api-single-check Happy to create a PR if this looks OK. I wasn't quite sure how/where to update the documentation, so if that needs to be done - I'll need some pointers to look in the right place.
Author
Owner

@cuu508 commented on GitHub (Mar 2, 2020):

Sorry for the silence – I missed the edit!

Unless I'm missing something, it looks like hc.api.views.update would now be unused and can be removed.

It would be good to have a test case that exercises the GET /api/v1/checks/<uuid:code> route.

The API documentation is in the templates/front/docs_api.html file, and example requests/responses are in templates/front/snippets/ directory. Each snippet has a .txt file and a generated .html file. The html versions are generated with manage.py pygmentize.

Please hold off updating documentation for a bit – I'll see if I can reformat the API documentation to Markdown. This should make updating it much easier.

<!-- gh-comment-id:593289567 --> @cuu508 commented on GitHub (Mar 2, 2020): Sorry for the silence – I missed the edit! Unless I'm missing something, it looks like `hc.api.views.update` would now be unused and can be removed. It would be good to have a test case that exercises the `GET /api/v1/checks/<uuid:code>` route. The API documentation is in the `templates/front/docs_api.html` file, and example requests/responses are in `templates/front/snippets/` directory. Each snippet has a .txt file and a generated .html file. The html versions are generated with `manage.py pygmentize`. Please hold off updating documentation for a bit – I'll see if I can reformat the API documentation to Markdown. This should make updating it much easier.
Author
Owner

@cuu508 commented on GitHub (Mar 2, 2020):

I've now converted the API reference to Markdown format. To update documentation:

  • edit templates/docs/api.md
  • run manage.py render_docs to generate the HTML version
<!-- gh-comment-id:593362355 --> @cuu508 commented on GitHub (Mar 2, 2020): I've now converted the API reference to Markdown format. To update documentation: * edit `templates/docs/api.md` * run `manage.py render_docs` to generate the HTML version
Author
Owner

@cuu508 commented on GitHub (Mar 19, 2020):

@jameskirsop what are your plans on this? I can take over if you've moved on to something else.

<!-- gh-comment-id:601369365 --> @cuu508 commented on GitHub (Mar 19, 2020): @jameskirsop what are your plans on this? I can take over if you've moved on to something else.
Author
Owner

@jameskirsop commented on GitHub (Mar 22, 2020):

Sorry @cuu508, got distracted on something else. I'm still keen to make this change (and have some other suggestions too). I'll try and do a PR today.

<!-- gh-comment-id:602288318 --> @jameskirsop commented on GitHub (Mar 22, 2020): Sorry @cuu508, got distracted on something else. I'm still keen to make this change (and have some other suggestions too). I'll try and do a PR today.
Author
Owner

@cuu508 commented on GitHub (Mar 23, 2020):

Thanks for updating the PR, @jameskirsop !
I cleaned up a few bits and merged it. It's now been deployed to https://healthchecks.io

<!-- gh-comment-id:602501590 --> @cuu508 commented on GitHub (Mar 23, 2020): Thanks for updating the PR, @jameskirsop ! I cleaned up a few bits and merged it. It's now been deployed to https://healthchecks.io
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/healthchecks#257
No description provided.