Search code examples
google-apigoogle-fit

Patch or Delete Weight from DataSource - delete data inserted by other apps


Im trying to patch or delete weight from data source using google fitness api.

On developers.google.com/oauthplayground, developers.google.com/apis-explorer and my local client fetching with GET https://www.googleapis.com/fitness/v1/users/me/dataSources/raw%3Acom.google.weight%3Acom.google.android.apps.fitness%3Auser_input/datasets/1438146389462000000-1438146389462000000 works fine and returns

{
  "minStartTimeNs": "1438146389462000000", 
  "maxEndTimeNs": "1438146389462000000", 
  "dataSourceId": "raw:com.google.weight:com.google.android.apps.fitness:user_input", 
  "point": [
    {
      "startTimeNanos": "1438146389462000000", 
      "modifiedTimeMillis": "1438147314620", 
      "endTimeNanos": "1438146389462000000", 
      "value": [
        {
          "fpVal": 132.04063415527344
        }
      ], 
      "dataTypeName": "com.google.weight"
    }
  ]
}

but when I try to send a DELETE request I get the following:


{
  "error": {
    "code": 403, 
    "message": "Application package name (com.google.android.apps.fitness) provided by un-trusted source.", 
    "errors": [
      {
        "domain": "global", 
        "message": "Application package name (com.google.android.apps.fitness) provided by un-trusted source.", 
        "reason": "forbidden"
      }
    ]
  }
}

What is the problem here? Do I need to setup some kind of special access?


Solution

  • As per fit API design,

    An app cannot delete data inserted by other apps.

    If that is the case, it will result with permission issue - access forbidden.