-3

I was trying to create C# application that loads SoftLayer Billing data to my Database. I was trying to bring only filtered Billing data using ObjectFilter. For example, I wanted to bring only invoice ID of 12345.
Can someone help complete the code below ?

           using com.softlayer.api;
    SoftLayer_AccountService accountService = new SoftLayer_AccountService();         
     String username = "UserName";
        String apiKey = "UserKey";

        authenticate authenticate = new authenticate();
        authenticate.username = username;
        authenticate.apiKey = apiKey;            
        accountService.authenticateValue = authenticate;

        SoftLayer_Billing_Invoice_ItemObjectFilter objFilt = new SoftLayer_Billing_Invoice_ItemObjectFilter();

    /// 
    ///

        SoftLayer_Billing_Invoice[] inv = accountService.getInvoices();
  • We are always glad to help, but you need to make an attempt yourself first. If after [doing more research](https://meta.stackoverflow.com/q/261592) you can't solve it, please post what you've tried with a clear explanation of what isn't working and provide [a Minimal, Complete, and Verifiable example](http://stackoverflow.com/help/mcve). Read the [How to Ask a good question](http://stackoverflow.com/help/how-to-ask) guide. Also, be sure to take the [tour](http://stackoverflow.com/tour) and read [this](https://meta.stackoverflow.com/q/347937). – NightOwl888 Mar 01 '18 at 06:48

1 Answers1

1

Currently there is no support for object Filters related to the C#

As a workaround you could get the same result using the getObject method from the SoftLayer_Billing_Invoice service.

Here is an example how to obtain the invoice data.

static void Main(string[] args)
{
    String username = "set me";
    String apiKey = "set me";
    int invoiceId = 123456;

    authenticate authenticate = new authenticate();
    authenticate.username = username;
    authenticate.apiKey = apiKey;

    // Initialize the SoftLayer_Account API service.
    SoftLayer_Billing_InvoiceService invoiceService = new SoftLayer_Billing_InvoiceService();
    invoiceService.authenticateValue = authenticate;

    SoftLayer_Billing_InvoiceInitParameters billingInvoiceInitParameters = new SoftLayer_Billing_InvoiceInitParameters();
    billingInvoiceInitParameters.id = invoiceId;
    invoiceService.SoftLayer_Billing_InvoiceInitParametersValue = billingInvoiceInitParameters;

    SoftLayer_Billing_Invoice result = invoiceService.getObject();
    Console.WriteLine(result);
}

For more information see here: http://sldn.softlayer.com/reference/services/SoftLayer_Billing_Invoice/getObject

F.Ojeda
  • 718
  • 1
  • 4
  • 8