BillsResource and BillRegistersResource

The Bills and BillRegisters resources represent public 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) . You can enter a fixed estimate for display on the dashboard, or a daily cost. If you supply a daily cost, Abiquo can calculate an estimate of your bill for display on the dashboard.  

Bills resource

The bills resource represents bills from cloud providers such as Amazon, Azure, and custom providers.  

List provider bills

After you configure the dashboard widgets for Amazon and/or Azure, or enter bill data from custom providers, you can retrieve bill entities from this resource. The most recent bills display in the UI on the billing dashboard

Synopsis: GET /statistics/enterpriseresources/{enterprise}/bills

Roles required: BILLS_VIEW
Request headers: Accept: application/vnd.abiquo.bills+json; version=5.4; application/vnd.abiquo.bills+xml; version=5.4; Content-type: ;
Request parameters:

Parameter

Required

Default value

Description

Parameter

Required

Default value

Description

provider

false



Supply the name of a provider to obtain only the bills from that provider

startwith

false

0

first bill to return

has

false



text string to filter the results - return results with this text string in the name

by

false

name

order result by this field

limit

false

25

total number of elements in the result set

asc

false

true

If true, sort order is ascending

Request message body entity: 
Response message body entity: See bills media type at Abiquo API Reference
Request example:

cURL:

curl -X GET https://example.com/api/statistics/enterpriseresources/3/bills?limit=2 \ -H 'Accept:application/vnd.abiquo.bills+json; version=4.2' \ -u user:password --verbose

Success status code: 200

Request payload:

--none--

Response payload:

{ "links":[ { "rel":"first", "href":"https://example.com/api/statistics/enterpriseresources/3/bills?limit=2&by=id&asc=true" }, { "rel":"next", "href":"https://example.com/api/statistics/enterpriseresources/3/bills?startwith=2&limit=2&by=id&asc=true" }, { "rel":"last", "href":"https://example.com/api/statistics/enterpriseresources/3/bills?startwith=7&limit=2&by=id&asc=true" } ], "collection":[ { "provider":"Azure", "date":"2018/04/21 10:25:35 +0000", "price":67.17100, "currencyCode":"USD", "billingPeriodStartDate":"2018/03/20 00:00:00 +0000", "billingPeriodEndDate":"2018/04/19 23:59:59 +0000", "totalVms":105, "links":[ { "title":"bill", "rel":"self", "type":"application/vnd.abiquo.bill+json", "href":"https://example.com/api/statistics/enterpriseresources/3/bills/1" }, { "title":"IT TEAM", "rel":"enterprise", "type":"application/vnd.abiquo.enterprise+json", "href":"https://example.com/api/admin/enterprises/3" } ] }, { "provider":"Amazon", "date":"2018/05/02 09:17:16 +0000", "price":24.72000, "currencyCode":"USD", "billingPeriodStartDate":"2018/04/01 00:00:00 +0000", "billingPeriodEndDate":"2018/04/30 23:59:59 +0000", "totalVms":6, "links":[ { "title":"bill", "rel":"self", "type":"application/vnd.abiquo.bill+json", "href":"https://example.com/api/statistics/enterpriseresources/3/bills/2" }, { "title":"IT TEAM", "rel":"enterprise", "type":"application/vnd.abiquo.enterprise+json", "href":"https://example.com/api/admin/enterprises/3" } ] } ], "totalSize":9 }

Create a provider bill

Add a provider bill to the platform for display on billing dashboard. When you add a bill, the platform will delete the estimate data for the billing period.

Synopsis: POST /statistics/enterpriseresources/{enterprise}/bills
Roles required: BILLS_MANAGE
Request headers: Accept: application/vnd.abiquo.bill+json; version=5.4; application/vnd.abiquo.bill+xml; version=5.4; Content-type: application/vnd.abiquo.bill+json; version=5.4; application/vnd.abiquo.bill+xml; version=5.4; 
Request parameters:

Parameter

Required

Default value

Description

Parameter

Required

Default value

Description









Request message body entity: 
Response message body entity: See bills media type at Abiquo API Reference

Request example:

cURL:

curl -X POST https://example.com/api/statistics/enterpriseresources/3/bills \ -H 'Accept:application/vnd.abiquo.bill+json; version=4.2' \ -H 'Content-Type:application/vnd.abiquo.bill+json; version=4.2' \ -d @requestpayload.json \ -u user:password --verbose

Success status code: 200

Request payload:

Response payload:

Bill Resource

Get a provider bill

Synopsis: GET /statistics/enterpriseresources/{enterprise}/bills/{bill}
Roles required: BILLS_VIEW
Request headers: Accept: application/vnd.abiquo.bill+json; version=5.4; application/vnd.abiquo.bill+xml; version=5.4;  Content-type: ;
Request parameters:

Parameter

Required

Default value

Description

Parameter

Required

Default value

Description









Request message body entity: 
Response message body entity: See bills media type at Abiquo API Reference
Request example:

cURL:

Success status code: 200

Request payload:

--none--

Response payload:

Delete a provider bill

Synopsis: DELETE /statistics/enterpriseresources/{enterprise}/bills/{bill}
Roles required: BILLS_MANAGE
Request headers: Accept: ; Content-type: ;
Request parameters:

Parameter

Required

Default value

Description

Parameter

Required

Default value

Description









Request message body entity: 
Response message body entity: 
Request example: 

cURL:

Success status code: 204

Request payload:

--none--

Response payload:

--none--

List billing providers

The billing provider names identify the providers in the platform. It returns the hypervisor type of all the allowed datacenters for a tenant. For public cloud this request returns the provider name, and in private cloud the hypervisor type, in the format ABIQUO-{hypervisor type}. This request is used by the API to display budget data and billing dashboards.

Synopsis: GET /statistics/enterpriseresources/{enterprise}/bills/action/providers
Roles required: BILLS_VIEW
Request headers: Accept: application/vnd.abiquo.billproviders+json; version=5.4; application/vnd.abiquo.billproviders+xml; version=5.4; Content-type: ;
Request parameters:

Parameter

Required

Default value

Description

Parameter

Required

Default value

Description









Request message body entity: 
Response message body entity: See bill providers media type at Abiquo API Reference
Request example:

cURL:

Success status code: 200

Request payload:

--none--

Response payload:

BillRegisters Resource

The BillRegisters resource represents provider data for 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

Synopsis: GET /statistics/enterpriseresources/{enterprise}/billregisters

Roles required: BILLS_VIEW
Request headers: Accept: application/vnd.abiquo.bills+json; version=5.4; application/vnd.abiquo.bills+xml; version=5.4; Content-type: ;
Request parameters:

Parameter

Required

Default value

Description

Parameter

Required

Default value

Description

provider

true



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 Azure

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, which will be the current estimate until you create another billing estimate. Note that you can also set a cost at the same time (using the price attribute). The platform will ignore the price, unless you later enter an estimated value of 0. 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 the "estimated" attribute to 0. Enter the cost values periodically, for example, using a script that runs daily. 

The platform will delete billing estimates when you add a bill as described in the Bills Resource documentation. 

Synopsis: POST /statistics/enterpriseresources/{enterprise}/billregisters
Roles required: BILLS_MANAGE
Request headers: Accept: application/vnd.abiquo.bill+json; version=5.4; application/vnd.abiquo.bill+xml; version=5.4; Content-type: application/vnd.abiquo.bill+json; version=5.4; application/vnd.abiquo.bill+xml; version=5.4;;
Request parameters:

Parameter

Required

Default value

Description

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 

 

Add a cost record for the day ending at 2018/05/28 11:00:00 +0000.

Get a current estimate for a provider as displayed on the dashboard

Synopsis: GET /statistics/enterpriseresources/{enterprise}/billregisters/action/estimate
Roles required: BILLS_VIEW
Request headers: Accept: text/plain Content-type: ;
Request parameters:

Parameter

Required

Default value

Description

Parameter

Required

Default value

Description

provider

true



Supply the name of a provider to obtain estimates and/or cost records from that provider

Request message body entity: 
Response message body entity: text/plain 
Request example:

BillRegister Resource

Get a billing estimate or cost record 

Obtain a fixed estimate record or a cost record for the current period.

Synopsis: GET /statistics/enterpriseresources/{enterprise}/billregisters/{billregister}
Roles required: BILLS_VIEW
Request headers: Accept: application/vnd.abiquo.bill+json; version=5.4; application/vnd.abiquo.bill+xml; version=5.4; Content-type: ;
Request parameters:

Parameter

Required

Default value

Description

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.

Synopsis: DELETE /statistics/enterpriseresources/{enterprise}/billregisters/{billregister}
Roles required: BILLS_MANAGE
Request headers: Accept: ; Content-type: ;
Request parameters:

Parameter

Required

Default value

Description

Parameter

Required

Default value

Description









Request message body entity: 
Response message body entity: 
Request example: 

Copyright © 2006-2024, Abiquo Holdings SL. All rights reserved