09-04-2024 01:07
09-04-2024 01:07
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.
Answered! Go to the Best Answer.
09-24-2024 07:39
09-24-2024 07:39
I suggest to add distanceUnit (with value 'miles' without quotes) in addition to distance and check what happens
09-24-2024 08:36
09-24-2024 08:36
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
}
09-24-2024 08:45
09-24-2024 08:45
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.
09-24-2024 08:56
09-24-2024 08:56
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.
09-24-2024 10:20
09-24-2024 10:20
Thanks for the update
09-24-2024 13:14 - edited 09-24-2024 13:15
09-24-2024 13:14 - edited 09-24-2024 13:15
@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
09-24-2024 14:25
09-24-2024 14:25
@Hielko what’s the url to submit a bug?
also, do you use the activities endpoint to send steps?
thanks,
chris
09-24-2024 23:33
09-24-2024 23:33
@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/
09-25-2024 07:38
09-25-2024 07:38
@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.
10-01-2024 05:39
10-01-2024 05:39
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.