BillsResource and BillRegistersResource
The Bills and BillRegisters resources represent public cloud and private cloud bills in the platform for display on the billing dashboard (see Hybrid ).
You can configure Abiquo to obtain billing data from providers such as Amazon and Azure (see Display cloud provider billing data ) and you can configure on premise billing (see Configure on premise billing) to account for your private cloud resources.
When a cloud provider issues a bill, and Abiquo obtains this bill, it creates a consolidated bill in the Bills resource.
When a cloud provider supplies cost and usage data daily, then Abiquo creates a record of this with daily bill registers in the BillRegisters resource. Using the bill registers, Abiquo can calculate an estimate of your bill for display on the dashboard. After Abiquo creates a consolidated bill for the billing period, it will delete the bill registers.
Â
Bills resource
The bills resource represents bills created by cloud providers such as Amazon, Azure, on-premise, and custom providers. Â
Â
List last bills
You can configure Abiquo to retrieve billing data from public cloud providers, such as Amazon or Azure, for private cloud (ONPREMISE
) or add your own billing data from custom providers.Â
After you add bill data, you can retrieve bill entities from this resource. The most recent bills display in the UI on the billing dashboard.
To platform stores a bill entry for each category and usage type, so that it can display a billing breakdown on the dashboard, and to enable you to control the billing categories and usage to include in your customer bills.
Â
Method documentation: https://wiki.abiquo.com/api/latest/BillsResource.html#list-last-bills
Summary: GET https://example.com/api/statistics/enterpriseresources/{enterprise}/bills
Roles required:Â BILLS_VIEW
Request headers: Accept:Â application/vnd.abiquo.bill+json; version=6.1;
Query parameters:
Parameter | Type | Default value | Description |
---|---|---|---|
startwith | Integer | 0 | First bill to return |
by | String | id | Sort the elements response on this attribute |
has | String | Â | text string to filter the results - return results with this text string in the name |
limit | Integer | 25 | Total number of elements to return in the response |
asc | Boolean | true | If |
provider | String | Â | Supply the name of a provider to obtain the bills from that provider only |
fromdate | String | Â | Start date of the period to return bills from. Format: |
identerprise | Integer | Â | Return bills for the enterprise with this ID |
Request message body entity:Â
Response message body entity: See bills media type, which is a collection of bill media type, as documented at https://wiki.abiquo.com/api/latest/bill.html
Request example:
In this example, we have limited the number of bills to make the request example more readable.
Â
Â
Create a new bill
Add a bill from a provider to the platform for display on billing dashboard. When you add a bill, the platform will delete the estimate data for the provider for the billing period.
If you add a new custom provider with a bill, you must add it to the list of providers in the billing dashboard or exclude it from the providers in the billing dashboard. See Configure provider list in dashboard billing widgets. Otherwise, the Last bills widget will not display properly for any provider.
Â
Summary:Â POST /statistics/enterpriseresources/{enterprise}/bills
Roles required:Â BILLS_MANAGE
Request headers: Accept:Â application/vnd.abiquo.bill+json; version=6.1; Content-type: application/vnd.abiquo.bill+json; version=6.1;Â
Request parameters:
Parameter | Required | Default value | Description |
---|---|---|---|
Request message body entity:Â
Response message body entity: See bill media type, as documented at https://wiki.abiquo.com/api/latest/bill.html
Request example:
Â
Create a new bill by categories
In order to display bills broken down by category, Abiquo creates a consolidated bill for an enterprise and provider divided by categories.
When you create this bill, you need to send a different type of media type for bill by category, which contains a category and its array of usage types and costs.
For full details, see the API documentation at: https://wiki.abiquo.com/api/latest/BillsResource.html#create-new-bill-by-categories.
Bill Resource
The bill resource represents a single bill created for cloud providers such as Amazon, Azure, on-premise, and custom providers. Â
Get a provider bill
You can get a provider bill using the ID of the enterprise and the bill, or from the link with a rel
value of self
that the API returns when you create a bill.
Synopsis:Â GETÂ /statistics/enterpriseresources/{enterprise}/bills/{bill}
Roles required:Â BILLS_VIEW
Request headers:Â Accept:Â application/vnd.abiquo.bill+json; version=6.1;Â Content-type: ;
Request parameters:
Parameter | Required | Default value | Description |
---|---|---|---|
Request message body entity:Â
Response message body entity: Bill media type as documented at https://wiki.abiquo.com/api/latest/bill.html
Request example:
Â
Delete consolidated bills
Delete all the consolidated bills from a given date. You must supply the startBillDate
with the value of the billingPeriodStartDate
of the bills to delete and the provider
with a value of the provider name.
Synopsis:Â DELETE /statistics/enterpriseresources/{enterprise}/bills
Roles required:Â BILLS_MANAGE
Request headers:Â Accept: ; Content-type: ;
Request parameters:
Parameter | Type | Default Value | Description |
---|---|---|---|
startBillDate | String | Â | Delete the consolidated bills with a |
provider | String | Â | Delete the consolidated bills for this provider name. You can obtain the list of providers with the method to list billing providers. |
Request message body entity:Â
Response message body entity:Â
Request example:Â
Â
List billing providers
The billing provider names identify the providers in the platform. For public cloud this request returns the provider name, and for private cloud with on premise billing, it returns ONPREMISE
.
The API uses this request to display budget data and billing dashboards.
If you add a bill for a custom provider, then you must configure it for the UI. See Configure provider list in dashboard billing widgets. Otherwise, you will have issues with the UI, such as the Last bills widget will not display properly for any provider.
Synopsis:Â GETÂ /statistics/enterpriseresources/{enterprise}/bills/action/providers
Roles required:Â BILLS_VIEW
Request headers:Â Accept:Â application/vnd.abiquo.billproviders+json; version=6.1; Content-type: ;
Request parameters:
Parameter | Type | Default value | Description |
---|---|---|---|
Request message body entity:Â
Response message body entity: See bill providers media type at Abiquo API Reference
Request example:
Â
BillRegisters Resource
The BillRegisters resource represents provider data that the platform will use to display billing estimates. You can create provider estimates for the billing period, or cost records for each day (or other periodic entries), or both.
If you enter a provider estimate, the platform will output the current value as the estimate.
If you enter cost records, the platform will calculate an estimate based on all the values you have entered for the current billing period.
Â
List billing estimate and cost records for a provider
List the estimates and/or cost records for the given provider for the current period.
See full documentation at: https://wiki.abiquo.com/api/latest/BillRegistersResource.html#list-bills-of-last-period.
You must supply the name of the provider
as a query parameter. This can be the built-in provider names (see https://wiki.abiquo.com/api/latest/BillsResource.html#list-bill-providers) or custom provider names. Note that if you are using custom provider names, you must configure them to display or exclude them from the UI. See Configure provider list in dashboard billing widgets.
Synopsis:Â GETÂ /statistics/enterpriseresources/{enterprise}/billregisters
Roles required:Â BILLS_VIEW
Request headers: Accept:Â application/vnd.abiquo.bills+json; version=6.1;Â Content-type: ;
Request parameters:
Parameter | Type | Description |
---|---|---|
provider | String | Supply the name of a provider to obtain estimates and/or cost records from that provider |
Request message body entity:Â
Response message body entity: See bills media type at Abiquo API Reference
Request examples:
Get cost records for AMAZON
We have shortened this example to improve readability.
Â
Â
Create a billing estimate or cost record
You can use this method to add a billing estimate or a cost record, or both.Â
Create a billing estimate for a fixed amount
Set the
estimated
attribute as the value of the current estimate, until you create another estimate. Note that you can also set a cost at the same time (using theprice
attribute).The platform will ignore the price, unless you later enter an
estimated
attribute with a value of0
. In this case, the platform will calculate the estimate using all values of the price attribute for the period.
Create a cost record that the platform will use to calculate a billing estimate
Use the
price
attribute to set the cost. Set theestimated
attribute to0
. Enter the cost values periodically, for example, using a script that runs daily.Â
Â
You can also create these billing records for costs and estimates with billing information by categories.
See https://wiki.abiquo.com/api/latest/BillRegistersResource.html#create-bill-by-categories.
Â
The platform will delete billing estimates when you add a consolidated bill as described in the Bills Resource documentation. For more details of how to create consolidated bills, see https://wiki.abiquo.com/api/latest/BillsResource.html.
Â
Â
Synopsis:Â POST /statistics/enterpriseresources/{enterprise}/billregisters
Roles required:Â BILLS_MANAGE
Request headers: Accept:Â application/vnd.abiquo.bill+json; version=6.1;Â Content-type:Â application/vnd.abiquo.bill+json; version=6.1;
Request parameters:
Parameter | Required | Default value | Description |
---|---|---|---|
Request message body entity:Â
Response message body entity: See bill media type at Abiquo API Reference
Request examples:
Create a provider estimate with a fixed amount and a cost record for day ending at 13:24:06!
The API does not return the value of the estimated
attribute, but it stores it for later use.
If you follow this example and add another cost record and set the value of the estimated
attribute to 0
, then the API will calculate the estimate from the cost records using linear regression.
Here is an example of an additional cost record for the second week of the month.
Â
Get a current estimate for a provider as displayed on the dashboard
The current estimate is the last estimate that you supplied or the estimate calculated from the current cost records using linear regression.
You must supply the name of the provider
as a query parameter.
Synopsis:Â GETÂ /statistics/enterpriseresources/{enterprise}/billregisters/action/estimate
Roles required:Â BILLS_VIEW
Request headers: Accept: text/plain Content-type: ;
Request parameters:
Parameter | Default value | Description |
---|---|---|
provider | Supply the name of a provider to obtain estimates and/or cost records for that provider |
Request message body entity:Â
Response message body entity:Â text/plainÂ
Request example:
BillRegister Resource
Manage billing records of cost and estimates for the current period.
Get a billing estimate or cost recordÂ
Obtain a fixed estimate record or a cost record for the current period.
You can get this record using the ID number in the response when you created it.
Synopsis:Â GET /statistics/enterpriseresources/{enterprise}/billregisters/{billregister}
Roles required:Â BILLS_VIEW
Request headers:Â Accept:Â application/vnd.abiquo.bill+json; version=6.1;Â Content-type: ;
Request parameters:
Parameter | Required | Default value | Description |
---|---|---|---|
Request message body entity:Â
Response message body entity: See bill media type at Abiquo API Reference
Request example:Â
Delete a billing estimate or cost record
The platform will delete billing estimate and cost records when you add a bill after the end of the billing period, or you can delete them manually with this method.
You must supply a date and a provider.
Synopsis:Â DELETE /statistics/enterpriseresources/{enterprise}/billregisters
Roles required:Â BILLS_MANAGE
Request headers:Â Accept: ; Content-type: ;
Request parameters:
Parameter | Type | Description |
billDate | String | Date of the bill registers to delete. For example, |
provider | String | Provider of the bill registers to delete |
Request message body entity:Â
Response message body entity:Â
Request example:Â
Copyright © 2006-2024, Abiquo Holdings SL. All rights reserved