Query the usage data scoped to the customer
1 min
POST
https://app.amberflo.io/customer-portal/usage
Query Parameters
- sessionTokenstringrequiredDescription
Body Parameters
- bodyusage-request
- aggregationstring<SUM | MIN | MAX | AVG>Description
- meterApiNamestringrequiredDescriptionDefaultApiCalls
- timeGroupingIntervalstring<HOUR | DAY | WEEK | MONTH>requiredDescriptionDefaultDAY
- valuesTimeGroupingIntervalstring<HOUR | DAY | WEEK | MONTH>Description
- timeRangeobjectrequiredDescription
- startTimeInSecondsintegerrequiredDescriptionDefault1619293642
- endTimeInSecondsintegerDescription
- groupBystring[]DescriptionDefaultcustomerId
- takeobject
- limitintegerDescriptionDefault10
- isAscendingstringDescriptionDefaultfalse
- filtermap<string, string[]>Description
Responses
200
- usage-response
- metadatausage-request
- aggregationstring<SUM | MIN | MAX | AVG>Description
- meterApiNamestringrequiredDescriptionDefaultApiCalls
- timeGroupingIntervalstring<HOUR | DAY | WEEK | MONTH>requiredDescriptionDefaultDAY
- valuesTimeGroupingIntervalstring<HOUR | DAY | WEEK | MONTH>Description
- timeRangeobjectrequiredDescription
- startTimeInSecondsintegerrequiredDescriptionDefault1619293642
- endTimeInSecondsintegerDescription
- groupBystring[]DescriptionDefaultcustomerId
- takeobject
- limitintegerDescriptionDefault10
- isAscendingstringDescriptionDefaultfalse
- filtermap<string, string[]>Description
- secondsSinceEpochIntervalsinteger[]Description
- clientMetersobject[]Description
- groupobject
- groupInfoobjectDescription
- groupValuenumberDescription
- valuesobject[]Description
- valuenumber
- secondsSinceEpochUtcnumber
- percentageFromPreviousstringDescription
curl
curl --request POST \
--url 'https://app.amberflo.io/customer-portal/usage?sessionToken=string' \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data '{
"meterApiName": "ApiCalls",
"timeGroupingInterval": "DAY",
"timeRange": {
"startTimeInSeconds": 1619293642
},
"groupBy": [
"customerId"
],
"take": {
"limit": 10,
"isAscending": "false"
}
}'javascript
var myHeaders = new Headers();
myHeaders.append("accept", "application/json");
myHeaders.append("content-type", "application/json");
var raw = JSON.stringify({
"meterApiName": "ApiCalls",
"timeGroupingInterval": "DAY",
"timeRange": {
"startTimeInSeconds": 1619293642
},
"groupBy": [
"customerId"
],
"take": {
"limit": 10,
"isAscending": "false"
}
});
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow'
};
fetch("https://app.amberflo.io/customer-portal/usage?sessionToken=string", 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/customer-portal/usage?sessionToken=string")
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": "ApiCalls",
"timeGroupingInterval": "DAY",
"timeRange": {
"startTimeInSeconds": 1619293642
},
"groupBy": [
"customerId"
],
"take": {
"limit": 10,
"isAscending": "false"
}
})
response = https.request(request)
puts response.read_body
python
import requests
import json
url = "https://app.amberflo.io/customer-portal/usage?sessionToken=string"
payload = json.dumps({
"meterApiName": "ApiCalls",
"timeGroupingInterval": "DAY",
"timeRange": {
"startTimeInSeconds": 1619293642
},
"groupBy": [
"customerId"
],
"take": {
"limit": 10,
"isAscending": "false"
}
})
headers = {
'accept': 'application/json',
'content-type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
200
// Successful response
{
"metadata": {
"aggregation": "",
"meterApiName": "",
"timeGroupingInterval": "",
"valuesTimeGroupingInterval": "",
"timeRange": {
"startTimeInSeconds": 0,
"endTimeInSeconds": 0
},
"groupBy": [
""
],
"take": {
"limit": 0,
"isAscending": ""
},
"filter": ""
},
"secondsSinceEpochIntervals": [
0
],
"clientMeters": [
{
"group": {
"groupInfo": {}
},
"groupValue": 0,
"values": [
{
"value": 0,
"secondsSinceEpochUtc": 0,
"percentageFromPrevious": ""
}
]
}
]
}