Query the usage data
1 min
POST
https://app.amberflo.io/usage
Body Parameters
- bodyusage.MeterAggregationMetadata.in
- meterApiNamestringrequiredDescription
- aggregationusage.AggregationType.inDescription
- timeRangecommon.TimeRange.inrequiredDescription
- startTimeInSecondsinteger<int64>requiredDescription
- endTimeInSecondsinteger<int64>Description
- filtermap<string, string[]>Description
- groupBystring[]Description
- takeusage.MeterAggregationMetadata.Take.in
- limitinteger<int32>required
- isAscendingboolean
- timeGroupingIntervalcom.amberflo.service.common.aggregation.AggregationInterval.inDescription
- valuesTimeGroupingIntervalcom.amberflo.service.common.aggregation.AggregationInterval.in
- rescaleFunctioncom.amberflo.service.common.aggregation.RescaleFunction.in
- functioncom.amberflo.service.common.aggregation.RescaleFunctionType.in
- coefficientnumber
Responses
200
- usage.DetailedMeterAggregation.out
- metadatausage.MeterAggregationMetadata.out
- accountstring
- meterApiNamestringrequiredDescription
- aggregationusage.AggregationType.outDescription
- timeRangecommon.TimeRange.outrequiredDescription
- startTimeInSecondsinteger<int64>requiredDescription
- endTimeInSecondsinteger<int64>Description
- filtermap<string, string[]>Description
- groupBystring[]Description
- takeusage.MeterAggregationMetadata.Take.out
- limitinteger<int32>required
- isAscendingboolean
- timeGroupingIntervalcom.amberflo.service.common.aggregation.AggregationInterval.outDescription
- valuesTimeGroupingIntervalcom.amberflo.service.common.aggregation.AggregationInterval.out
- rescaleFunctioncom.amberflo.service.common.aggregation.RescaleFunction.out
- functioncom.amberflo.service.common.aggregation.RescaleFunctionType.out
- coefficientnumber
- secondsSinceEpochIntervalsinteger[]
- clientMetersusage.DetailedMeterAggregation.DetailedMeterAggregationGroup.out[]
- groupusage.MeterAggregation.GroupInfo.out
- groupInfomap<string, string>
- groupValuenumber
- valuesusage.DetailedMeterAggregation.DetailedAggregationValue.out[]
- valuenumber
- secondsSinceEpochUtcinteger<int64>
- percentageFromPreviousnumber
curl
curl --request POST \
--url https://app.amberflo.io/usage \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data '{
"meterApiName": "",
"timeRange": {
"startTimeInSeconds": 0
},
"take": {
"limit": 0
}
}'javascript
var myHeaders = new Headers();
myHeaders.append("accept", "application/json");
myHeaders.append("content-type", "application/json");
var raw = JSON.stringify({
"meterApiName": "",
"timeRange": {
"startTimeInSeconds": 0
},
"take": {
"limit": 0
}
});
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow'
};
fetch("https://app.amberflo.io/usage", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));ruby
require "uri"
require "json"
require "net/http"
url = URI("https://app.amberflo.io/usage")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["accept"] = "application/json"
request["content-type"] = "application/json"
request.body = JSON.dump({
"meterApiName": "",
"timeRange": {
"startTimeInSeconds": 0
},
"take": {
"limit": 0
}
})
response = https.request(request)
puts response.read_body
python
import requests
import json
url = "https://app.amberflo.io/usage"
payload = json.dumps({
"meterApiName": "",
"timeRange": {
"startTimeInSeconds": 0
},
"take": {
"limit": 0
}
})
headers = {
'accept': 'application/json',
'content-type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
200
// Successful request
{
"metadata": {
"account": "",
"meterApiName": "",
"aggregation": "",
"timeRange": {
"startTimeInSeconds": "",
"endTimeInSeconds": ""
},
"filter": "",
"groupBy": [
""
],
"take": {
"limit": "",
"isAscending": false
},
"timeGroupingInterval": "",
"valuesTimeGroupingInterval": "",
"rescaleFunction": {
"function": "",
"coefficient": 0
}
},
"secondsSinceEpochIntervals": [
0
],
"clientMeters": [
{
"group": {
"groupInfo": ""
},
"groupValue": 0,
"values": [
{
"value": 0,
"secondsSinceEpochUtc": "",
"percentageFromPrevious": 0
}
]
}
]
}This API is a generic statistical query tool which can allow you to fetch the usage or usage-rate (scale of usage) over time.
In order to facilitate using the response for plotting charts, this endpoint will fill the gaps in the time series when no usage happened. If this is not needed, consider using the sparse usage endpoint.