Cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

same activity upload: for some users response 500 internal server error

ANSWERED

We get reports from several users of our app that they can't upload activity data to Fitbit anymore (since 1 or 2 days). We checked it and we see that they get the following error response when uploading an activity:

{
"error": {
"code": 500,
"message": "Internal error encountered.",
"status": "INTERNAL"
}
}

We tested this with two Fitbit test accounts: with Postman we uploaded the same activity data sucessfully to one test account, but on the other account it fails with the internal error. We only changed the authorization token and the user id. We reauthorized the test user, but that didn't solve the problem, the activity uploads keeps returning the 500 response.

I can give you detailed information to reproduce this, but preferably not here in the public forum.

Best Answer
29 REPLIES 29

I suggest to add distanceUnit (with value 'miles' without quotes) in addition to distance and check what happens 

Best Answer
0 Votes

Thanks for the response.  This is still producing 500 error:

activity = {
'activityId': 90009, # The ID of the activity
'manualCalories': 800,
'durationMillis': 3600000, # The duration of the activity in milliseconds
'startTime': '7:00', # The start time of the activity in format 'HH:mm'
'date': date_str, # The date of the activity in format 'yyyy-MM-dd'
'distance': 7, # The distance of the activity in miles
'distanceUnit': 'miles' # The distance unit of the activity
}

Best Answer
0 Votes

try "distanceUnit" with value "mile" instead of "miles", I tested it and it should work. It is not according to the API spec, but hopefully it works for you.

Best Answer
0 Votes

Unfortunately that didn't work either.  I've all kinds of variations.  Switching to activityName "Running" (and "Run"), I've tried switching to distanceUnits "Steps".  I'm getting 500 errors every time.  This worked correctly before this latest issue started.  Not sure why it's not working when others have started seeing success. Logging sleep works so Authentication and network communication all seem fine.

Best Answer
0 Votes

Thanks for the update

Best Answer
0 Votes

@Doubleplays I think you still do something wrong with one of the fields. In your example you didn't specify the date, and the time was not encoded. I tested your sample data with Postman and it is working fine, here you see the url request (without the token Header, that's something you need to add of course). I can't specify the date in this comment, it is not allowed, but you now the format yyyy-MM-dd

Best Answer
0 Votes

@Hielko what’s the url to submit a bug?

also, do you use the activities endpoint to send steps?

thanks,

chris

Best Answer
0 Votes

@bickster On the Fitbit site https://dev.fitbit.com/build/reference/web-api/partner-help/ you can find an email address. And there is also a form that you can use: https://dev.fitbit.com/build/reference/web-api/help/

Best Answer
0 Votes

@Hielko Thanks for the continued engagement.

Best I can tell from the debug/audit enablement of the various python libraries involved, this is the exact POST url:

https://api.fitbit.com/1/user/-/activities.json?activityId=90009&manualCalories=800&durationMillis=3600000&startTime=7%3A00&date=yyyy-MM-dd&distance=7 

I do see you reference "USER_ID" instead of "-".  The fitbit python library establishes a connection and uses "-" with the Bearer authentication token.  

I will reiterate that this all worked before, so something still seems broken on Fitbit Web API side.

Best Answer
0 Votes

They helped me in my ticket, This fixed my problem.  I guess they hardened the API a little bit:

Your startTime should be using the HH:mm format, in other words 07:00 (not 7:00). When I retried your request with the correct syntax, I was returned with a 200 OK and the activity posted correctly.

 

Best Answer
0 Votes