ChuanWee
ChuanWee

Reputation: 1

Softlayer billing invoice API

We are trying to retrieve the list price of a number of Softlayer servers with discounted pricing using API.

We have a rough idea of how this can be done but would like some confirmation and guidance.

We intend to use the Softlayer billing invoice API to retrieve a list of billing items from each invoice https://softlayer.github.io/reference/services/SoftLayer_Billing_Invoice/ https://softlayer.github.io/reference/services/SoftLayer_Billing_Invoice/getItems/ https://softlayer.github.io/reference/datatypes/SoftLayer_Billing_Invoice_Item/

This gives us the discounted price of the servers' billing items but how can we get the list price?

Upvotes: 0

Views: 223

Answers (1)

F.Ojeda
F.Ojeda

Reputation: 728

To obtain the original price of the items can be done using the method getItemPrices of the SoftLayer_Product_Package service for that you have to obtain the packageId and the location of the items.

To get the item package and location Ids you can use this rest api:

Method: GET

https://[username]:[apikey]@api.softlayer.com/rest/v3/SoftLayer_Billing_Invoice/[billingInvoiceId]/getItems?objectMask=mask[location,billingItem[package]]

The request to get the item prices is like below:

Method: GET

https://[username]:[apikey]@api.softlayer.com/rest/v3/SoftLayer_Product_Package/[packageId]/getItemPrices

Reference: https://softlayer.github.io/reference/services/SoftLayer_Product_Package/getItemPrices/

Another way you can try is through the order of the servers for that you have to know the orderId and use the service SoftLayer_Billing_Order with the method getObject or getItems.

To get the orderId you could also use the following rest.

Method: GET

https://[username]:[apiKey]@api.softlayer.com/rest/v3/SoftLayer_Billing_Invoice/[billingInvoiceId]/getItems?objectMask=mask[location,billingItem[orderItem[order],package]]

Search in the response de order object and you will get the orderId.

Upvotes: 1

Related Questions