softlayer billing api 获取过去的发票

softlayer billing api to get a past invoice

想知道是否有软层休息 api 可以用来获取过去某个特定月份的发票。

例如,我想提取 2016 年 4 月的发票。我查看了 Softlayer Billing Invoice 服务,但没有成功。

此外,我确实在发票对象上看到一个名为 createDate 的 属性,但不确定它是否对给定场景有任何帮助。

可以使用 Object Filters,在这种情况下,有必要在日期之间使用过滤器,请尝试以下示例:

https://$username:$apiKey@api.softlayer.com/rest/v3.1/SoftLayer_Account/getInvoices?objectFilter={"invoices":{"createDate":{"operation":"betweenDate","options":[{"name":"startDate","value":["04/01/2016 00:00:00"]},{"name":"endDate","value":["04/30/2016 23:59:59"]}]}}}
    
Method: Get

它将显示 04/01/2016 00:00:0004/30/2016 23:59:59[=32= 之间的发票]

参考文献:


Updated

如何获取特定月份的单张发票?

您需要从 invoice with "typeCode": "RECURRING" 获取信息,在这种情况下,您可以使用以下请求:

https://$username:$apiKey@api.softlayer.com/rest/v3.1/SoftLayer_Account/getInvoices?objectFilter={"invoices":{"createDate":{"operation":"betweenDate","options":[{"name":"startDate","value":["06/01/2016 00:00:00"]},{"name":"endDate","value":["06/30/2016 23:59:59"]}]}, "typeCode":{"operation":"RECURRING"}}}

Method: Get