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

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 true, sort the response in ascending order

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: yyyy/MM/dd HH:mm:ss Z (where 'Z' is the adjustment for the time zone, for example, 2018/04/19 23:59:59 +0000). Encode the date for sending as a query parameter in the URL, for example, 2018%2F04%2F19%2023%3A59%3A59%20%2B0000

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.

 

cURL:

curl 'https://lab.abiquo.example.com/api/statistics/enterpriseresources/1/bills?identerprise=1&limit=0&by=billingPeriodStartDate&fromdate=2023%2F01%2F14%2011%3A21%3A17%20%2B0200&asc=false&provider=AMAZON' \ -H 'Accept: application/vnd.abiquo.bills+json;version=6.1' \ -H 'Authorization: Token XXXXXXXX'

Success status code: 200

Request payload:

--none--

Response payload:

{ "totalSize": 1554, "links": [ { "rel": "first", "href": "https://lab.abiquo.example.com:443/api/statistics/enterpriseresources/1/bills?identerprise=1&fromdate=2023/01/14 11:21:17 +0200&provider=AMAZON&limit=3&by=billingPeriodStartDate&asc=false" }, { "rel": "next", "href": "https://lab.abiquo.example.com:443/api/statistics/enterpriseresources/1/bills?identerprise=1&fromdate=2023/01/14 11:21:17 +0200&provider=AMAZON&startwith=3&limit=3&by=billingPeriodStartDate&asc=false" }, { "rel": "last", "href": "https://lab.abiquo.example.com:443/api/statistics/enterpriseresources/1/bills?identerprise=1&fromdate=2023/01/14 11:21:17 +0200&provider=AMAZON&startwith=1551&limit=3&by=billingPeriodStartDate&asc=false" } ], "collection": [ { "category": "Data Transfer-Amazon Simple Storage Service", "usageType": "EUC1-APS1-AWS-Out-Bytes", "usageName": "Others", "provider": "AMAZON", "date": "2023/06/02 22:32:37 +0000", "billingPeriodStartDate": "2023/05/01 00:00:00 +0000", "billingPeriodEndDate": "2023/05/31 23:59:59 +0000", "price": 0, "currencyCode": "USD", "links": [ { "title": "bill", "rel": "self", "type": "application/vnd.abiquo.bill+json", "href": "https://lab.abiquo.example.com:443/api/statistics/enterpriseresources/1/bills/9472" }, { "title": "Abiquo", "rel": "enterprise", "type": "application/vnd.abiquo.enterprise+json", "href": "https://lab.abiquo.example.com:443/api/admin/enterprises/1" } ] }, { "category": "Storage Snapshot-Amazon Elastic Compute Cloud", "usageType": "EU-EBS:SnapshotUsage", "usageName": "Others", "provider": "AMAZON", "date": "2023/06/02 22:32:37 +0000", "billingPeriodStartDate": "2023/05/01 00:00:00 +0000", "billingPeriodEndDate": "2023/05/31 23:59:59 +0000", "price": 16.4114, "currencyCode": "USD", "links": [ { "title": "bill", "rel": "self", "type": "application/vnd.abiquo.bill+json", "href": "https://lab.abiquo.example.com:443/api/statistics/enterpriseresources/1/bills/9728" }, { "title": "Abiquo", "rel": "enterprise", "type": "application/vnd.abiquo.enterprise+json", "href": "https://lab.abiquo.example.com:443/api/admin/enterprises/1" } ] }, { "category": "Data Transfer-Amazon Simple Storage Service", "usageType": "EUC1-APS2-AWS-Out-Bytes", "usageName": "Others", "provider": "AMAZON", "date": "2023/06/02 22:32:37 +0000", "billingPeriodStartDate": "2023/05/01 00:00:00 +0000", "billingPeriodEndDate": "2023/05/31 23:59:59 +0000", "price": 0, "currencyCode": "USD", "links": [ { "title": "bill", "rel": "self", "type": "application/vnd.abiquo.bill+json", "href": "https://lab.abiquo.example.com:443/api/statistics/enterpriseresources/1/bills/9473" }, { "title": "Abiquo", "rel": "enterprise", "type": "application/vnd.abiquo.enterprise+json", "href": "https://lab.abiquo.example.com:443/api/admin/enterprises/1" } ] } ] }

 

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

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:

cURL:

curl -XPOST https://lab.abiquo.example.com/api/statistics/enterpriseresources/1/bills \ -H "Accept: application/vnd.abiquo.bill+json; version=6.1" \ -H "Content-type: application/vnd.abiquo.bill+json; version=6.1" \ -H "Authorization: Token XXX" \H -d @requestpayload.json

Success status code: 200

Request payload:

Response payload:

 

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

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:

cURL:

Success status code: 200

Request payload:

--none--

Response payload:

 

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

Parameter

Type

Default Value

Description

startBillDate

String

 

Delete the consolidated bills with a billingPeriodStartDate value of this date. For example, 2023/01/14 11:21:17 +0200. Encode this date to send it as part of the request URL, for example, 2023%2F01%2F14%2011%3A21%3A17%20%2B0200

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: 

cURL:

Success status code: 204

Request payload:

--none--

Response payload:

--none--

 

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

Parameter

Type

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 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

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 the price attribute).

    • The platform will ignore the price, unless you later enter an estimated attribute with a 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. 

 

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

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

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

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, 2020/01/01 00:00:00 +0000. Encode this date to send it as a query parameter in the request URL, for example, 2023%2F06%2F07%2011%3A24%3A06%20%2B0000.

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