Skip to content

6. API calls

Vikram Ezhil edited this page Jan 10, 2019 · 14 revisions

The human API plugin extends humanapi sources API and wellness API calls and can easily be used in your app with a simple call.

The supported sources data keys are as per below,

The list of supported wellness data keys are as per below,

To access the sources/wellness API data, pass any of the above keys along with the access token to get the relevant information.

An example for getting the wellness API data for activities via normal execution & filter execution

Cordova, Ionic 1

window.plugin.humanapi.execute("activities", "ACCESS_TOKEN", function(result) {
    alert("Result = " + result)
}, function(error) {
    alert("Error = " + error)
})

window.plugin.humanapi.executeByFilter("activities", "ACCESS_TOKEN", "fitbit", function(result) {
   alert("Result = " + result)
}, function(error) {
   alert("Error = " + error)
})

Ionic 2+

var human: any = window
human.plugin.humanapi.execute("activities", "ACCESS_TOKEN", (result) => {
  alert("Result = " + result)
}, (error) => {
  alert("Error = " + error)
})

human.plugin.humanapi.execute("activities", "ACCESS_TOKEN", "fitbit", (result) => {
  alert("Result = " + result)
}, (error) => {
  alert("Error = " + error)
})
Clone this wiki locally