[Feature] Added API endpoints to list, get and get the latest results#1983
Merged
alexjustesen merged 11 commits intomainfrom Jan 13, 2025
Merged
[Feature] Added API endpoints to list, get and get the latest results#1983alexjustesen merged 11 commits intomainfrom
alexjustesen merged 11 commits intomainfrom
Conversation
…its, and add human-readable bit rates
…switch to jsonPaginate
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📃 Description
This PR implements
/resultsAPI endpoints, you can list all results, get a specific result or get the latest result. This PR also introduces an "API Tokens" page for the user to manage their tokens.⚙️ Interacting with the API
When listing results you can sort and filter the response using the following criteria and fields.
🔑 Authentication
A "Bearer Token" is required to authenticate into the API, you can generate tokens for your user account on
/admin/api-tokens.🔎 Filtering
You can filter the results response by the fields:
ping,download,upload,healthy,status,scheduledandcreated_at.created_athas been aliased tostart_atandend_atto enable date range filtering in #1998.Example: filter for dates in a range
Example: filter for only unhealthy results
Example: filter for "failed" and "skipped" results
Package docs: https://spatie.be/docs/laravel-query-builder/v5/features/filtering
📈 Sorting
You can sort the results response by the fields:
ping,download,upload,created_atorupdated_at. Sorting is ascending by default and can be reversed by adding a hyphen (-) to the start of the property name.Package docs: https://spatie.be/docs/laravel-query-builder/v5/features/sorting
🪵 Changelog
➕ Added
api/v1/resultsto list API resultsapi/v1/results/latestto get the latest resultapi/v1/results/idto get a specific result✏️ Changed
api/healthchecktoapi.phproute file instead of a controller/api/healthcheckas deprecated/api/speedtest/latestas deprecated📖 Data Dictionary
The data structure returned mimic the
resultstable but includes the addition ofdownload_bits,upload_bits,download_bits_humanandupload_bits_human.Example:
{ "data": { "id": 1009, "service": "ookla", "ping": 7.448, "download": 167270969, "upload": 115884569, "download_bits": 1338167752, "upload_bits": 927076552, "download_bits_human": "1.34 Gbps", "upload_bits_human": "927.08 Mbps", "benchmarks": null, "healthy": null, "status": "completed", "scheduled": true, "comments": null, "data": { }, "created_at": "2025-01-13 16:37:00", "updated_at": "2025-01-13 16:37:17" } }🤔 Potential Questions...