Softlayer rest call giving multiple entries for in

2019-09-16 01:56发布

问题:

Using below rest call, I am seeing multiple records for a single invoice. I realized it repeated for as many items are there in that invoice.

Rest request:

https://api.softlayer.com/rest/v3/SoftLayer_Account/<Account-ID>/getInvoices?objectFilter={"invoices":{"items":{"billingItem":{"hourlyFlag":{"operation":"0"}}}}}

to be replaced by actual account number in Softlayer.

Actual result should be, it should show one single record for one invoice.

回答1:

The invoice will be displayed the times that "hourlyFlag=0" exists in the items from it. So it means if the invoice is displayed three times, there exists three items inside the invoice which has that flag (hourlyFlag=0)

You can verify that, using an objectMask like this:

https://api.softlayer.com/rest/v3/SoftLayer_Account/getInvoices?objectFilter={"invoices":{"items":{"billingItem":{"hourlyFlag":{"operation":"0"}}}}}&objectMask=mask[id,items[billingItem[id,hourlyFlag]]]

Method: Get

Using Result Limits:

https://api.softlayer.com/rest/v3/SoftLayer_Account/getInvoices?objectFilter={"invoices":{"items":{"billingItem":{"hourlyFlag":{"operation":"0"}}}}}&objectMask=mask[id,items[billingItem[id,hourlyFlag]]]&resultLimit=0,50

Method: Get