Skip to content

Latest commit

 

History

History
231 lines (160 loc) · 7.9 KB

MetricApi.md

File metadata and controls

231 lines (160 loc) · 7.9 KB

CrowdemotionApiClientJs.MetricApi

All URIs are relative to https://api.crowdemotion.co.uk/v1

Method HTTP request Description
metricGet GET /metric List all registered metrics
metricMetricIdDelete DELETE /metric/{metric_id} Delete a Metric
metricMetricIdGet GET /metric/{metric_id} Find a Metric
metricPost POST /metric Create Metric

metricGet

[Metric] metricGet(opts)

List all registered metrics

<p>Metrics are linked to time-series and define their meaning.</p> <p>Common metric ID are listed below:</p> <table> <tr><td>id</td><td>Value</td></tr> <tr><td>1</td><td>Timestamp</td></tr> <tr><td>2</td><td>Neutral</td></tr> <tr><td>3</td><td>Happiness</td></tr> <tr><td>4</td><td>Surprise</td></tr> <tr><td>5</td><td>Puzzlement</td></tr> <tr><td>6</td><td>Disgust</td></tr> <tr><td>7</td><td>Fear</td></tr> <tr><td>8</td><td>Sadness</td></tr> </table> <p><strong>Permissions:</strong> ✗ Respondent ✗ Customer ✓ Manager</p>

Example

var CrowdemotionApiClientJs = require('crowdemotion-api-client-js');
var defaultClient = CrowdemotionApiClientJs.ApiClient.default;

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

var apiInstance = new CrowdemotionApiClientJs.MetricApi();

var opts = { 
  'skip': 56, // Integer | The number of results to skip.
  'limit': 56, // Integer | The maximum number of results to return.
  'where': "where_example", // String | JSON formatted string condition.
  'sort': "sort_example" // String | Attribute used to sort results.
};

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

Parameters

Name Type Description Notes
skip Integer The number of results to skip. [optional]
limit Integer The maximum number of results to return. [optional]
where String JSON formatted string condition. [optional]
sort String Attribute used to sort results. [optional]

Return type

[Metric]

Authorization

api_key

HTTP request headers

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

metricMetricIdDelete

Metric metricMetricIdDelete(metricId)

Delete a Metric

<p><strong>Permissions:</strong> ✗ Respondent ✗ Customer ✓ Manager</p>

Example

var CrowdemotionApiClientJs = require('crowdemotion-api-client-js');
var defaultClient = CrowdemotionApiClientJs.ApiClient.default;

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

var apiInstance = new CrowdemotionApiClientJs.MetricApi();

var metricId = 56; // Integer | ID of Metric to be deleted.


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

Parameters

Name Type Description Notes
metricId Integer ID of Metric to be deleted.

Return type

Metric

Authorization

api_key

HTTP request headers

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

metricMetricIdGet

Metric metricMetricIdGet(metricId)

Find a Metric

<p>Metrics are linked to time-series and define their meaning.</p> <p>Common metric ID are listed below:</p> <table> <tr><td>id</td><td>Value</td></tr> <tr><td>1</td><td>Timestamp</td></tr> <tr><td>2</td><td>Neutral</td></tr> <tr><td>3</td><td>Happiness</td></tr> <tr><td>4</td><td>Surprise</td></tr> <tr><td>5</td><td>Puzzlement</td></tr> <tr><td>6</td><td>Disgust</td></tr> <tr><td>7</td><td>Fear</td></tr> <tr><td>8</td><td>Sadness</td></tr> </table> <p><strong>Permissions:</strong> ✗ Respondent ✗ Customer ✓ Manager</p>

Example

var CrowdemotionApiClientJs = require('crowdemotion-api-client-js');
var defaultClient = CrowdemotionApiClientJs.ApiClient.default;

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

var apiInstance = new CrowdemotionApiClientJs.MetricApi();

var metricId = 56; // Integer | ID of Metric to find.


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

Parameters

Name Type Description Notes
metricId Integer ID of Metric to find.

Return type

Metric

Authorization

api_key

HTTP request headers

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

metricPost

Metric metricPost(body)

Create Metric

<p><strong>Permissions:</strong> ✗ Respondent ✗ Customer ✓ Manager</p>

Example

var CrowdemotionApiClientJs = require('crowdemotion-api-client-js');
var defaultClient = CrowdemotionApiClientJs.ApiClient.default;

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

var apiInstance = new CrowdemotionApiClientJs.MetricApi();

var body = new CrowdemotionApiClientJs.MetricCreation(); // MetricCreation | Request body


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

Parameters

Name Type Description Notes
body MetricCreation Request body

Return type

Metric

Authorization

api_key

HTTP request headers

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