Skip to content
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

Add data to 'latest' [GET] endpoint. #1912

Open
MartynKeigher opened this issue Dec 12, 2024 · 3 comments
Open

Add data to 'latest' [GET] endpoint. #1912

MartynKeigher opened this issue Dec 12, 2024 · 3 comments
Labels
🎉 feature New feature or request
Milestone

Comments

@MartynKeigher
Copy link

MartynKeigher commented Dec 12, 2024

Is your feature request related to a problem? Please describe.

  • This feature request is not related to a problem. This request is to add 2 datapoints to the existing 'latest' API data output.
  • This is a 'quality of tweak' for sure! 👍🏼

Describe the solution you'd like
With residential internet speeds getting better, I recently upgraded my 1GB internet to 2GB. As a result, my speed tests are in the 1900 - 2300 Mbps range, as opposed to 800-950Mbps. I have a Stream Deck displaying my speeds and this is documented here. However, given that my results (since the upgrade) now display more digits, this makes is very congested on the StreamDeck button, PLUS... with so many tools that are(frustratingly) implementing regex and number formatting in their own unique ways, it would be beneficial if there were 2 data points added to the API that return the data in a clean 'pre-formatted' manner, so I could query those fields instead. Essentially, showing the results in the same format the 'Results' grid currently does in the app.

Example output:

{
    "message": "ok",
    "data": {
        "id": 2,
        "ping": 14.789,
        "download": 2343.16,
        "upload": 2258.65,
        "download_gb": 2.34,
        "upload_gb": 2.26,
        "server_id": <<redacted>>,
        "server_host": "<<redacted>>",
        "server_name": "<<redacted>>",
        "url": "https://www.speedtest.net/result/c/<<redacted>>",
        "scheduled": true,
        "failed": false,
        "created_at": "2024-12-11T18:53:01.000000-05:00",
        "updated_at": "2024-12-11T18:53:28.000000-05:00"
    }
}

Note the suggested "download_gb" and "upload_gb" fields that round up\down to the 2nd decimal place. 😉

Additional context

  • This shouldn't break existing functionality. 🤔

Thanks for considering.
://mk

@MartynKeigher MartynKeigher changed the title Add datapoints to 'latest' API response Add data to 'latest' [GET] endpoint. Dec 12, 2024
@alexjustesen alexjustesen added this to the v0.x.0 (API) milestone Dec 12, 2024
@alexjustesen alexjustesen added the 🎉 feature New feature or request label Dec 12, 2024
@sunnycloudy1337
Copy link

Just a note:

  1. APIs should never return formatted data, ever. (nor should they duplicate existing data 😖)
  2. Formatting should happen in the client.

I hate my co-workers who do this, creating duplicated and useless fields in my API responses thus making the response bigger just because they are too lazy to do formatting in the client app, and they always revert their PRs after I talk some sense into them 😬

@alexjustesen
Copy link
Owner

Just a note:

  1. APIs should never return formatted data, ever. (nor should they duplicate existing data 😖)
  2. Formatting should happen in the client.

This issue is being kept open as a reminder that backwards compatibility needs to remain for Homepage and Organizr dashboards. https://docs.speedtest-tracker.dev/api/latest-result

So I won't be making changes to this route and the future api responses will be in bytes (what the CLI returns) and in bits. We're doing this for the Influxdb integration for consistency already.

@MartynKeigher
Copy link
Author

Just a note:

  1. APIs should never return formatted data, ever. (nor should they duplicate existing data 😖)
  2. Formatting should happen in the client.

I hate my co-workers who do this, creating duplicated and useless fields in my API responses thus making the response bigger just because they are too lazy to do formatting in the client app, and they always revert their PRs after I talk some sense into them 😬

@sunnycloudy1337 - Honestly, I can't say I disagree with you there... on both points! Both are very valid, and I will not contest you at all. 👍🏼

The client I am working with is 'API Ninja' a plugin for the StreamDeck. I'll contact them to see if they can do a better job at the formatting they do for data. That said, it may well just be a UI\UX 'issue' on their part... its not the most intuitive.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🎉 feature New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants
@alexjustesen @MartynKeigher @sunnycloudy1337 and others