-
Notifications
You must be signed in to change notification settings - Fork 4
new API structure #159
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
new API structure #159
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,279 @@ | ||
| # API Reference Documentation Architecture | ||
|
|
||
| This document outlines how the API reference section is built, maintained, and potential improvements. | ||
|
Check warning on line 3 in API-DOCUMENTATION.md
|
||
|
|
||
| ## Current Architecture | ||
|
|
||
| ### Overview | ||
|
|
||
| The API reference documentation uses Mintlify's OpenAPI integration. The system has three main components: | ||
|
|
||
| ``` | ||
| ┌─────────────────────────────────────────────────────────────────────────┐ | ||
| │ docs.json │ | ||
| │ - Defines "API" tab with openapi reference │ | ||
| │ - Contains 22 navigation groups │ | ||
| │ - Lists all 132 page references │ | ||
| └─────────────────────────────────────────────────────────────────────────┘ | ||
| │ | ||
| ▼ | ||
| ┌─────────────────────────────────────────────────────────────────────────┐ | ||
| │ api-reference/openapi.json │ | ||
| │ - 514KB OpenAPI 3.0.0 specification │ | ||
| │ - Auto-updated from https://api.checklyhq.com/openapi.json │ | ||
| │ - Contains 94 unique API paths │ | ||
| │ - Source of truth for all endpoint documentation │ | ||
| └─────────────────────────────────────────────────────────────────────────┘ | ||
| │ | ||
| ▼ | ||
| ┌─────────────────────────────────────────────────────────────────────────┐ | ||
| │ api-reference/{category}/*.mdx │ | ||
| │ - 132 stub files across 29 subdirectories │ | ||
| │ - Minimal content: just frontmatter with `openapi: METHOD /path` │ | ||
| │ - Mintlify auto-generates full documentation from OpenAPI spec │ | ||
| └─────────────────────────────────────────────────────────────────────────┘ | ||
| ``` | ||
|
|
||
| ### File Structure | ||
|
|
||
| ``` | ||
| api-reference/ | ||
| ├── openapi.json # OpenAPI 3.0.0 spec (auto-updated) | ||
| ├── accounts/ # 3 files | ||
| ├── alert-channels/ # 6 files | ||
| ├── alert-notifications/ # 1 file | ||
| ├── analytics/ # 8 files | ||
| ├── badges/ # 2 files | ||
| ├── check-alerts/ # 2 files | ||
| ├── check-groups/ # 9 files | ||
| ├── check-results/ # 3 files | ||
| ├── check-sessions/ # 3 files | ||
| ├── check-status/ # 2 files | ||
| ├── checks/ # 13 files | ||
| ├── client-certificates/ # 4 files | ||
| ├── dashboards/ # 5 files | ||
| ├── environment-variables/ # 5 files | ||
| ├── heartbeats/ # 5 files | ||
| ├── incident-updates/ # 3 files | ||
| ├── incidents/ # 4 files | ||
| ├── location/ # 1 file | ||
| ├── maintenance-windows/ # 5 files | ||
| ├── monitors/ # 2 files | ||
| ├── opentelemetry/ # 1 file (not in nav) | ||
| ├── private-locations/ # 8 files | ||
| ├── reporting/ # 1 file | ||
| ├── runtimes/ # 2 files | ||
| ├── snippets/ # 5 files | ||
| ├── static-ips/ # 6 files | ||
| ├── status-page-incidents/ # 10 files | ||
| ├── status-page-services/ # 5 files | ||
| ├── status-pages/ # 7 files | ||
| └── triggers/ # 6 files | ||
| ``` | ||
|
|
||
| ### MDX File Format | ||
|
Check warning on line 74 in API-DOCUMENTATION.md
|
||
|
|
||
| Each MDX file is a minimal stub that references an OpenAPI path: | ||
|
Check warning on line 76 in API-DOCUMENTATION.md
|
||
|
|
||
| ```yaml | ||
| --- | ||
| openapi: get /v1/accounts | ||
| --- | ||
| ``` | ||
|
|
||
| Optional fields: | ||
| - `deprecated: true` - marks endpoint as deprecated | ||
|
|
||
| Mintlify automatically generates: | ||
| - Endpoint description | ||
| - HTTP method badge (GET/POST/PUT/DELETE) | ||
|
Check warning on line 89 in API-DOCUMENTATION.md
|
||
| - Request parameters table | ||
| - Request body schema | ||
| - Response schemas for all status codes | ||
| - Code examples (cURL, JavaScript, Python) | ||
| - "Try it" interactive playground | ||
|
|
||
| ### docs.json Configuration | ||
|
|
||
| Located at lines 577-863, the API tab is configured as: | ||
|
Check warning on line 98 in API-DOCUMENTATION.md
|
||
|
|
||
| ```json | ||
| { | ||
| "tab": "API", | ||
| "openapi": "api-reference/openapi.json", | ||
| "groups": [ | ||
| { | ||
| "group": "Accounts", | ||
| "pages": [ | ||
| "api-reference/accounts/fetch-user-accounts", | ||
| "api-reference/accounts/fetch-current-account-details", | ||
| "api-reference/accounts/fetch-a-given-account-details" | ||
| ] | ||
| }, | ||
| // ... 21 more groups | ||
| ] | ||
| } | ||
| ``` | ||
|
|
||
| ### Automation | ||
|
|
||
| #### GitHub Actions Workflow | ||
|
|
||
| **File:** `.github/workflows/update-api-spec.yml` | ||
|
|
||
| - **Schedule:** Runs every 48 hours (cron: `0 2 */2 * *`) | ||
|
Check warning on line 124 in API-DOCUMENTATION.md
|
||
| - **Trigger:** Also supports manual `workflow_dispatch` | ||
| - **Process:** | ||
| 1. Fetches spec from `https://api.checklyhq.com/openapi.json` | ||
| 2. Converts HTML tags in descriptions to Markdown | ||
| 3. Validates with `mintlify openapi-check` | ||
| 4. Commits directly to `main` if changed | ||
|
|
||
| #### Update Script | ||
|
|
||
| **File:** `update-api-spec.sh` | ||
|
|
||
| ```bash | ||
| # Key operations: | ||
| 1. Fetch live spec from API | ||
| 2. Convert HTML to Markdown (<a> → [](), <br> → \n, <b> → **, <code> → `) | ||
| 3. Validate OpenAPI spec | ||
| 4. Replace local file | ||
| ``` | ||
|
|
||
| ## Current Issues | ||
|
|
||
| ### 1. MDX/Navigation Sync Issues | ||
|
Check warning on line 146 in API-DOCUMENTATION.md
|
||
|
|
||
| The 132 MDX files correctly map to OpenAPI operations (method + path). A single path like `/v1/checks/{id}` can have multiple methods (GET, PUT, DELETE), each requiring its own MDX file. | ||
|
Check warning on line 148 in API-DOCUMENTATION.md
|
||
|
|
||
| | Metric | Count | | ||
| |--------|-------| | ||
| | MDX files | 132 | | ||
| | Unique API paths in MDX | 90 | | ||
| | HTTP methods breakdown | GET: 67, POST: 26, PUT: 21, DELETE: 18 | | ||
|
|
||
| #### Orphaned MDX Files (exist but not in navigation) | ||
|
Check warning on line 156 in API-DOCUMENTATION.md
|
||
|
|
||
| | File | OpenAPI Reference | | ||
| |------|-------------------| | ||
| | `api-reference/opentelemetry/post-accounts-metrics.mdx` | `post /accounts/{accountId}/metrics` | | ||
|
|
||
| #### Broken Navigation Links (in docs.json but no MDX file) | ||
|
Check warning on line 162 in API-DOCUMENTATION.md
|
||
|
|
||
| | Missing File | | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm missing context on the purpose of this doc, but why are we documenting issues, missing files, open questions, inconsistencies etc here? |
||
| |--------------| | ||
| | `api-reference/snippets/list-all-snippets.mdx` | | ||
| | `api-reference/snippets/create-a-snippet.mdx` | | ||
| | `api-reference/snippets/retrieve-a-snippet.mdx` | | ||
| | `api-reference/snippets/update-a-snippet.mdx` | | ||
| | `api-reference/snippets/delete-a-snippet.mdx` | | ||
| | `api-reference/detect/uptime-monitoring/url-monitors/overview.mdx` | | ||
| | `api-reference/detect/uptime-monitoring/url-monitors/configuration.mdx` | | ||
|
|
||
| **Summary:** 1 orphaned file + 7 broken links = 8 total issues | ||
|
|
||
| ### 2. Navigation Inconsistencies | ||
|
|
||
| - 22 groups in docs.json, 29 subdirectories in filesystem | ||
| - The `opentelemetry/` directory has 1 file but no group in docs.json | ||
| - The `snippets/` group exists in docs.json but files have different names or are missing | ||
|
|
||
| ### 3. Naming Inconsistencies | ||
|
|
||
| - Mixed patterns: `list-all-*` vs `lists-all-*` | ||
| - Some verbose names: `retrieve-all-checks-in-a-specific-group-with-group-settings-applied` | ||
| - Inconsistent verb usage: `fetch` vs `retrieve` vs `get` vs `list` | ||
|
|
||
| ### 4. Orphaned Files | ||
|
|
||
| - Multiple backup files: `openapi.json.backup*` | ||
| - Directories with files not in docs.json navigation | ||
|
|
||
| ### 5. Manual Synchronization Required | ||
|
|
||
| - When API spec adds/removes endpoints, MDX files and docs.json must be manually updated | ||
|
Check warning on line 195 in API-DOCUMENTATION.md
|
||
| - No automation for generating new MDX stubs or updating navigation | ||
|
|
||
| ## Potential Improvements | ||
|
|
||
| ### Short-term | ||
|
|
||
| 1. **Audit and cleanup** | ||
| - Remove orphaned MDX files that don't map to OpenAPI paths | ||
| - Delete backup files | ||
| - Add missing pages to docs.json or remove unused directories | ||
| 2. **Fix broken links** | ||
| - Verify all docs.json page references have corresponding MDX files | ||
| - Verify all MDX `openapi:` references exist in openapi.json | ||
| 3. **Standardize naming** | ||
| - Establish naming conventions (e.g., always `list-` not `lists-`) | ||
|
Check warning on line 212 in API-DOCUMENTATION.md
|
||
| - Keep names concise but descriptive | ||
| ### Medium-term | ||
| 4. **Automate MDX generation** | ||
| - Script to generate MDX stubs from OpenAPI paths | ||
| - Script to update docs.json navigation from OpenAPI tags | ||
| - Run as part of the update-api-spec workflow | ||
| 5. **Leverage OpenAPI tags** | ||
| - OpenAPI spec likely has tags for grouping endpoints | ||
| - Could auto-generate navigation structure from tags | ||
| ### Long-term | ||
| 6. **Consider Mintlify auto-generation** | ||
| - Mintlify can auto-generate pages from OpenAPI spec | ||
| - May eliminate need for individual MDX files | ||
|
Check warning on line 230 in API-DOCUMENTATION.md
|
||
| - Trade-off: less control over URL structure and organization | ||
| ## API Endpoints Summary | ||
| ### By Category (from OpenAPI spec paths) | ||
| | Category | Endpoints | | ||
| |----------|-----------| | ||
| | accounts | 3 | | ||
| | alert-channels | 3 | | ||
| | alert-notifications | 1 | | ||
| | analytics | 8 | | ||
| | badges | 2 | | ||
| | check-alerts | 2 | | ||
| | check-groups | 4 | | ||
| | check-results | 2 | | ||
| | check-sessions | 3 | | ||
| | check-statuses | 2 | | ||
| | checks | 18 | | ||
| | client-certificates | 2 | | ||
| | dashboards | 2 | | ||
| | incidents | 4 | | ||
| | locations | 1 | | ||
| | maintenance-windows | 2 | | ||
| | private-locations | 5 | | ||
| | reporting | 1 | | ||
| | runtimes | 2 | | ||
| | snippets | 2 | | ||
| | static-ips | 6 | | ||
| | status-pages | 12 | | ||
| | triggers | 2 | | ||
| | variables | 2 | | ||
| ## Related Files | ||
| | File | Purpose | | ||
| |------|---------| | ||
| | `docs.json` | Main config, API nav at lines 577-863 | | ||
| | `api-reference/openapi.json` | OpenAPI 3.0.0 specification | | ||
| | `update-api-spec.sh` | Script to fetch and process spec | | ||
| | `.github/workflows/update-api-spec.yml` | Automation workflow | | ||
| ## Questions to Resolve | ||
| 1. Should we automate MDX stub generation when the OpenAPI spec changes? | ||
|
Check warning on line 275 in API-DOCUMENTATION.md
|
||
| 2. Should we consolidate some navigation groups (22 seems high)? | ||
|
Check warning on line 276 in API-DOCUMENTATION.md
|
||
| 3. Is the opentelemetry endpoint intentionally hidden from navigation? | ||
|
Check warning on line 277 in API-DOCUMENTATION.md
|
||
| 4. Should deprecated endpoints be removed or kept for backwards compatibility? | ||
|
Check warning on line 278 in API-DOCUMENTATION.md
|
||
| 5. Would Mintlify's auto-generation feature be preferable to manual MDX files? | ||
|
Check warning on line 279 in API-DOCUMENTATION.md
|
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,3 +1,4 @@ | ||||||
| --- | ||||||
| openapi: get /v1/accounts/{accountId} | ||||||
| title: Get specific account details | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| --- | ||||||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,3 +1,4 @@ | ||||||
| --- | ||||||
| openapi: get /v1/accounts/me | ||||||
| title: Get current account details | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| --- | ||||||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,3 +1,4 @@ | ||||||
| --- | ||||||
| openapi: get /v1/accounts | ||||||
| title: Get all account details | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| --- | ||||||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,3 +1,4 @@ | ||||||
| --- | ||||||
| openapi: get /v1/analytics/api-checks/{id} | ||||||
| title: Get API Check analytics | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||||||
| --- | ||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,4 @@ | ||
| --- | ||
| openapi: get /v1/badges/checks/{checkId} | ||
| title: Get badge for a check | ||
| --- |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,4 @@ | ||
| --- | ||
| openapi: get /v1/badges/groups/{groupId} | ||
| title: Get badge for a group | ||
| --- |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,4 @@ | ||
| --- | ||
| openapi: post /v1/checks/tcp | ||
| title: Create a TCP monitor | ||
| --- |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,4 @@ | ||
| --- | ||
| openapi: put /v1/checks/tcp/{id} | ||
| title: Update a TCP monitor | ||
| --- |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,3 +1,4 @@ | ||||||
| --- | ||||||
| openapi: post /v1/client-certificates | ||||||
| title: Create new client certificate | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| --- | ||||||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,3 +1,4 @@ | ||||||
| --- | ||||||
| openapi: delete /v1/client-certificates/{id} | ||||||
| title: Delete existing client certificate | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| --- | ||||||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,3 +1,4 @@ | ||||||
| --- | ||||||
| openapi: get /v1/client-certificates | ||||||
| title: List client certificates | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| --- | ||||||
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,3 +1,4 @@ | ||||||||||
| --- | ||||||||||
| openapi: get /v1/client-certificates/{id} | ||||||||||
| title: List specific client certificate | ||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
This phrasing ("retrieve a )seems to be the most commonly used one 👀 |
||||||||||
| --- | ||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,4 @@ | ||
| --- | ||
| openapi: post /v1/variables | ||
| title: Create an environment variable | ||
| --- |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,3 +1,4 @@ | ||||||
| --- | ||||||
| openapi: post /v1/checks/heartbeat | ||||||
| title: Create a heartbeat check | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| --- | ||||||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,3 +1,4 @@ | ||||||
| --- | ||||||
| openapi: get /v1/checks/heartbeats/{checkId}/events | ||||||
| title: List events for a heartbeat | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| --- | ||||||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,3 +1,4 @@ | ||||||
| --- | ||||||
| openapi: get /v1/checks/heartbeats/{checkId}/events/{id} | ||||||
| title: List a specific heartbeat event | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| --- | ||||||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,3 +1,4 @@ | ||||||
| --- | ||||||
| openapi: get /v1/checks/heartbeats/{checkId}/availability | ||||||
| title: Get heartbeat availability | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| --- | ||||||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,3 +1,4 @@ | ||||||
| --- | ||||||
| openapi: put /v1/checks/heartbeat/{id} | ||||||
| title: Update a heartbeat check | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| --- | ||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,4 @@ | ||
| --- | ||
| openapi: post /v1/checks/url | ||
| title: Create a URL monitor | ||
| --- |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,4 @@ | ||
| --- | ||
| openapi: put /v1/checks/url/{id} | ||
| title: Update a URL monitor | ||
| --- |

There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, good call to document how the API reference comes together. We can probably clean this up and make it more concise, but this is good for now.