# teralytic.TelemetryApi

All URIs are relative to *https://api.teralytic.io/v1*

Method | HTTP request | Description
------------- | ------------- | -------------
[**analyticsQuery**](TelemetryApi.md#analyticsQuery) | **GET** /organizations/{organization_id}/analytics | Query reading anlaytics
[**readingsQuery**](TelemetryApi.md#readingsQuery) | **GET** /organizations/{organization_id}/readings | Query sensor readings


<a name="analyticsQuery"></a>
# **analyticsQuery**
> [Reading] analyticsQuery(organizationId, opts)

Query reading anlaytics

Queries readings and performs anayltics operations on the them over a sample

### Example
```javascript
var teralytic = require('teralytic');
var defaultClient = teralytic.ApiClient.instance;

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

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

var apiInstance = new teralytic.TelemetryApi();

var organizationId = "organizationId_example"; // String | id of Organization to retrieve

var opts = { 
  'startDate': new Date("2013-10-20T19:20:30+01:00"), // Date | Start date and time for the query in RFC3339 format
  'endDate': new Date("2013-10-20T19:20:30+01:00"), // Date | End date and time for the query in RFC3339 format
  'fields': ["fields_example"], // [String] | The fields to return readings for
  'probes': ["probes_example"], // [String] | The probes to return readings for
  'properties': ["properties_example"], // [String] | The properties to return readings for
  'operation': "mean", // String | Operation to perform on reading data
  'sampleRate': "15m", // String | The operation sample interval, i.e. `15m`
  'limit': 789, // Number | limit the number of returns per depth
  'extended': false, // Boolean | Return extended attributes
  'sort': true, // Boolean | return a sorted array, will decrease performance
  'options': "options_example" // String | Options for the call
};
apiInstance.analyticsQuery(organizationId, opts).then(function(data) {
  console.log('API called successfully. Returned data: ' + data);
}, function(error) {
  console.error(error);
});

```

### Parameters

Name | Type | Description  | Notes
------------- | ------------- | ------------- | -------------
 **organizationId** | [**String**](.md)| id of Organization to retrieve | 
 **startDate** | **Date**| Start date and time for the query in RFC3339 format | [optional] 
 **endDate** | **Date**| End date and time for the query in RFC3339 format | [optional] 
 **fields** | [**[String]**](String.md)| The fields to return readings for | [optional] 
 **probes** | [**[String]**](String.md)| The probes to return readings for | [optional] 
 **properties** | [**[String]**](String.md)| The properties to return readings for | [optional] 
 **operation** | **String**| Operation to perform on reading data | [optional] [default to mean]
 **sampleRate** | **String**| The operation sample interval, i.e. &#x60;15m&#x60; | [optional] [default to 15m]
 **limit** | **Number**| limit the number of returns per depth | [optional] 
 **extended** | **Boolean**| Return extended attributes | [optional] [default to false]
 **sort** | **Boolean**| return a sorted array, will decrease performance | [optional] [default to true]
 **options** | **String**| Options for the call | [optional] 

### Return type

[**[Reading]**](Reading.md)

### Authorization

[ApiKeyAuth](../README.md#ApiKeyAuth), [OAuth2](../README.md#OAuth2)

### HTTP request headers

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

<a name="readingsQuery"></a>
# **readingsQuery**
> [Reading] readingsQuery(organizationId, opts)

Query sensor readings

Query sensor readings associated with organization

### Example
```javascript
var teralytic = require('teralytic');
var defaultClient = teralytic.ApiClient.instance;

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

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

var apiInstance = new teralytic.TelemetryApi();

var organizationId = "organizationId_example"; // String | id of Organization to retrieve

var opts = { 
  'startDate': new Date("2013-10-20T19:20:30+01:00"), // Date | Start date and time for the query in RFC3339 format, the default is 24h prior 
  'endDate': new Date("2013-10-20T19:20:30+01:00"), // Date | End date and time for the query in RFC3339 format, the implied default is now 
  'fields': ["fields_example"], // [String] | The fields to return readings for
  'probes': ["probes_example"], // [String] | The probes to return readings for
  'properties': ["properties_example"], // [String] | The properties to return readings for
  'extended': false, // Boolean | Return extended attributes
  'options': "options_example", // String | Options for the call
  'filter': "filter_example", // String | Filter method
  'limit': 1000 // Number | Limit the number records returned
};
apiInstance.readingsQuery(organizationId, opts).then(function(data) {
  console.log('API called successfully. Returned data: ' + data);
}, function(error) {
  console.error(error);
});

```

### Parameters

Name | Type | Description  | Notes
------------- | ------------- | ------------- | -------------
 **organizationId** | [**String**](.md)| id of Organization to retrieve | 
 **startDate** | **Date**| Start date and time for the query in RFC3339 format, the default is 24h prior  | [optional] 
 **endDate** | **Date**| End date and time for the query in RFC3339 format, the implied default is now  | [optional] 
 **fields** | [**[String]**](String.md)| The fields to return readings for | [optional] 
 **probes** | [**[String]**](String.md)| The probes to return readings for | [optional] 
 **properties** | [**[String]**](String.md)| The properties to return readings for | [optional] 
 **extended** | **Boolean**| Return extended attributes | [optional] [default to false]
 **options** | **String**| Options for the call | [optional] 
 **filter** | **String**| Filter method | [optional] 
 **limit** | **Number**| Limit the number records returned | [optional] [default to 1000]

### Return type

[**[Reading]**](Reading.md)

### Authorization

[ApiKeyAuth](../README.md#ApiKeyAuth), [OAuth2](../README.md#OAuth2)

### HTTP request headers

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

