0

I'm developing a project relied on softlayer invoice api. I want get all bare metal server configuration info from invoice item. But the information returned by the interface SoftLayer_Billing_Invoice::getItems contains other billing information such as the virtual machine, and there is no way to distinguish. Is there another way to get bare metal server invoice info ?

Regards~

J.yan
  • 3
  • 1

1 Answers1

0

Try with the following filter:

https://api.softlayer.com/rest/v3.1/SoftLayer_Billing_Invoice/[invoiceId]/getItems?objectFilter={"items":{"categoryCode":{"operation":"server"}}}

It returns the baremetal server items which are listed into the invoice.

Following is a python sample:

billing_invoice = client['Billing_Invoice']

filter = {'items':{'categoryCode':{'operation':'server'}}}

result = billing_invoice.getItems(filter=filter, id=invoiceId)

I recommend to review the links below to know more about object-filters:

https://softlayer.github.io/article/object-filters/

How to use object filter with softlayer rest api?

https://softlayer.github.io/tags/object_filter/

Albert Camacho
  • 1,129
  • 1
  • 7
  • 13
  • But I want to know bare metal configuration include ram, bandwidth, cpu invoice info ect. The filter only can get server invoice info.I saw that bare metal server configuration and virtual server configuration etc are mixed together. – J.yan Jun 27 '18 at 02:08
  • on that case you need to add masks in order to retrieve that information, try with mask[billingItem[children]], to know more about mask review https://softlayer.github.io/tags/objectmask/ – Albert Camacho Jun 27 '18 at 13:46