We are seeing an inconsistency in the legacy Fitbit Web API for newly created users.
Calling:
GET /1/user/-/profile.json
returns an encodedId such as:
98AV5X7
But calling:
GET /1/user/98AV5X7/body/log/weight/date/YYYY-MM-DD.json (date was anonymized as it was not possible to submit this message with real date)
returns HTTP 400 with:
"Violation in GetWeightLogRequest.user_id - User id field must contain a hyphen or exactly 6 uppercase letters or digits."
This appears to mean:
the profile endpoint returns a 7-character user ID
some legacy endpoints still validate user_id using the old 6-character rule
This seems to affect newly created users. Can you confirm whether this is a known issue and whether explicit user IDs should no longer be used for these legacy endpoints in favor of /user/-/ ?
Thank you,
HealthReact team
Best Answer
Fitbit Developers oversee the SDK and API forums. We're here to answer questions about Fitbit developer tools, assist with projects, and make sure your voice is heard by the development team.
Hi @HealthReact
Thanks for reaching out.
For all requests where you are calling data for the currently authenticated user, can you please try using the hyphen shortand (-) in the URL path instead of the explicit encodedId and see if it works for you? For example: Get /1/user/-/body/log/weight/date/[date].json
Best AnswerThank you for your advice. It worked.
All new users have now again 6-character user IDs over the past week. Is there a plan to introduce 7-character user IDs in the near future?
Best Answer
Fitbit Developers oversee the SDK and API forums. We're here to answer questions about Fitbit developer tools, assist with projects, and make sure your voice is heard by the development team.
Hi @amirrez
Have you tried using the hyphen shortand (-) in the URL path instead of the explicit encodedId? (please see my previes commet). Let me know if the issues are still persisting on your end.
Best Answer
Fitbit Developers oversee the SDK and API forums. We're here to answer questions about Fitbit developer tools, assist with projects, and make sure your voice is heard by the development team.
Hi @HealthReact
There is currently no plan to introduce a 7-character user ID format for the legacy system. Moving forward, we are transitioning to the Google Health User ID (healthUserId). We recommend planning your future integrations around the Google Health API to utilize this new, more flexible ID structure.
Best Answer