Skip to content

GET user fitbit auth

Jefferson Medeiros edited this page Dec 2, 2019 · 2 revisions

Description

Retrieves user data from Fitbit account.

Permissions:

  • Application User can retrieve Fitbit authorization data from any Child.

  • Child user can only retrieve their own Fitbit authorization data.

  • Educator and HealthProfessional users can retrieve Fitbit authorization data from any Child as long as Child is part of one of their groups.

  • Family user can retrieve Fitbit authorization data only from child that associated with it.

Scope

external:sync

URL

POST https://localhost/v1/users/{user_id}/fitbit/auth

Parameters

user_id: string (A 24-byte hex ID)

Curl example

curl -X GET "https://localhost/v1/users/5c86d00c2239a48ea20a0134/fitbit/auth" -H "accept: application/json" -H "Authorization: Bearer YOUR_ACCESS_TOKEN"

Response body

  • 200 Fitbit auth data.

    {
      "access_token": "eyJhbGciOiJIUzI1NiJ9.eyJleHAiOjE0MzAzNDM3MzUsInNjb3BlcyI6Indwcm8gd2xvYyB3bnV0IHdzbGUgd3NldCB3aHIgd3dlaSB3YWN0IHdzb2MiLCJzdWIiOiJBQkNERUYiLCJhdWQiOiJJSktMTU4iLCJpc3MiOiJGaXRiaXQiLCJ0eXAiOiJhY2Nlc3NfdG9rZW4iLCJpYXQiOjE0MzAzNDAxMzV9.z0VHrIEzjsBnjiNMBey6wtu26yHTnSWz_qlqoEpUlpc",
      "refresh_token": "c643a63c072f0f05478e9d18b991db80ef6061e4f8e6c822d83fed53e5fafdd7",
      "status": "valid_token"
    }
    Possible values of the status field description
    valid_token Valid Access Token: The token is valid.
    expired_token Expired Access Token: The access token has expired.
    invalid_token Invalid Access Token: The access token is invalid.
    invalid_grant Invalid Refresh Token: The refresh token is invalid.
    system Too Many Requests: The limit of requests has been reached.
    client_error Generic Error: A not-mapped Fitbit Client error occurs.
  • 400 Validation errors

  • 401 Unauthorized Error

  • 403 Permission Error

  • 404 Specified resource does not exist. Usually when the URI is incorrect or the resource is not found, or even no longer exists.

    {
        "code": 404,
        "message": "Unable to find Fitbit authentication data!",
        "description": "You must enter new data before you can refer to it."
    }
  • 429 Too Many Requests Error

  • 500 Internal Server Error

OCARIoT users

Integration endpoints

auth

users

institutions

children

children.physicalactivities

children.logs

children.sleep

children.weights

children.bodyfats

educators

educators.children.groups

families

families.children

healthprofessionals

healthprofessionals.children.groups

applications

institutions.environments

fitbit

fitbit.subscriber

users.fitbit.auth

users.fitbit.sync

Error patterns

400 Validation Errors

Clone this wiki locally