cancel
Showing results for 
Search instead for 
Did you mean: 

Problem while posting activity

Oddball
Mt. Kenya

Hello colleagues,

This is my first post here. In fact it's my first time ever when I reach to any community for help. So please have mercy 🙂 
I tried to learn how to make API calls. I wanted to make call to Strava to fill my feed with dummy activity. 

But when I thought I made everything correctly here is an result:

Oddball_1-1708565839106.png

And I wonder If it's me who made something wrong or really It's bad luck?

I will be greateful for your help,

Lukasz

 

 

1 ACCEPTED SOLUTION

ActivityFix
Kilimanjaro

It's hard to say as you are passing a lot of additional parameters which aren't needed and could be messing up the request (like the cookies). It may also be a temporary issue as usually you'd get an error about an invalid request rather than a CloudFront error. That said, there are several issues that I can see:

  1. If you're trying to create an activity, it should be a POST request to /activities, not a GET
  2. You don't need any of the parameters you're passing except the authorization header. See createActivity for the list of arguments
    1. Also your authorization header has a typo. It needs to be Bearer
  3. You need to pass the parameters listed in createActivity.

Before you try to create an activity I would recommend starting with a much simpler call like getLoggedInAthlete which doesn't require any parameters. It will let you verify that the rest of your setup like getting a token is correct. Once you've got that working you can move on to other API calls which require additional arguments.

View solution in original post

2 REPLIES 2

ActivityFix
Kilimanjaro

It's hard to say as you are passing a lot of additional parameters which aren't needed and could be messing up the request (like the cookies). It may also be a temporary issue as usually you'd get an error about an invalid request rather than a CloudFront error. That said, there are several issues that I can see:

  1. If you're trying to create an activity, it should be a POST request to /activities, not a GET
  2. You don't need any of the parameters you're passing except the authorization header. See createActivity for the list of arguments
    1. Also your authorization header has a typo. It needs to be Bearer
  3. You need to pass the parameters listed in createActivity.

Before you try to create an activity I would recommend starting with a much simpler call like getLoggedInAthlete which doesn't require any parameters. It will let you verify that the rest of your setup like getting a token is correct. Once you've got that working you can move on to other API calls which require additional arguments.

Hello,

I made it!

Oddball_0-1708645766325.png

Although I faced errors with code 400 bad request when I had this Bearer in string. 
I have to say I don't quite understand what is it. 
Anyhow, I found someone put access_token in string to other API CALL when this Bearer was required. So I followed same logic and put access_token instead of "Bearer [token]". And from that moment it works as a charm! 

Thank you for you help, your guidance was helpful!

Cheers,
Lukasz

Ready, Get Set, Go!

Welcome to the Community - here is your guide to help you get started!


Know how to use Community


Understand Community Settings