View Resource Usage Cost for An Account
/metering/api/v1/usagecost/{accountId}
Request
-
accountId: string
Account name, starts with cacct.
-
computeTypeEnabled: string
If Y, then usage cost is grouped by computeType, which is used to indicate the nature of cost incurred say Usage, Overage etc.
-
dataCenter: string
A filter for which Datacenter for which cost needs to be retrieved. This is used with OCI Classic services and not needed when grabbing data from OCI services. This is an optional parameter.
-
dcAggEnabled: string
If Y, then usage cost is grouped per datacenter
-
endTime: string
Specifies the end of the interval for which usage cost is being retrieved.
-
resourceName: string
Resource Name.
-
serviceEntitlementId: string
Service Entitlement Id
-
serviceName: string
Service Name
-
startTime: string
Specifies the start of the interval for which usage cost is being retrieved.
-
timeZone: string
Timezone specified for start and end time params. Default is UTC.
-
usageType: string
UsageType can be TOTAL, HOURLY or DAILY. Defaults to TOTAL.
Response
- application/vnd.com.oracle.oraclecloud.metering.usage+json
200 Response
array
-
Array of:
object UsageCostRecord
Title:
UsageCostRecord
object
UsageCostRecord
-
costs(optional):
array costs
-
currency(optional):
string
Currency.
-
dataCenterId(optional):
object dataCenterId
Datacenter Id
-
endTimeUtc(optional):
object endTimeUtc
End time of the interval for which cost is returned.
-
gsiProductId(optional):
string
GSI product id for the Sku.
-
lastComputationDate(optional):
object lastComputationDate
Time at which cost was synced from billing system.
-
quantity(optional):
number
Quantity.
-
resourceName(optional):
string
Resource Name.
-
serviceName(optional):
string
Service Name.
-
startTimeUtc(optional):
object startTimeUtc
Start time of the interval for which cost is returned.
-
subscriptionId(optional):
string
Purchase Entitlement Id.
-
subscriptionType(optional):
string
Trial or production.
-
tag(optional):
string
Tag applied on this usage.
object
object
object
object
object
UsageCost
-
computedAmount(optional):
number
Cost computed for usage.
-
computedQuantity(optional):
number
Quantity used for computing cost.
-
overagesFlag(optional):
string
If Y, then the cost is an overage.
-
rateCardId(optional):
string
GSI rate card identifier.
-
unitPrice(optional):
number
Price per unit of resource.
Default Response
Examples
GET
request on the REST resource using cURL. For more information about cURL, see
Use cURL. This section contains the following examples:
-
Retrieve Usage Cost for Hourly Usage
-
Retrieve Usage Cost for Daily Usage
-
Retrieve Usage Cost for Monthly Usage
-
Retrieve Total Usage Cost
Retrieve Usage Cost for Hourly Usage
cURL Command
Enter the command on a single line. Line breaks are used in this example for readability.
curl -X GET -u joe@example.com -H "X-ID-TENANT-NAME:myDomain" "https://itra.oraclecloud.com/metering/api/v1/usagecost/cacct-b08a16eb7b034d99b1bd6de5f62fd302?startTime=2018-02-25T00:00:00.000Z&endTime=2018-05-24T00:00:00.000Z&timeZone=America/Los_Angeles&usageType=HOURLY"
Ensure that the timezone you specify in the cURL command matches the timezone in Oracle Cloud My Services.
Example of Request Body
There is no request body to submit with the HTTP request.
Example of Response Body
The following example shows the response body in JSON format.
{ "accountId": "cacct-b08a16eb7b034d99b1bd6de5f62fd302", "canonicalLink": "/metering/api/v1/usagecost/cacct-b08a16eb7b034d99b1bd6de5f62fd302?startTime=2018-02-25T00:00:00.000Z&endTime=2018-05-24T00:00:00.000Z&timeZone=America/Los_Angeles&usageType=HOURLY", "items": [ { "costs": [ { "computedAmount": 0.02, "computedQuantity": 0.5171082258064517, "overagesFlag": "N", "unitPrice": 0.0425, "computeType": "Usage" } ], "currency": "USD", "endTimeUtc": "2018-02-25T01:00:00.000", "gsiProductId": "B88322", "quantity": 0.5171082258064517, "resourceName": "PIC_BLOCK_STORAGE_STANDARD", "serviceName": "COMPUTEBAREMETAL", "startTimeUtc": "2018-02-25T00:00:00.000", "subscriptionId": "1822956", "subscriptionType": "PRODUCTION", "lastComputationDate": "2018-02-25T04:30:51.000", "serviceEntitlementId": "519450352", "entitlementEndDate": null, "entitlementStartDate": null }, { "costs": [ { "computedAmount": 0.02, "computedQuantity": 0.5171082258064517, "overagesFlag": "N", "unitPrice": 0.0425, "computeType": "Usage" } ], "currency": "USD", "endTimeUtc": "2018-02-25T02:00:00.000", "gsiProductId": "B88322", "quantity": 0.5171082258064517, "resourceName": "PIC_BLOCK_STORAGE_STANDARD", "serviceName": "COMPUTEBAREMETAL", "startTimeUtc": "2018-02-25T01:00:00.000", "subscriptionId": "1822956", "subscriptionType": "PRODUCTION", "lastComputationDate": "2018-02-25T05:28:44.000", "serviceEntitlementId": "519450352", "entitlementEndDate": null, "entitlementStartDate": null }, { "costs": [ { "computedAmount": 0.02, "computedQuantity": 0.5171082258064517, "overagesFlag": "N", "unitPrice": 0.0425, "computeType": "Usage" } ], "currency": "USD", "endTimeUtc": "2018-02-25T03:00:00.000", "gsiProductId": "B88322", "quantity": 0.5171082258064517, "resourceName": "PIC_BLOCK_STORAGE_STANDARD", "serviceName": "COMPUTEBAREMETAL", "startTimeUtc": "2018-02-25T02:00:00.000", "subscriptionId": "1822956", "subscriptionType": "PRODUCTION", "lastComputationDate": "2018-02-25T06:28:54.000", "serviceEntitlementId": "519450352", "entitlementEndDate": null, "entitlementStartDate": null }, { "costs": [ { "computedAmount": 0.02, "computedQuantity": 0.5171082258064517, "overagesFlag": "N", "unitPrice": 0.0425, "computeType": "Usage" } ], "currency": "USD", "endTimeUtc": "2018-02-25T04:00:00.000", "gsiProductId": "B88322", "quantity": 0.5171082258064517, "resourceName": "PIC_BLOCK_STORAGE_STANDARD", "serviceName": "COMPUTEBAREMETAL", "startTimeUtc": "2018-02-25T03:00:00.000", "subscriptionId": "1822956", "subscriptionType": "PRODUCTION", "lastComputationDate": "2018-02-25T07:28:50.000", "serviceEntitlementId": "519450352", "entitlementEndDate": null, "entitlementStartDate": null }, { "costs": [ { "computedAmount": 0.02, "computedQuantity": 0.5171082258064517, "overagesFlag": "N", "unitPrice": 0.0425, "computeType": "Usage" } ], "currency": "USD", "endTimeUtc": "2018-02-25T05:00:00.000", "gsiProductId": "B88322", "quantity": 0.5171082258064517, "resourceName": "PIC_BLOCK_STORAGE_STANDARD", "serviceName": "COMPUTEBAREMETAL", "startTimeUtc": "2018-02-25T04:00:00.000", "subscriptionId": "1822956", "subscriptionType": "PRODUCTION", "lastComputationDate": "2018-02-25T08:28:44.000", "serviceEntitlementId": "519450352", "entitlementEndDate": null, "entitlementStartDate": null }, ... // More Usage Costs items could be displayed ] }
Retrieve Usage Cost for Daily Usage
cURL Command
Enter the command on a single line. Line breaks are used in this example for readability.
curl -X GET -u joe@example.com:Mypassword1! -H "X-ID-TENANT-NAME:myDomain" "https://itra.oraclecloud.com/metering/api/v1/usagecost/cacct-b08a16eb7b034d99b1bd6de5f62fd302?startTime=2017-04-20T00:00:00.000Z&endTime=2017-04-22T00:00:00.000Z&usageType=DAILY&timeZone=America/New_York"
Ensure that the timezone you specify in the cURL command matches the timezone in Oracle Cloud My Services.
Example of Request Body
There is no request body to submit with the HTTP request.
Example of Response Body
The following example shows the response body in JSON format.
{ "accountId": "cacct-b08a16eb7b034d99b1bd6de5f62fd302", "canonicalLink": "/metering/api/v1/usagecost/cacct-b08a16eb7b034d99b1bd6de5f62fd302?startTime=2017-04-20T00:00:00.000Z&endTime=2017-04-22T00:00:00.000Z&usageType=DAILY&timeZone=America/New_York", "items": [ { "costs": [ { "computedAmount": 0.48, "computedQuantity": 7.741935483870968, "overagesFlag": "Y", "unitPrice": 0.0651 }, { "computedAmount": 0.16, "computedQuantity": 2.5806451612903225, "overagesFlag": "N", "unitPrice": 0.0651 } ], "currency": "USD", "endTimeUtc": "2017-04-21T00:00:00.000", "gsiProductId": "B87080", "resourceName": "BDCSCE_EE_PAAS_ANY_GB_HOUR", "serviceName": "BDCSCE", "startTimeUtc": "2017-04-20T00:00:00.000", "subscriptionId": "1507007", "subscriptionType": "PRODUCTION", "lastComputationDate": null }, { "costs": [ { "computedAmount": 0.8, "computedQuantity": 12.903225806451612, "overagesFlag": "Y", "unitPrice": 0.0651 }, { "computedAmount": 0.2, "computedQuantity": 3.225806451612903, "overagesFlag": "N", "unitPrice": 0.0651 } ], "currency": "USD", "endTimeUtc": "2017-04-22T00:00:00.000", "gsiProductId": "B87080", "resourceName": "BDCSCE_EE_PAAS_ANY_GB_HOUR", "serviceName": "BDCSCE", "startTimeUtc": "2017-04-21T00:00:00.000", "subscriptionId": "1507007", "subscriptionType": "PRODUCTION", "lastComputationDate": null }, { "costs": [ { "computedAmount": 3.28, "computedQuantity": 32.806451612903224, "overagesFlag": "N", "unitPrice": 0.1 }, { "computedAmount": 9.84, "computedQuantity": 98.41935483870968, "overagesFlag": "Y", "unitPrice": 0.1 } ], "currency": "USD", "endTimeUtc": "2017-04-21T00:00:00.000", "gsiProductId": "B87795", "resourceName": "BDCSCE_EE_PAAS_ANY_SSD_GB_HOUR", "serviceName": "BDCSCE", "startTimeUtc": "2017-04-20T00:00:00.000", "subscriptionId": "1507007", "subscriptionType": "PRODUCTION", "lastComputationDate": null }, { "costs": [ { "computedAmount": 4.36, "computedQuantity": 43.60806451612903, "overagesFlag": "N", "unitPrice": 0.1 }, { "computedAmount": 16.14, "computedQuantity": 161.43225806451613, "overagesFlag": "Y", "unitPrice": 0.1 } ], "currency": "USD", "endTimeUtc": "2017-04-22T00:00:00.000", "gsiProductId": "B87795", "resourceName": "BDCSCE_EE_PAAS_ANY_SSD_GB_HOUR", "serviceName": "BDCSCE", "startTimeUtc": "2017-04-21T00:00:00.000", "subscriptionId": "1507007", "subscriptionType": "PRODUCTION", "lastComputationDate": null } ] }
Retrieve Usage Cost for Monthly Usage
cURL Command
Enter the command on a single line. Line breaks are used in this example for readability.
curl -X GET -u joe@example.com:Mypassword1! -H "X-ID-TENANT-NAME:myDomain" "https://itra.oraclecloud.com/metering/api/v1/usagecost/cacct-b08a16eb7b034d99b1bd6de5f62fd302?startTime=2017-03-20T00:00:00.000Z&endTime=2017-05-22T00:00:00.000Z&usageType=MONTHLY&timeZone=America/New_York"
Ensure that the timezone you specify in the cURL command matches the timezone in Oracle Cloud My Services.
Example of Request Body
There is no request body to submit with the HTTP request.
Example of Response Body
The following example shows the response body in JSON format.
{ "accountId":"cacct-b08a16eb7b034d99b1bd6de5f62fd302", "canonicalLink":"/metering/api/v1/usagecost/cacct-b08a16eb7b034d99b1bd6de5f62fd302?startTime=2017-03-20T00:00:00.000Z&endTime=2017-05-22T00:00:00.000Z&usageType=MONTHLY&timeZone=America/New_York", "items":[ { "costs":[ { "computedAmount":-4.16, "computedQuantity":67.09677419354838, "overagesFlag":"N", "unitPrice":-0.0651 }, { "computedAmount":3.92, "computedQuantity":63.225806451612904, "overagesFlag":"Y", "unitPrice":0.0651 }, { "computedAmount":4.52, "computedQuantity":72.90322580645162, "overagesFlag":"N", "unitPrice":0.0651 } ], "currency":"USD", "endTimeUtc":"2017-04-30T20:00:00.000", "gsiProductId":"B87080", "resourceName":"BDCSCE_EE_PAAS_ANY_GB_HOUR", "serviceName":"BDCSCE", "startTimeUtc":"2017-03-31T20:00:00.000", "subscriptionId":"1507007", "subscriptionType":"PRODUCTION", "lastComputationDate":null }, { "costs":[ { "computedAmount":-390.59, "computedQuantity":1210.649721016739, "overagesFlag":"N", "unitPrice":-0.3226 }, { "computedAmount":2.37, "computedQuantity":7.350278983261, "overagesFlag":"Y", "unitPrice":0.3226 }, { "computedAmount":390.59, "computedQuantity":1210.649721016739, "overagesFlag":"N", "unitPrice":0.3226 } ], "currency":"USD", "endTimeUtc":"2017-04-30T20:00:00.000", "gsiProductId":"B87079", "resourceName":"BDCSCE_EE_PAAS_ANY_OCPU_HOUR", "serviceName":"BDCSCE", "startTimeUtc":"2017-03-31T20:00:00.000", "subscriptionId":"1507007", "subscriptionType":"PRODUCTION", "lastComputationDate":null }, { "costs":[ { "computedAmount":80.1, "computedQuantity":801.158064516129, "overagesFlag":"Y", "unitPrice":0.1 }, { "computedAmount":-100.52, "computedQuantity":1004.1370967741935, "overagesFlag":"N", "unitPrice":-0.1 }, { "computedAmount":108.16, "computedQuantity":1080.5516129032258, "overagesFlag":"N", "unitPrice":0.1 } ], "currency":"USD", "endTimeUtc":"2017-04-30T20:00:00.000", "gsiProductId":"B87795", "resourceName":"BDCSCE_EE_PAAS_ANY_SSD_GB_HOUR", "serviceName":"BDCSCE", "startTimeUtc":"2017-03-31T20:00:00.000", "subscriptionId":"1507007", "subscriptionType":"PRODUCTION", "lastComputationDate":null } ] }
Retrieve Total Usage Cost
cURL Command
Enter the command on a single line. Line breaks are used in this example for readability.
curl -X GET -u joe@example.com:Mypassword1! -H "X-ID-TENANT-NAME:myDomain" "https://itra.oraclecloud.com/metering/api/v1/usagecost/cacct-b08a16eb7b034d99b1bd6de5f62fd302?serviceName=JAAS&resourceName=JCS_SUITE_PAAS_GP_OCPU_HOUR&dataCenter=US001&startTime=2017-04-20T00:00:00.000Z&endTime=2017-04-22T00:00:00.000Z&usageType=TOTAL&timeZone=America/New_York"
Ensure that the timezone you specify in the cURL command matches the timezone in Oracle Cloud My Services.
Example of Request Body
There is no request body to submit with the HTTP request.
Example of Response Body
The following example shows the response body in JSON format.
{ "accountId":"cacct-b08a16eb7b034d99b1bd6de5f62fd302", "canonicalLink":"/metering/api/v1/usagecost/cacct-b08a16eb7b034d99b1bd6de5f62fd302?serviceName=JAAS&resourceName=JCS_SUITE_PAAS_GP_OCPU_HOUR&dataCenter=US001&startTime=2017-04-20T00:00:00.000Z&endTime=2017-04-22T00:00:00.000Z&usageType=TOTAL&timeZone=America/New_York", "items":[ { "costs":[ { "computedAmount":0.36, "computedQuantity":5.806451612903226, "overagesFlag":"N", "unitPrice":0.0651 }, { "computedAmount":1.28, "computedQuantity":20.64516129032258, "overagesFlag":"Y", "unitPrice":0.0651 } ], "currency":"USD", "endTimeUtc":"2017-04-22T00:00:00.000", "gsiProductId":"B87080", "resourceName":"BDCSCE_EE_PAAS_ANY_GB_HOUR", "serviceName":"BDCSCE", "startTimeUtc":"2017-04-20T00:00:00.000", "subscriptionId":"1507007", "subscriptionType":"PRODUCTION", "lastComputationDate":null }, { "costs":[ { "computedAmount":25.98, "computedQuantity":259.8516129032258, "overagesFlag":"Y", "unitPrice":0.1 }, { "computedAmount":7.64, "computedQuantity":76.41451612903226, "overagesFlag":"N", "unitPrice":0.1 } ], "currency":"USD", "endTimeUtc":"2017-04-22T00:00:00.000", "gsiProductId":"B87795", "resourceName":"BDCSCE_EE_PAAS_ANY_SSD_GB_HOUR", "serviceName":"BDCSCE", "startTimeUtc":"2017-04-20T00:00:00.000", "subscriptionId":"1507007", "subscriptionType":"PRODUCTION", "lastComputationDate":null } ] }