0
votes
i want to pull all the invoice items with recurringFee > 0 and that are associated with invoices of type "NEW" and with createDate between a startDate and endDate and all these new invoices are under a customer account <accountId>. when i tried the below api, i kept getting the error "Object does not exist to execute method on".

    https://api.softlayer.com/rest/v3/SoftLayer_Billing_Invoice/getItems?
    objectFilter={
        "items":{
            "invoice":{
                "accountId":{"operation":"976633"},
                "typeCode":{"operation":"NEW"},         
                "createDate":{"operation":"betweenDate",
                    "options":[
                        {"name":"startDate","value": ["01/16/2017 00:00:00"]},
                        {"name":"endDate","value": ["02/14/2017 23:23:59"]}
                    ]
                }
            },      
            "recurringFee":{"operation":"> 0"}      
        }
    }&objectMask=mask[id,recurringFee,invoice[id,createDate,typeCode]]

But when i tried the below query, i am getting too many items (that includes items with recurring = 0 too).

https://api.softlayer.com/rest/v3/SoftLayer_Account/976633/getInvoices?
objectFilter={
    "invoices":{
        "createDate":{"operation":"betweenDate",
            "options":[
                {"name":"startDate","value": ["01/16/2017 00:00:00"]},
                {"name":"endDate","value": ["02/14/2017 23:23:59"]}
            ]
        },      
        "typeCode":{"operation":"NEW"}          
    }
}&objectMask=mask[id,createDate,items[id,recurringFee,recurringTaxAmount,oneTimeFee,oneTimeTaxAmount,description,hostName,domainName,hourlyRecurringFee,laborFee,laborTaxAmount,setupFee,setupTaxAmount,billingItem[id,activeFlag,hourlyFlag,allowCancellationFlag,cancellationDate]]]

Pls help me.

thanks

1

1 Answers

0
votes

For me this query is working fine:

GET https://api.softlayer.com/rest/v3/SoftLayer_Billing_Invoice/2661582/getItems?objectFilter={"items":{"recurringFee":{"operation":"> 0"},"invoice":{"createDate":{"operation":"betweenDate","options":[{"name":"startDate","value": ["2/19/2014 00:00:00"]},{"name":"endDate","value": ["2/20/2014 23:23:59"]}]},"typeCode":{"operation":"NEW"}}}}

I left out the filter fo accountID because all the invoices must belong to your account so there is not any reason to add that filter.

Also it worked for me using a simple REST client (I used Insommia), I recomed you try with a client like that first, because Java could be adding some other charaters which make the query fail.

Regards

Regards