【问题标题】:Softlayer billing invoice APISoftlayer 计费发票 API
【发布时间】:2026-02-01 07:25:02
【问题描述】:

我们正在尝试使用 API 以折扣价检索多个 Softlayer 服务器的标价。

我们对如何做到这一点有一个粗略的了解,但希望得到一些确认和指导。

我们打算使用 Softlayer 计费发票 API 从每张发票中检索计费项目列表 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/

这为我们提供了服务器计费项目的折扣价,但我们如何获得标价?

【问题讨论】:

    标签: ibm-cloud ibm-cloud-infrastructure billing invoice


    【解决方案1】:

    要获取商品的原价,可以使用SoftLayer_Product_Package服务的getItemPrices方法来获取商品的packageId和商品的位置。

    要获取项目包和位置 ID,您可以使用此 api:

    方法:获取

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

    获取商品价格的请求如下:

    方法:获取

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

    参考: https://softlayer.github.io/reference/services/SoftLayer_Product_Package/getItemPrices/

    您可以尝试的另一种方法是通过服务器的顺序,因为您必须知道 orderId 并通过方法 getObjectgetItems 使用服务 SoftLayer_Billing_Order。

    要获取 orderId,您还可以使用以下其余部分。

    方法:获取

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

    在response de order对象中搜索,会得到orderId。

    【讨论】: