weglide / bugtracker

WeGlide platform bug tracker.
https://www.weglide.org
11 stars 0 forks source link

Full download links in API #42

Closed fousa closed 3 years ago

fousa commented 3 years ago

I want to download the IGC file through the API. But when I perform the API calls, I'm unable to construct the correct file URL.

This is the call I'm currently executing:

curl "https://api.weglide.org/v1/igcfile/1915?user_id_in=220&order_by=-scoring_date" \
     -H 'Authorization: Bearer some_bearer_token' \
     -H 'Content-Type: application/json; charset=utf-8' \
     -d $'{}'

This returns the following JSON with a file field:

{
    "file": "220/igcfiles/HvD4btstr5tbhbGJPMyZTsrC.igc"
}

When I try to download from the website I get to this page: https://beta.weglide.org/download/igc/1914 And checking the link here results in this: https://d20vaqhjhyde3e.cloudfront.net/220/igcfiles/Sr5l9KTrPQjIr9UlJmwRhUz4.igc

It would be nice to have this full link in the file field in the returned JSON.

Or is there another way to construct this URL?

samuel-git commented 3 years ago

For now, just prepend the missing URL part. It's static (but maybe subject to change in the future).

samuel-git commented 3 years ago

80