Skip to main content
Solved

Help with GET /activities/{id}


Forum|alt.badge.img+3

Hi all, 👋

Wondering if there is any help on what I might be doing wrong, I am building an app and have implemented the OAuth with the following scopes when i user signs in and adds the app. The scopes are read, activity:read, activity:read_all and activity:write

I can use the token that I get to get a list of all my activities, but when I try to get the activity using an ID returned from one of my activities in the list I am receiving the following 401 error.

"field": "Not allowed to view unauthenticated activities",

What I don't understand is the activity is not hidden, or private, it is available to everyone.  

I am confused why I would be getting this error.

Any help or guidance as to why I might be getting this error would be appreciated.

TIA

Best answer by centrium

The request was just a GET request to the following:

https://www.strava.com/api/v3/activities/<activityId>

So replace the activityId with the Id of the activity you will be allowed access to from your AccessToken.  The access token I assume you are passing in the Auth header as a Bearer.


Not sure if it helps, but heres a generated CUrl request from Postman

curl --location 'https://www.strava.com/api/v3/activities/<activityId>'
--header 'Authorization: Bearer <accessToken>'
--data ''

View original

Forum|alt.badge.img+3
  • Hub Rookie
  • May 4, 2024

Apologies, as soon as I sent the message I realised my error was how I was constructing the API request 🤦🏻‍♂


Forum|alt.badge.img+2
  • Hub Rookie
  • May 27, 2024

could you share how you fixed that?


Forum|alt.badge.img+3
  • Hub Rookie
  • May 27, 2024

Hey, yea it was how I was making the request, I thought {id} needed to be passed into the body, but actually its just a request with id being part of the URI.  So turned out it was /activities/12345678 rather than /activities with {id} being as part of the request.  Hopefully that makes sense and helps you. 


Forum|alt.badge.img+2
  • Hub Rookie
  • May 28, 2024

I did the same like you but it still didnt work, I still got into this issue "field""Not allowed to view unauthenticated activities". Can you share your sample request?


Forum|alt.badge.img+3
  • Hub Rookie
  • May 28, 2024

The request was just a GET request to the following:

https://www.strava.com/api/v3/activities/<activityId>

So replace the activityId with the Id of the activity you will be allowed access to from your AccessToken.  The access token I assume you are passing in the Auth header as a Bearer.


Not sure if it helps, but heres a generated CUrl request from Postman

curl --location 'https://www.strava.com/api/v3/activities/<activityId>'
--header 'Authorization: Bearer <accessToken>'
--data ''


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept, you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings