Skip to content

POST user fitbit sync

Jefferson Medeiros edited this page Nov 29, 2019 · 2 revisions

Description

Request user data synchronization on Fitbit platform with OCARIoT platform.

URL

POST https://localhost:5001/v1/users/{user_id}/fitbit/sync

Parameters

user_id: string (A 24-byte hex ID)

Curl example

curl -X POST "https://localhost:5001/v1/users/5c86d00c2239a48ea20a0134/fitbit/sync" -H "accept: application/json"

Response body

  • 202 The request has been accepted for processing, but the processing has not been completed.

    {
      "activities": 1,
      "sleep": 1,
      "weights": 1,
      "logs": {
        "steps": 1,
        "calories": 1,
        "active_minutes": 1,
        "lightly_active_minutes": 1,
        "sedentary_minutes": 1
      }
    }
  • 400 Validation errors

    • Invalid user id

    • User does not have auth data

      • Pattern
        {
          "code": 400,
          "message": "User does not have authentication data. Please, submit authentication data and try again."
        }
    • Access token expired

      • Pattern

        {
          "code": 400,
          "message": "Access token expired.",
          "description": "The access token {accessToken} has been expired and needs to be refreshed."
        }
      • Pattern 2

        {
          "code": 400,
          "message": "The access token is expired.",
          "description": "It is necessary refresh token before continue."
        }
    • Access token invalid

      • Pattern

        {
          "code": 400,
          "message": "Access token invalid.",
          "description": "The access token {accessToken} is invalid. Please make a new Fitbit Auth Data request and try again."
        }
      • Pattern 2

        {
          "code": 400,
          "message": "The access token is invalid: {access_token}",
          "description": "Please make a new Fitbit Auth data and try again."
        }
    • Invalid grant

      • Pattern
        {
          "code": 400,
          "message": "The refresh token is invalid: {access_token}",
          "description": "Please make a new Fitbit Auth data and try again."
        }
    • Refresh token invalid

      • Pattern
        {
          "code": 400,
          "message": "Refresh token invalid.",
          "description": "The refresh token {refreshToken} is invalid. Please make a new Fitbit Auth Data request and try again."
        }
    • Data request limit for access token expired

      • Pattern
        {
          "code": 400,
          "message": "Data request limit for access token {accessToken} has expired.",
          "description": "Please wait a minimum of one hour and try make the operation again."
        }
    • Invalid Fitbit Client data

      • Pattern
        {
          "code": 400,
          "message": "Invalid Fitbit Client data.",
          "description": "The Fitbit Client credentials are invalid. The operation cannot be performed."
        }
    • Internal error

      • Pattern
        {
          "code": 400,
          "message": "A internal error occurs. Please, try again later."
        }
    • Internal error (unmapped)

      • Pattern
        {
          "code": 400,
          "message": "{ERROR_MESSAGE}"
        }
    • Unable to get token payload

      • Pattern
        {
          "code": 400,
          "message": "Could not complete get token information. Please try again later."
        }
  • 500 Internal Server Error

  • 503 Fitbit service unavailable

    • Pattern
    {
      "code": 503,
      "message": "Could not connect with the Fitbit Server",
      "description": "Please try again later."
    }
    • Pattern 2
    {
      "code": 503,
      "message": "{ERROR_MESSAGE}"
    }