Question

I am having trouble simply creating a Bill using the .NET C# SDK.

I am getting an exception that indicates that I am not supplying a required parameter.

So I went to the IPP online documentation here: https://developer.intuit.com/docs/0025_quickbooksapi/0050_data_services/030_entity_services_reference/bill

Using their example XML, which is as follows:

<Bill xmlns="http://schema.intuit.com/finance/v3" >
    <Line>
        <Id>1</Id>
        <Amount>700.00</Amount>
        <DetailType>AccountBasedExpenseLineDetail</DetailType>
        <AccountBasedExpenseLineDetail>
            <AccountRef>75</AccountRef>
        </AccountBasedExpenseLineDetail>
    </Line>
    <VendorRef>81</VendorRef>
</Bill>

I have converted this (changing some values only) to the following c# code, please assume that my Data Service is valid (which it is):

        var bill = new Bill
            {
                Line = new[]
                    {
                        new Line
                            {
                                Id = "1",
                                Amount = (decimal) 700.00,
                                DetailType = LineDetailTypeEnum.AccountBasedExpenseLineDetail,
                                AnyIntuitObject = new AccountBasedExpenseLineDetail
                                    {
                                        AccountRef = new ReferenceType
                                            {
                                                Value = "90"
                                            }
                                    }
                            }
                    },
                    VendorRef = new ReferenceType
                        {
                            Value = "7"
                        }
            };
        Bill resultBill = IppDataService.Add(bill) as Bill;
        return resultBill;

However, this code throws an exception on the Data Service Add method. Top Level is "IdsExcption: Bad Request". Inner Exception is "ValidationException", and inner exception to that is "IdsError: Required param missing, need to supply the required value for the API".

Since I am using Intuit's example, I'm not sure what parameter(s) I might be missing -- although perhaps I am translating incorrectly from the XML to the SDK object.

Any thoughts here? And any further notion of where the documentation is that stated definitively for a given API call, what parameters are required for Add?

Much appreciated.

Was it helpful?

Solution

I need to understand first- Is this for a US company or a Global?

I would suggest you to log the request/response xml to check what is getting generated with the code you have. https://developer.intuit.com/docs/0025_quickbooksapi/0055_devkits/0150_ipp_.net_devkit_3.0

There are some properties which end 'specified' for any entity and unless you set them to true(boolean), they would not not generate the xml tag for you. This can cause your request to fail. Eg: billLine.Amount = 100m; billLine.AmountSpecified = true;

Also, You can create a Bill in your QBO UI and read the xml using API explorer-

https://developer.intuit.com/apiexplorer?apiname=V3QBO compare with what you are sending to understand the error.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top