getAvgField
This endpoint calculates the average value of a specific field (for example the amount).
/transactions/aggregate/avg/{field}
Usage and SDK Samples
curl -X POST \
-H "AnalyticsApiKey: Your-Api-Key" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{ "startDate":"20200101000000", "endDate": "20200201000000" }' \
"https://txnfeed.handpoint.com/transactions/aggregate/avg/{field}"
import com.handpoint.api.txnfeed.*;
import com.handpoint.api.txnfeed.auth.*;
import com.handpoint.api.txnfeed.model.*;
import com.handpoint.api.txnfeed.api.AvgApi;
import java.io.File;
import java.util.*;
public class AvgApiExample {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
// Configure API key authorization: ApiKeyAuth
ApiKeyAuth ApiKeyAuth = (ApiKeyAuth) defaultClient.getAuthentication("ApiKeyAuth");
ApiKeyAuth.setApiKey("YOUR API KEY");
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//ApiKeyAuth.setApiKeyPrefix("Token");
// Create an instance of the API class
AvgApi apiInstance = new AvgApi();
String field = field_example; // String | Field to be targeted for the aggregation
RequestConfig requestConfig = ; // RequestConfig |
try {
AggregateAvgResult result = apiInstance.getAvgField(field, requestConfig);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling AvgApi#getAvgField");
e.printStackTrace();
}
}
}
import com.handpoint.api.txnfeed.api.AvgApi;
public class AvgApiExample {
public static void main(String[] args) {
AvgApi apiInstance = new AvgApi();
String field = field_example; // String | Field to be targeted for the aggregation
RequestConfig requestConfig = ; // RequestConfig |
try {
AggregateAvgResult result = apiInstance.getAvgField(field, requestConfig);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling AvgApi#getAvgField");
e.printStackTrace();
}
}
}
Configuration *apiConfig = [Configuration sharedConfig];
// Configure API key authorization: (authentication scheme: ApiKeyAuth)
[apiConfig setApiKey:@"YOUR_API_KEY" forApiKeyIdentifier:@"AnalyticsApiKey"];
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//[apiConfig setApiKeyPrefix:@"Bearer" forApiKeyIdentifier:@"AnalyticsApiKey"];
// Create an instance of the API class
AvgApi *apiInstance = [[AvgApi alloc] init];
String *field = field_example; // Field to be targeted for the aggregation (default to null)
RequestConfig *requestConfig = ; //
// This endpoint calculates the average value of a specific field (for example the amount).
[apiInstance getAvgFieldWith:field
requestConfig:requestConfig
completionHandler: ^(AggregateAvgResult output, NSError* error) {
if (output) {
NSLog(@"%@", output);
}
if (error) {
NSLog(@"Error: %@", error);
}
}];
var TxnFeedApi = require('txn_feed_api');
var defaultClient = TxnFeedApi.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['AnalyticsApiKey'] = "Token";
// Create an instance of the API class
var api = new TxnFeedApi.AvgApi()
var field = field_example; // {String} Field to be targeted for the aggregation
var requestConfig = ; // {RequestConfig}
var callback = function(error, data, response) {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
};
api.getAvgField(field, requestConfig, callback);
using System;
using System.Diagnostics;
using Com.Handpoint.Api.Txnfeed.Api;
using Com.Handpoint.Api.Txnfeed.Client;
using Com.Handpoint.Api.Txnfeed.Model;
namespace Example
{
public class getAvgFieldExample
{
public void main()
{
// Configure API key authorization: ApiKeyAuth
Configuration.Default.ApiKey.Add("AnalyticsApiKey", "YOUR_API_KEY");
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// Configuration.Default.ApiKeyPrefix.Add("AnalyticsApiKey", "Bearer");
// Create an instance of the API class
var apiInstance = new AvgApi();
var field = field_example; // String | Field to be targeted for the aggregation (default to null)
var requestConfig = new RequestConfig(); // RequestConfig |
try {
// This endpoint calculates the average value of a specific field (for example the amount).
AggregateAvgResult result = apiInstance.getAvgField(field, requestConfig);
Debug.WriteLine(result);
} catch (Exception e) {
Debug.Print("Exception when calling AvgApi.getAvgField: " + e.Message );
}
}
}
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');
// Configure API key authorization: ApiKeyAuth
ComHandpointApiTxnfeed\Configuration::getDefaultConfiguration()->setApiKey('AnalyticsApiKey', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// ComHandpointApiTxnfeed\Configuration::getDefaultConfiguration()->setApiKeyPrefix('AnalyticsApiKey', 'Bearer');
// Create an instance of the API class
$api_instance = new OpenAPITools\Client\Api\AvgApi();
$field = field_example; // String | Field to be targeted for the aggregation
$requestConfig = ; // RequestConfig |
try {
$result = $api_instance->getAvgField($field, $requestConfig);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling AvgApi->getAvgField: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use Com::Handpoint::Api::Txnfeed::Configuration;
use Com::Handpoint::Api::Txnfeed::AvgApi;
# Configure API key authorization: ApiKeyAuth
$Com::Handpoint::Api::Txnfeed::Configuration::api_key->{'AnalyticsApiKey'} = 'YOUR_API_KEY';
# uncomment below to setup prefix (e.g. Bearer) for API key, if needed
#$Com::Handpoint::Api::Txnfeed::Configuration::api_key_prefix->{'AnalyticsApiKey'} = "Bearer";
# Create an instance of the API class
my $api_instance = Com::Handpoint::Api::Txnfeed::AvgApi->new();
my $field = field_example; # String | Field to be targeted for the aggregation
my $requestConfig = Com::Handpoint::Api::Txnfeed::Object::RequestConfig->new(); # RequestConfig |
eval {
my $result = $api_instance->getAvgField(field => $field, requestConfig => $requestConfig);
print Dumper($result);
};
if ($@) {
warn "Exception when calling AvgApi->getAvgField: $@\n";
}
from __future__ import print_statement
import time
import com.handpoint.api.txnfeed
from com.handpoint.api.txnfeed.rest import ApiException
from pprint import pprint
# Configure API key authorization: ApiKeyAuth
com.handpoint.api.txnfeed.configuration.api_key['AnalyticsApiKey'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# com.handpoint.api.txnfeed.configuration.api_key_prefix['AnalyticsApiKey'] = 'Bearer'
# Create an instance of the API class
api_instance = com.handpoint.api.txnfeed.AvgApi()
field = field_example # String | Field to be targeted for the aggregation (default to null)
requestConfig = # RequestConfig |
try:
# This endpoint calculates the average value of a specific field (for example the amount).
api_response = api_instance.get_avg_field(field, requestConfig)
pprint(api_response)
except ApiException as e:
print("Exception when calling AvgApi->getAvgField: %s\n" % e)
extern crate AvgApi;
pub fn main() {
let field = field_example; // String
let requestConfig = ; // RequestConfig
let mut context = AvgApi::Context::default();
let result = client.getAvgField(field, requestConfig, &context).wait();
println!("{:?}", result);
}
Parameters
Name | Description |
---|---|
field * |
Field to be targeted for the aggregation |
Name | Description |
---|---|
requestConfig * |
Request filters |