SoftLayer API:如何使用orderId作为输入获取发票

时间:2016-04-15 21:23:47

标签: api ibm-cloud-infrastructure

SoftLayer API:如何获取特定订单的所有发票?

e.g。我下了三个订单:一个月度虚拟服务器,orderId1,一个小时裸机服务器,orderId2,一个月度裸机服务器,orderId3。

SoftLayer_Billing_Order-> getInitialInvoice()可以返回一个订单的初始发票。

SoftLayer_Account-> getInvoices可以将我的所有发票退还给我。每 SoftLayer_Billing_Invoice包含我所有三个订单的详细信息。

我试图找到只能为一个订单退回发票的API。

例如,使用orderId作为输入参数

获取设备的每个结算周期的金额

有办法做到这一点吗?

感谢。

1 个答案:

答案 0 :(得分:0)

这是一个使用过滤器的python脚本

import SoftLayer
# For nice debug output:
from pprint import pprint as pp

API_USERNAME = 'set me'
API_KEY = 'set me'


filterInstance = {
  'invoices': {
    'items': {
      'billingItem': {
        'orderItem': {
          'order': {
            'id': {
              'operation': 2901586
            }
          }
        }
      }
    }
  }
}

# Creates a new connection to the API service.
client = SoftLayer.Client(
    username=API_USERNAME,
    api_key=API_KEY
)

try:
    result = client['SoftLayer_Account'].getInvoices( filter = filterInstance)
    pp(result)

except SoftLayer.SoftLayerAPIError as e:
    pp('Failed ...  faultCode=%s, faultString=%s'
        % (e.faultCode, e.faultString))

我希望它可以帮到你。

相关问题