Query the cost data scoped to the customer
1 min
POST
https://app.amberflo.io/customer-portal/usage-cost
Query Parameters
- sessionTokenstringrequiredDescription
Body Parameters
- bodyusage-cost-request
- filtersmap<string, string>Description
- groupBystring[]Description
- productIdstringDescriptionDefault1
- takeobject
- isAscendingboolean
- limitinteger
- pageobjectDescription
- numberintegerDescription
- sizeintegerDescription
- tokenstringDescription
- timeGroupingIntervalstring<HOUR | DAY | WEEK | MONTH>DefaultDAY
- timeRangeobject
- endTimeInSecondsinteger
- startTimeInSecondsinteger
Responses
200
- usage-cost-response
- costListobject[]
- costsobject[]
- meterUnitsPercentageDiffnumber
- meteredUnitsnumber
- prepaidUsednumberDescription
- pricenumberDescription
- priceBeforeDiscountsnumber
- pricePercentageDiffnumber
- startTimeInSecondsinteger
- groupInfosmap<string, string>
- meteredUnitsnumber
- prepaidUsednumberDescription
- pricenumberDescription
- priceBeforeDiscountsnumber
- priceMinusPrepaidnumberDescription
- keyobject
- filtersmap<string, string>
- groupBystring[]
- productIdstring
- takeobject
- isAscendingboolean
- limitinteger
- timeGroupingIntervalstring<HOUR | DAY | WEEK | MONTH>
- timeRangeobject
- endTimeInSecondsintegerDescription
- startTimeInSecondsintegerDescription
- pageInfoobject
- pageNumberintegerDescription
- pageSizeintegerDescription
- pageTokenstringDescription
- totalPagesintegerDescription
- totalResultsintegerDescription
- secondsSinceEpochIntervalsinteger[]
curl
curl --request POST \
--url 'https://app.amberflo.io/customer-portal/usage-cost?sessionToken=string' \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data '{
"productId": "1",
"timeGroupingInterval": "DAY"
}'javascript
var myHeaders = new Headers();
myHeaders.append("accept", "application/json");
myHeaders.append("content-type", "application/json");
var raw = JSON.stringify({
"productId": "1",
"timeGroupingInterval": "DAY"
});
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow'
};
fetch("https://app.amberflo.io/customer-portal/usage-cost?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-cost?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({
"productId": "1",
"timeGroupingInterval": "DAY"
})
response = https.request(request)
puts response.read_body
python
import requests
import json
url = "https://app.amberflo.io/customer-portal/usage-cost?sessionToken=string"
payload = json.dumps({
"productId": "1",
"timeGroupingInterval": "DAY"
})
headers = {
'accept': 'application/json',
'content-type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
200
// Successful response
{
"costList": [
{
"costs": [
{
"meterUnitsPercentageDiff": 0,
"meteredUnits": 0,
"prepaidUsed": 0,
"price": 0,
"priceBeforeDiscounts": 0,
"pricePercentageDiff": 0,
"startTimeInSeconds": 0
}
],
"groupInfos": "",
"meteredUnits": 0,
"prepaidUsed": 0,
"price": 0,
"priceBeforeDiscounts": 0,
"priceMinusPrepaid": 0
}
],
"key": {
"filters": "",
"groupBy": [
""
],
"productId": "",
"take": {
"isAscending": false,
"limit": 0
},
"timeGroupingInterval": "",
"timeRange": {
"endTimeInSeconds": 0,
"startTimeInSeconds": 0
}
},
"pageInfo": {
"pageNumber": 0,
"pageSize": 0,
"pageToken": "",
"totalPages": 0,
"totalResults": 0
},
"secondsSinceEpochIntervals": [
0
]
}