Skip to content

Latest commit

 

History

History
349 lines (244 loc) · 11.6 KB

File metadata and controls

349 lines (244 loc) · 11.6 KB

Quantimodo.ConnectorsApi

All URIs are relative to https://app.quantimo.do/api

Method HTTP request Description
connectConnector GET /v3/connectors/{connectorName}/connect Obtain a token from 3rd party data source
disconnectConnector GET /v3/connectors/{connectorName}/disconnect Delete stored connection info
getConnectors GET /v3/connectors/list List of Connectors
getIntegrationJs GET /v3/integration.js Get embeddable connect javascript
getMobileConnectPage GET /v3/connect/mobile Mobile connect page
updateConnector GET /v3/connectors/{connectorName}/update Sync with data source

connectConnector

connectConnector(connectorName, opts)

Obtain a token from 3rd party data source

Attempt to obtain a token from the data provider, store it in the database. With this, the connector to continue to obtain new user data until the token is revoked.

Example

var Quantimodo = require('quantimodo');
var defaultClient = Quantimodo.ApiClient.instance;

// Configure API key authorization: access_token
var access_token = defaultClient.authentications['access_token'];
access_token.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//access_token.apiKeyPrefix = 'Token';

// Configure OAuth2 access token for authorization: quantimodo_oauth2
var quantimodo_oauth2 = defaultClient.authentications['quantimodo_oauth2'];
quantimodo_oauth2.accessToken = 'YOUR ACCESS TOKEN';

var apiInstance = new Quantimodo.ConnectorsApi();

var connectorName = "connectorName_example"; // String | Lowercase system name of the source application or device. Get a list of available connectors from the /v3/connectors/list endpoint.

var opts = { 
  'userId': 8.14, // Number | User's id
};

var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully.');
  }
};
apiInstance.connectConnector(connectorName, opts, callback);

Parameters

Name Type Description Notes
connectorName String Lowercase system name of the source application or device. Get a list of available connectors from the /v3/connectors/list endpoint.
userId Number User's id [optional]

Return type

null (empty response body)

Authorization

access_token, quantimodo_oauth2

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

disconnectConnector

disconnectConnector(connectorName)

Delete stored connection info

The disconnect method deletes any stored tokens or connection information from the connectors database.

Example

var Quantimodo = require('quantimodo');
var defaultClient = Quantimodo.ApiClient.instance;

// Configure API key authorization: access_token
var access_token = defaultClient.authentications['access_token'];
access_token.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//access_token.apiKeyPrefix = 'Token';

// Configure OAuth2 access token for authorization: quantimodo_oauth2
var quantimodo_oauth2 = defaultClient.authentications['quantimodo_oauth2'];
quantimodo_oauth2.accessToken = 'YOUR ACCESS TOKEN';

var apiInstance = new Quantimodo.ConnectorsApi();

var connectorName = "connectorName_example"; // String | Lowercase system name of the source application or device. Get a list of available connectors from the /v3/connectors/list endpoint.


var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully.');
  }
};
apiInstance.disconnectConnector(connectorName, callback);

Parameters

Name Type Description Notes
connectorName String Lowercase system name of the source application or device. Get a list of available connectors from the /v3/connectors/list endpoint.

Return type

null (empty response body)

Authorization

access_token, quantimodo_oauth2

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

getConnectors

GetConnectorsResponse getConnectors(opts)

List of Connectors

A connector pulls data from other data providers using their API or a screenscraper. Returns a list of all available connectors and information about them such as their id, name, whether the user has provided access, logo url, connection instructions, and the update history.

Example

var Quantimodo = require('quantimodo');
var defaultClient = Quantimodo.ApiClient.instance;

// Configure API key authorization: access_token
var access_token = defaultClient.authentications['access_token'];
access_token.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//access_token.apiKeyPrefix = 'Token';

// Configure OAuth2 access token for authorization: quantimodo_oauth2
var quantimodo_oauth2 = defaultClient.authentications['quantimodo_oauth2'];
quantimodo_oauth2.accessToken = 'YOUR ACCESS TOKEN';

var apiInstance = new Quantimodo.ConnectorsApi();

var opts = { 
  'clientId': "clientId_example", // String | Your QuantiModo client id can be obtained by creating an app at https://builder.quantimo.do
  'platform': "platform_example" // String | Ex: chrome, android, ios, web
};

var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
apiInstance.getConnectors(opts, callback);

Parameters

Name Type Description Notes
clientId String Your QuantiModo client id can be obtained by creating an app at https://builder.quantimo.do [optional]
platform String Ex: chrome, android, ios, web [optional]

Return type

GetConnectorsResponse

Authorization

access_token, quantimodo_oauth2

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

getIntegrationJs

getIntegrationJs(opts)

Get embeddable connect javascript

Get embeddable connect javascript. Usage: - Embedding in applications with popups for 3rd-party authentication windows. Use `qmSetupInPopup` function after connecting `connect.js`. - Embedding in applications with popups for 3rd-party authentication windows. Requires a selector to block. It will be embedded in this block. Use `qmSetupOnPage` function after connecting `connect.js`. - Embedding in mobile applications without popups for 3rd-party authentication. Use `qmSetupOnMobile` function after connecting `connect.js`. If using in a Cordova application call `qmSetupOnIonic` function after connecting `connect.js`.

Example

var Quantimodo = require('quantimodo');

var apiInstance = new Quantimodo.ConnectorsApi();

var opts = { 
  'clientId': "clientId_example", // String | Your QuantiModo client id can be obtained by creating an app at https://builder.quantimo.do
  'platform': "platform_example" // String | Ex: chrome, android, ios, web
};

var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully.');
  }
};
apiInstance.getIntegrationJs(opts, callback);

Parameters

Name Type Description Notes
clientId String Your QuantiModo client id can be obtained by creating an app at https://builder.quantimo.do [optional]
platform String Ex: chrome, android, ios, web [optional]

Return type

null (empty response body)

Authorization

No authorization required

HTTP request headers

  • Content-Type: application/json
  • Accept: application/x-javascript

getMobileConnectPage

getMobileConnectPage(opts)

Mobile connect page

This page is designed to be opened in a webview. Instead of using popup authentication boxes, it uses redirection. You can include the user's access_token as a URL parameter like https://app.quantimo.do/api/v3/connect/mobile?access_token=123

Example

var Quantimodo = require('quantimodo');

var apiInstance = new Quantimodo.ConnectorsApi();

var opts = { 
  'userId': 8.14, // Number | User's id
};

var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully.');
  }
};
apiInstance.getMobileConnectPage(opts, callback);

Parameters

Name Type Description Notes
userId Number User's id [optional]

Return type

null (empty response body)

Authorization

No authorization required

HTTP request headers

  • Content-Type: application/json
  • Accept: text/html

updateConnector

updateConnector(connectorName, opts)

Sync with data source

The update method tells the QM Connector Framework to check with the data provider (such as Fitbit or MyFitnessPal) and retrieve any new measurements available.

Example

var Quantimodo = require('quantimodo');
var defaultClient = Quantimodo.ApiClient.instance;

// Configure API key authorization: access_token
var access_token = defaultClient.authentications['access_token'];
access_token.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//access_token.apiKeyPrefix = 'Token';

// Configure OAuth2 access token for authorization: quantimodo_oauth2
var quantimodo_oauth2 = defaultClient.authentications['quantimodo_oauth2'];
quantimodo_oauth2.accessToken = 'YOUR ACCESS TOKEN';

var apiInstance = new Quantimodo.ConnectorsApi();

var connectorName = "connectorName_example"; // String | Lowercase system name of the source application or device. Get a list of available connectors from the /v3/connectors/list endpoint.

var opts = { 
  'userId': 8.14, // Number | User's id
};

var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully.');
  }
};
apiInstance.updateConnector(connectorName, opts, callback);

Parameters

Name Type Description Notes
connectorName String Lowercase system name of the source application or device. Get a list of available connectors from the /v3/connectors/list endpoint.
userId Number User's id [optional]

Return type

null (empty response body)

Authorization

access_token, quantimodo_oauth2

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json