Softlayer rest call giving multiple entries for invoice in json response when object filter is applied to relational properties

百般思念 提交于 2020-01-07 01:18:26

问题


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


来源:https://stackoverflow.com/questions/43640651/softlayer-rest-call-giving-multiple-entries-for-invoice-in-json-response-when-ob

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!