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

Garmin Golf data #48

Closed
Richard-Tarbell opened this issue Feb 13, 2024 · 3 comments
Closed

Garmin Golf data #48

Richard-Tarbell opened this issue Feb 13, 2024 · 3 comments

Comments

@Richard-Tarbell
Copy link

I'm not sure if this is the place to put this so I apologize in advance if this belongs somewhere else!

Q: Hi everyone, I was wondering if anyone knows how to access the garmin golf data through garth?

Previously I was using the garmin_golf repo to get golf data via json file. However as of a couple months ago it no longer works. From what I can tell it appears to be a change in the API (I could be way off) and I can't figure out how to make it work again.

Garth seems like the better option to access my garmin data so I was hoping someone could point me in the right direction for accessing the golf data. I've tried a few ways but I'm still very new to APIs so I'm not sure what exactly to put in the garth.connectapi() call.

TIA

@matin
Copy link
Owner

matin commented Feb 15, 2024

I did some research on this. I'll test some of the endpoints I found over the weekend and add them here

@matin
Copy link
Owner

matin commented Feb 20, 2024

@Richard-Tarbell figured it out ...

Take a look at the endpoints in garmin-download.js and remove the initial part of https://connect.garmin.com/modern/proxy.

For example, I'm able to do the following:
garth.connectapi('/gcs-golfcommunity/api/v2/player/stats')

The same should apply for the other endpoints.

Let me know if that works for you as well.

@Richard-Tarbell
Copy link
Author

Richard-Tarbell commented Feb 20, 2024

That works perfect for me! Thanks @matin!! Using Garth is definitely gonna be an upgrade to my project by eliminating the need for users to download the file externally.

For anyone who was previously using garmin_golf here's the garth.connectapi() equivalent for the endpoints requiring parameters.

scorecardID = 123456789
hole_number = 1

round_stats = garth.connectapi(
    f"gcs-golfcommunity/api/v2/scorecard/detail",
    params={"scorecard-ids":scorecardID,"include-longest-shot-distance":"true"},
)

hole_details = garth.connectapi(
    f"gcs-golfcommunity/api/v2/shot/scorecard/{scorecardID}/hole",
    params={"hole-numbers":hole_number, "image-size":"IMG_730X730", "_":"1635952489437"},
)

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

No branches or pull requests

2 participants