Calculate usage costs in batch
1 min
POST
https://app.amberflo.io/payments/cost/usage-cost/batch
Body Parameters
- bodypayment.cost.UsageCostsKey.in[]Description
- productIdstringDescription
- timeRangepayment.common.TimeRange.inDescription
- startTimeInSecondsinteger<int64>Description
- endTimeInSecondsinteger<int64>Description
- timeGroupingIntervalcommon.aggregation.AggregationInterval.inDescription
- filtersmap<string, string[]>Description
- groupBystring[]Description
- pagepayment.common.Page.inDescription
- numberinteger<int32>Description
- sizeinteger<int32>Description
- tokenstringDescription
- takepayment.common.Take.inDescription
- limitinteger<int32>Description
- isAscendingbooleanDescription
Responses
200
- payment.cost.UsageCosts.out[]Description
- keypayment.cost.UsageCostsKey.outDescription
- productIdstringDescription
- timeRangepayment.common.TimeRange.inDescription
- startTimeInSecondsinteger<int64>Description
- endTimeInSecondsinteger<int64>Description
- timeGroupingIntervalcommon.aggregation.AggregationInterval.inDescription
- filtersmap<string, string[]>Description
- groupBystring[]Description
- pagepayment.common.Page.inDescription
- numberinteger<int32>Description
- sizeinteger<int32>Description
- tokenstringDescription
- takepayment.common.Take.inDescription
- limitinteger<int32>Description
- isAscendingbooleanDescription
- secondsSinceEpochIntervalsinteger[]Description
- costListpayment.cost.UsageGroupCosts.out[]Description
- groupInfosmap<string, string>Description
- meteredUnitsnumberDescription
- pricenumberDescription
- priceBeforeDiscountsnumberDescription
- prepaidUsednumberDescription
- priceMinusPrepaidnumberDescription
- payAsYouGoPromotionUsednumberDescription
- nonPayAsYouGoPromotionUsednumberDescription
- priceAfterPayAsYouGoPromotionnumberDescription
- priceAfterNonPayAsYouGoPromotionnumberDescription
- costspayment.cost.UsageGroupCostValue.out[]Description
- startTimeInSecondsinteger<int64>Description
- meteredUnitsnumberDescription
- pricenumberDescription
- pricePercentageDiffnumberDescription
- meterUnitsPercentageDiffnumberDescription
- priceBeforeDiscountsnumberDescription
- prepaidUsednumberDescription
- payAsYouGoPromotionUsednumberDescription
- pageInfopayment.common.PageInfo.outDescription
- pageNumberinteger<int32>Description
- pageSizeinteger<int32>Description
- pageTokenstringDescription
- totalPagesinteger<int32>Description
- totalResultsinteger<int32>Description
400
401
403
404
500
curl
curl --request POST \
--url https://app.amberflo.io/payments/cost/usage-cost/batch \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data '[
{}
]'javascript
var myHeaders = new Headers();
myHeaders.append("accept", "application/json");
myHeaders.append("content-type", "application/json");
var raw = JSON.stringify([
{}
]);
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow'
};
fetch("https://app.amberflo.io/payments/cost/usage-cost/batch", 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/payments/cost/usage-cost/batch")
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([
{}
])
response = https.request(request)
puts response.read_body
python
import requests
import json
url = "https://app.amberflo.io/payments/cost/usage-cost/batch"
payload = json.dumps([
{}
])
headers = {
'accept': 'application/json',
'content-type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
200
// Returns array of usage cost results corresponding to each batch request with detailed breakdowns
[
{
"key": {
"productId": "",
"timeRange": {
"startTimeInSeconds": "",
"endTimeInSeconds": ""
},
"timeGroupingInterval": "",
"filters": "",
"groupBy": [
""
],
"page": {
"number": "",
"size": "",
"token": ""
},
"take": {
"limit": "",
"isAscending": false
}
},
"secondsSinceEpochIntervals": [
0
],
"costList": [
{
"groupInfos": "",
"meteredUnits": 0,
"price": 0,
"priceBeforeDiscounts": 0,
"prepaidUsed": 0,
"priceMinusPrepaid": 0,
"payAsYouGoPromotionUsed": 0,
"nonPayAsYouGoPromotionUsed": 0,
"priceAfterPayAsYouGoPromotion": 0,
"priceAfterNonPayAsYouGoPromotion": 0,
"costs": [
{
"startTimeInSeconds": "",
"meteredUnits": 0,
"price": 0,
"pricePercentageDiff": 0,
"meterUnitsPercentageDiff": 0,
"priceBeforeDiscounts": 0,
"prepaidUsed": 0,
"payAsYouGoPromotionUsed": 0
}
]
}
],
"pageInfo": {
"pageNumber": "",
"pageSize": "",
"pageToken": "",
"totalPages": "",
"totalResults": ""
}
}
]400
// Invalid batch parameters or malformed request array provided
401
// Authentication required or invalid API key provided
403
// Insufficient permissions to perform batch usage cost calculations
404
// Some customers or usage data not found in batch request
500
// Internal server error occurred during batch usage cost processing