Sample code for 30+ languages & platforms
C

Quickbooks Send an Invoice

See more QuickBooks Examples

Demonstrates how to send an invoice using the Quickbooks REST API.

Chilkat C Downloads

C
#include <C_CkJsonObject.h>
#include <C_CkRest.h>
#include <C_CkStringBuilder.h>

void ChilkatSample(void)
    {
    BOOL success;
    HCkJsonObject jsonToken;
    HCkRest rest;
    BOOL bTls;
    int port;
    BOOL bAutoReconnect;
    HCkStringBuilder sbAuth;
    HCkStringBuilder sbResponseBody;
    int respStatusCode;
    HCkJsonObject jsonResponse;
    const char *Description;
    const char *DetailType;
    const char *SalesItemLineDetailTaxCodeRefValue;
    int SalesItemLineDetailQty;
    int SalesItemLineDetailUnitPrice;
    const char *SalesItemLineDetailServiceDate;
    const char *SalesItemLineDetailItemRefName;
    const char *SalesItemLineDetailItemRefValue;
    int LineNum;
    const char *Amount;
    const char *Id;
    const char *DiscountLineDetailDiscountAccountRefName;
    const char *DiscountLineDetailDiscountAccountRefValue;
    BOOL DiscountLineDetailPercentBased;
    int DiscountLineDetailDiscountPercent;
    const char *TaxLineDetailNetAmountTaxable;
    int TaxLineDetailTaxPercent;
    const char *TaxLineDetailTaxRateRefValue;
    BOOL TaxLineDetailPercentBased;
    const char *StringValue;
    const char *Type;
    const char *Name;
    const char *InvoiceTxnDate;
    const char *InvoiceDomain;
    const char *InvoiceCurrencyRefName;
    const char *InvoiceCurrencyRefValue;
    const char *InvoiceShipDate;
    const char *InvoiceTrackingNum;
    const char *InvoiceClassRefName;
    const char *InvoiceClassRefValue;
    const char *InvoicePrintStatus;
    const char *InvoiceSalesTermRefValue;
    const char *InvoiceDeliveryInfoDeliveryType;
    const char *InvoiceDeliveryInfoDeliveryTime;
    const char *InvoiceTotalAmt;
    const char *InvoiceDueDate;
    const char *InvoiceMetaDataCreateTime;
    const char *InvoiceMetaDataLastUpdatedTime;
    const char *InvoiceDocNumber;
    const char *InvoicePrivateNote;
    BOOL InvoiceSparse;
    const char *InvoiceDepositToAccountRefName;
    const char *InvoiceDepositToAccountRefValue;
    const char *InvoiceCustomerMemoValue;
    const char *InvoiceEmailStatus;
    const char *InvoiceDeposit;
    const char *InvoiceBalance;
    const char *InvoiceCustomerRefName;
    const char *InvoiceCustomerRefValue;
    const char *InvoiceTxnTaxDetailTxnTaxCodeRefValue;
    const char *InvoiceTxnTaxDetailTotalTax;
    const char *InvoiceSyncToken;
    const char *InvoiceBillEmailAddress;
    const char *InvoiceShipAddrCity;
    const char *InvoiceShipAddrCountry;
    const char *InvoiceShipAddrLine5;
    const char *InvoiceShipAddrLine4;
    const char *InvoiceShipAddrLine3;
    const char *InvoiceShipAddrLine2;
    const char *InvoiceShipAddrLine1;
    const char *InvoiceShipAddrPostalCode;
    const char *InvoiceShipAddrLat;
    const char *InvoiceShipAddrLong;
    const char *InvoiceShipAddrCountrySubDivisionCode;
    const char *InvoiceShipAddrId;
    const char *InvoiceDepartmentRefName;
    const char *InvoiceDepartmentRefValue;
    const char *InvoiceShipMethodRefName;
    const char *InvoiceShipMethodRefValue;
    const char *InvoiceBillAddrCity;
    const char *InvoiceBillAddrCountry;
    const char *InvoiceBillAddrLine5;
    const char *InvoiceBillAddrLine4;
    const char *InvoiceBillAddrLine3;
    const char *InvoiceBillAddrLine2;
    const char *InvoiceBillAddrLine1;
    const char *InvoiceBillAddrPostalCode;
    const char *InvoiceBillAddrLat;
    const char *InvoiceBillAddrLong;
    const char *InvoiceBillAddrCountrySubDivisionCode;
    const char *InvoiceBillAddrId;
    BOOL InvoiceApplyTaxAfterDiscount;
    const char *InvoiceId;
    const char *time;
    int i;
    int count_i;

    success = FALSE;

    //  This example requires the Chilkat API to have been previously unlocked.
    //  See Global Unlock Sample for sample code.

    //  First get our previously obtained OAuth2 access token.
    jsonToken = CkJsonObject_Create();
    success = CkJsonObject_LoadFile(jsonToken,"qa_data/tokens/qb-access-token.json");

    rest = CkRest_Create();

    //  Connect to the REST server.
    bTls = TRUE;
    port = 443;
    bAutoReconnect = TRUE;
    success = CkRest_Connect(rest,"sandbox-quickbooks.api.intuit.com",port,bTls,bAutoReconnect);

    sbAuth = CkStringBuilder_Create();
    CkStringBuilder_Append(sbAuth,"Bearer ");
    CkStringBuilder_Append(sbAuth,CkJsonObject_stringOf(jsonToken,"access_token"));
    CkRest_putAuthorization(rest,CkStringBuilder_getAsString(sbAuth));

    //  --------------------------------------------------------------------------
    //  Note: The above code to setup the initial REST connection
    //  can be done once.  After connecting, any number of REST calls can be made.
    //  If the connection is lost, the next REST method call will automatically
    //  reconnect if needed.
    //  --------------------------------------------------------------------------

    //  Technically, the POST has an empty request body, but the Quickbooks documentation indicates that 
    //  the Content-Type header should be set to "application/octet-stream", which really makes no sense
    //  because there is not content. (How can no content have a type???)
    CkRest_AddHeader(rest,"Content-Type","application/octet-stream");
    CkRest_putAllowHeaderFolding(rest,FALSE);

    sbResponseBody = CkStringBuilder_Create();
    success = CkRest_FullRequestNoBodySb(rest,"POST","/v3/company/<realmID>/invoice/<invoiceId>/send?sendTo=<emailAddr>",sbResponseBody);
    if (success != TRUE) {
        printf("%s\n",CkRest_lastErrorText(rest));
        CkJsonObject_Dispose(jsonToken);
        CkRest_Dispose(rest);
        CkStringBuilder_Dispose(sbAuth);
        CkStringBuilder_Dispose(sbResponseBody);
        return;
    }

    respStatusCode = CkRest_getResponseStatusCode(rest);

    //  Success is indicated by a 200 response status code.
    printf("response status code = %d\n",respStatusCode);

    jsonResponse = CkJsonObject_Create();
    CkJsonObject_LoadSb(jsonResponse,sbResponseBody);
    CkJsonObject_putEmitCompact(jsonResponse,FALSE);
    printf("%s\n",CkJsonObject_emit(jsonResponse));

    if (CkRest_getResponseStatusCode(rest) != 200) {
        printf("Failed.\n");
        CkJsonObject_Dispose(jsonToken);
        CkRest_Dispose(rest);
        CkStringBuilder_Dispose(sbAuth);
        CkStringBuilder_Dispose(sbResponseBody);
        CkJsonObject_Dispose(jsonResponse);
        return;
    }

    //  Sample output...
    //  (See the parsing code below..)
    //  
    //  Use the this online tool to generate parsing code from sample JSON: 
    //  Generate Parsing Code from JSON

    //  {
    //    "Invoice": {
    //      "TxnDate": "2013-03-14",
    //      "domain": "QBO",
    //      "CurrencyRef": {
    //        "name": "United States Dollar",
    //        "value": "USD"
    //      },
    //      "ShipDate": "2013-03-01",
    //      "TrackingNum": "123456789",
    //      "ClassRef": {
    //        "name": "Class 1",
    //        "value": "200900000000000003901"
    //      },
    //      "PrintStatus": "NeedToPrint",
    //      "SalesTermRef": {
    //        "value": "4"
    //      },
    //      "DeliveryInfo": {
    //        "DeliveryType": "Email",
    //        "DeliveryTime": "2014-12-17T11:50:52-08:00"
    //      },
    //      "TotalAmt": 52.0,
    //      "Line": [
    //        {
    //          "Description": "Sample invoice create request",
    //          "DetailType": "SalesItemLineDetail",
    //          "SalesItemLineDetail": {
    //            "TaxCodeRef": {
    //              "value": "TAX"
    //            },
    //            "Qty": 1,
    //            "UnitPrice": 50,
    //            "ServiceDate": "2013-03-04",
    //            "ItemRef": {
    //              "name": "Hours",
    //              "value": "2"
    //            }
    //          },
    //          "LineNum": 1,
    //          "Amount": 50.0,
    //          "Id": "1"
    //        },
    //        {
    //          "DetailType": "SubTotalLineDetail",
    //          "Amount": 50.0,
    //          "SubTotalLineDetail": {}
    //        },
    //        {
    //          "DetailType": "DiscountLineDetail",
    //          "Amount": 5.0,
    //          "DiscountLineDetail": {
    //            "DiscountAccountRef": {
    //              "name": "Discounts given",
    //              "value": "30"
    //            },
    //            "PercentBased": true,
    //            "DiscountPercent": 10
    //          }
    //        },
    //        {
    //          "DetailType": "SalesItemLineDetail",
    //          "Amount": 2.0,
    //          "SalesItemLineDetail": {
    //            "ItemRef": {
    //              "value": "SHIPPING_ITEM_ID"
    //            }
    //          }
    //        }
    //      ],
    //      "DueDate": "2013-05-13",
    //      "MetaData": {
    //        "CreateTime": "2013-03-14T01:42:16-07:00",
    //        "LastUpdatedTime": "2014-12-17T11:50:58-08:00"
    //      },
    //      "DocNumber": "Sample_Inv#2",
    //      "PrivateNote": "Summary for sample invoice",
    //      "sparse": false,
    //      "DepositToAccountRef": {
    //        "name": "Undeposited Funds",
    //        "value": "4"
    //      },
    //      "CustomerMemo": {
    //        "value": "This is the customer message"
    //      },
    //      "EmailStatus": "EmailSent",
    //      "Deposit": 12.0,
    //      "Balance": 40.0,
    //      "CustomerRef": {
    //        "name": "Mr V3 Service Customer Jr2",
    //        "value": "15"
    //      },
    //      "TxnTaxDetail": {
    //        "TxnTaxCodeRef": {
    //          "value": "5"
    //        },
    //        "TotalTax": 5.0,
    //        "TaxLine": [
    //          {
    //            "DetailType": "TaxLineDetail",
    //            "Amount": 5.0,
    //            "TaxLineDetail": {
    //              "NetAmountTaxable": 50.0,
    //              "TaxPercent": 10,
    //              "TaxRateRef": {
    //                "value": "2"
    //              },
    //              "PercentBased": true
    //            }
    //          }
    //        ]
    //      },
    //      "SyncToken": "0",
    //      "BillEmail": {
    //        "Address": "test@intuit.com"
    //      },
    //      "ShipAddr": {
    //        "City": "San Jose",
    //        "Country": "USA",
    //        "Line5": "Cube 999",
    //        "Line4": "Dept 12",
    //        "Line3": "123 street",
    //        "Line2": "Building 1",
    //        "Line1": "Intuit",
    //        "PostalCode": "95123",
    //        "Lat": "37.2374847",
    //        "Long": "-121.8277925",
    //        "CountrySubDivisionCode": "CA",
    //        "Id": "36"
    //      },
    //      "DepartmentRef": {
    //        "name": "Mountain View",
    //        "value": "1"
    //      },
    //      "ShipMethodRef": {
    //        "name": "UPS",
    //        "value": "UPS"
    //      },
    //      "BillAddr": {
    //        "City": "Mountain View",
    //        "Country": "USA",
    //        "Line5": "Cube 999",
    //        "Line4": "Dept 12",
    //        "Line3": "123 street",
    //        "Line2": "Building 1",
    //        "Line1": "Google",
    //        "PostalCode": "95123",
    //        "Lat": "37.2374847",
    //        "Long": "-121.8277925",
    //        "CountrySubDivisionCode": "CA",
    //        "Id": "35"
    //      },
    //      "ApplyTaxAfterDiscount": false,
    //      "CustomField": [
    //        {
    //          "StringValue": "Custom1",
    //          "Type": "StringType",
    //          "Name": "Custom 1"
    //        },
    //        {
    //          "StringValue": "Custom2",
    //          "Type": "StringType",
    //          "Name": "Custom 2"
    //        },
    //        {
    //          "StringValue": "Custom3",
    //          "Type": "StringType",
    //          "Name": "Custom 3"
    //        }
    //      ],
    //      "Id": "96"
    //    },
    //    "time": "2013-03-14T13:32:04.895-07:00"
    //  }
    //  

    //  Chilkat functions returning "const char *" return a pointer to temporary internal memory owned and managed by Chilkat.
    //  See this example explaining how this memory should be used: const char * functions.

    InvoiceTxnDate = CkJsonObject_stringOf(jsonResponse,"Invoice.TxnDate");
    InvoiceDomain = CkJsonObject_stringOf(jsonResponse,"Invoice.domain");
    InvoiceCurrencyRefName = CkJsonObject_stringOf(jsonResponse,"Invoice.CurrencyRef.name");
    InvoiceCurrencyRefValue = CkJsonObject_stringOf(jsonResponse,"Invoice.CurrencyRef.value");
    InvoiceShipDate = CkJsonObject_stringOf(jsonResponse,"Invoice.ShipDate");
    InvoiceTrackingNum = CkJsonObject_stringOf(jsonResponse,"Invoice.TrackingNum");
    InvoiceClassRefName = CkJsonObject_stringOf(jsonResponse,"Invoice.ClassRef.name");
    InvoiceClassRefValue = CkJsonObject_stringOf(jsonResponse,"Invoice.ClassRef.value");
    InvoicePrintStatus = CkJsonObject_stringOf(jsonResponse,"Invoice.PrintStatus");
    InvoiceSalesTermRefValue = CkJsonObject_stringOf(jsonResponse,"Invoice.SalesTermRef.value");
    InvoiceDeliveryInfoDeliveryType = CkJsonObject_stringOf(jsonResponse,"Invoice.DeliveryInfo.DeliveryType");
    InvoiceDeliveryInfoDeliveryTime = CkJsonObject_stringOf(jsonResponse,"Invoice.DeliveryInfo.DeliveryTime");
    InvoiceTotalAmt = CkJsonObject_stringOf(jsonResponse,"Invoice.TotalAmt");
    InvoiceDueDate = CkJsonObject_stringOf(jsonResponse,"Invoice.DueDate");
    InvoiceMetaDataCreateTime = CkJsonObject_stringOf(jsonResponse,"Invoice.MetaData.CreateTime");
    InvoiceMetaDataLastUpdatedTime = CkJsonObject_stringOf(jsonResponse,"Invoice.MetaData.LastUpdatedTime");
    InvoiceDocNumber = CkJsonObject_stringOf(jsonResponse,"Invoice.DocNumber");
    InvoicePrivateNote = CkJsonObject_stringOf(jsonResponse,"Invoice.PrivateNote");
    InvoiceSparse = CkJsonObject_BoolOf(jsonResponse,"Invoice.sparse");
    InvoiceDepositToAccountRefName = CkJsonObject_stringOf(jsonResponse,"Invoice.DepositToAccountRef.name");
    InvoiceDepositToAccountRefValue = CkJsonObject_stringOf(jsonResponse,"Invoice.DepositToAccountRef.value");
    InvoiceCustomerMemoValue = CkJsonObject_stringOf(jsonResponse,"Invoice.CustomerMemo.value");
    InvoiceEmailStatus = CkJsonObject_stringOf(jsonResponse,"Invoice.EmailStatus");
    InvoiceDeposit = CkJsonObject_stringOf(jsonResponse,"Invoice.Deposit");
    InvoiceBalance = CkJsonObject_stringOf(jsonResponse,"Invoice.Balance");
    InvoiceCustomerRefName = CkJsonObject_stringOf(jsonResponse,"Invoice.CustomerRef.name");
    InvoiceCustomerRefValue = CkJsonObject_stringOf(jsonResponse,"Invoice.CustomerRef.value");
    InvoiceTxnTaxDetailTxnTaxCodeRefValue = CkJsonObject_stringOf(jsonResponse,"Invoice.TxnTaxDetail.TxnTaxCodeRef.value");
    InvoiceTxnTaxDetailTotalTax = CkJsonObject_stringOf(jsonResponse,"Invoice.TxnTaxDetail.TotalTax");
    InvoiceSyncToken = CkJsonObject_stringOf(jsonResponse,"Invoice.SyncToken");
    InvoiceBillEmailAddress = CkJsonObject_stringOf(jsonResponse,"Invoice.BillEmail.Address");
    InvoiceShipAddrCity = CkJsonObject_stringOf(jsonResponse,"Invoice.ShipAddr.City");
    InvoiceShipAddrCountry = CkJsonObject_stringOf(jsonResponse,"Invoice.ShipAddr.Country");
    InvoiceShipAddrLine5 = CkJsonObject_stringOf(jsonResponse,"Invoice.ShipAddr.Line5");
    InvoiceShipAddrLine4 = CkJsonObject_stringOf(jsonResponse,"Invoice.ShipAddr.Line4");
    InvoiceShipAddrLine3 = CkJsonObject_stringOf(jsonResponse,"Invoice.ShipAddr.Line3");
    InvoiceShipAddrLine2 = CkJsonObject_stringOf(jsonResponse,"Invoice.ShipAddr.Line2");
    InvoiceShipAddrLine1 = CkJsonObject_stringOf(jsonResponse,"Invoice.ShipAddr.Line1");
    InvoiceShipAddrPostalCode = CkJsonObject_stringOf(jsonResponse,"Invoice.ShipAddr.PostalCode");
    InvoiceShipAddrLat = CkJsonObject_stringOf(jsonResponse,"Invoice.ShipAddr.Lat");
    InvoiceShipAddrLong = CkJsonObject_stringOf(jsonResponse,"Invoice.ShipAddr.Long");
    InvoiceShipAddrCountrySubDivisionCode = CkJsonObject_stringOf(jsonResponse,"Invoice.ShipAddr.CountrySubDivisionCode");
    InvoiceShipAddrId = CkJsonObject_stringOf(jsonResponse,"Invoice.ShipAddr.Id");
    InvoiceDepartmentRefName = CkJsonObject_stringOf(jsonResponse,"Invoice.DepartmentRef.name");
    InvoiceDepartmentRefValue = CkJsonObject_stringOf(jsonResponse,"Invoice.DepartmentRef.value");
    InvoiceShipMethodRefName = CkJsonObject_stringOf(jsonResponse,"Invoice.ShipMethodRef.name");
    InvoiceShipMethodRefValue = CkJsonObject_stringOf(jsonResponse,"Invoice.ShipMethodRef.value");
    InvoiceBillAddrCity = CkJsonObject_stringOf(jsonResponse,"Invoice.BillAddr.City");
    InvoiceBillAddrCountry = CkJsonObject_stringOf(jsonResponse,"Invoice.BillAddr.Country");
    InvoiceBillAddrLine5 = CkJsonObject_stringOf(jsonResponse,"Invoice.BillAddr.Line5");
    InvoiceBillAddrLine4 = CkJsonObject_stringOf(jsonResponse,"Invoice.BillAddr.Line4");
    InvoiceBillAddrLine3 = CkJsonObject_stringOf(jsonResponse,"Invoice.BillAddr.Line3");
    InvoiceBillAddrLine2 = CkJsonObject_stringOf(jsonResponse,"Invoice.BillAddr.Line2");
    InvoiceBillAddrLine1 = CkJsonObject_stringOf(jsonResponse,"Invoice.BillAddr.Line1");
    InvoiceBillAddrPostalCode = CkJsonObject_stringOf(jsonResponse,"Invoice.BillAddr.PostalCode");
    InvoiceBillAddrLat = CkJsonObject_stringOf(jsonResponse,"Invoice.BillAddr.Lat");
    InvoiceBillAddrLong = CkJsonObject_stringOf(jsonResponse,"Invoice.BillAddr.Long");
    InvoiceBillAddrCountrySubDivisionCode = CkJsonObject_stringOf(jsonResponse,"Invoice.BillAddr.CountrySubDivisionCode");
    InvoiceBillAddrId = CkJsonObject_stringOf(jsonResponse,"Invoice.BillAddr.Id");
    InvoiceApplyTaxAfterDiscount = CkJsonObject_BoolOf(jsonResponse,"Invoice.ApplyTaxAfterDiscount");
    InvoiceId = CkJsonObject_stringOf(jsonResponse,"Invoice.Id");
    time = CkJsonObject_stringOf(jsonResponse,"time");
    i = 0;
    count_i = CkJsonObject_SizeOfArray(jsonResponse,"Invoice.Line");
    while (i < count_i) {
        CkJsonObject_putI(jsonResponse,i);
        Description = CkJsonObject_stringOf(jsonResponse,"Invoice.Line[i].Description");
        DetailType = CkJsonObject_stringOf(jsonResponse,"Invoice.Line[i].DetailType");
        SalesItemLineDetailTaxCodeRefValue = CkJsonObject_stringOf(jsonResponse,"Invoice.Line[i].SalesItemLineDetail.TaxCodeRef.value");
        SalesItemLineDetailQty = CkJsonObject_IntOf(jsonResponse,"Invoice.Line[i].SalesItemLineDetail.Qty");
        SalesItemLineDetailUnitPrice = CkJsonObject_IntOf(jsonResponse,"Invoice.Line[i].SalesItemLineDetail.UnitPrice");
        SalesItemLineDetailServiceDate = CkJsonObject_stringOf(jsonResponse,"Invoice.Line[i].SalesItemLineDetail.ServiceDate");
        SalesItemLineDetailItemRefName = CkJsonObject_stringOf(jsonResponse,"Invoice.Line[i].SalesItemLineDetail.ItemRef.name");
        SalesItemLineDetailItemRefValue = CkJsonObject_stringOf(jsonResponse,"Invoice.Line[i].SalesItemLineDetail.ItemRef.value");
        LineNum = CkJsonObject_IntOf(jsonResponse,"Invoice.Line[i].LineNum");
        Amount = CkJsonObject_stringOf(jsonResponse,"Invoice.Line[i].Amount");
        Id = CkJsonObject_stringOf(jsonResponse,"Invoice.Line[i].Id");
        DiscountLineDetailDiscountAccountRefName = CkJsonObject_stringOf(jsonResponse,"Invoice.Line[i].DiscountLineDetail.DiscountAccountRef.name");
        DiscountLineDetailDiscountAccountRefValue = CkJsonObject_stringOf(jsonResponse,"Invoice.Line[i].DiscountLineDetail.DiscountAccountRef.value");
        DiscountLineDetailPercentBased = CkJsonObject_BoolOf(jsonResponse,"Invoice.Line[i].DiscountLineDetail.PercentBased");
        DiscountLineDetailDiscountPercent = CkJsonObject_IntOf(jsonResponse,"Invoice.Line[i].DiscountLineDetail.DiscountPercent");
        i = i + 1;
    }

    i = 0;
    count_i = CkJsonObject_SizeOfArray(jsonResponse,"Invoice.TxnTaxDetail.TaxLine");
    while (i < count_i) {
        CkJsonObject_putI(jsonResponse,i);
        DetailType = CkJsonObject_stringOf(jsonResponse,"Invoice.TxnTaxDetail.TaxLine[i].DetailType");
        Amount = CkJsonObject_stringOf(jsonResponse,"Invoice.TxnTaxDetail.TaxLine[i].Amount");
        TaxLineDetailNetAmountTaxable = CkJsonObject_stringOf(jsonResponse,"Invoice.TxnTaxDetail.TaxLine[i].TaxLineDetail.NetAmountTaxable");
        TaxLineDetailTaxPercent = CkJsonObject_IntOf(jsonResponse,"Invoice.TxnTaxDetail.TaxLine[i].TaxLineDetail.TaxPercent");
        TaxLineDetailTaxRateRefValue = CkJsonObject_stringOf(jsonResponse,"Invoice.TxnTaxDetail.TaxLine[i].TaxLineDetail.TaxRateRef.value");
        TaxLineDetailPercentBased = CkJsonObject_BoolOf(jsonResponse,"Invoice.TxnTaxDetail.TaxLine[i].TaxLineDetail.PercentBased");
        i = i + 1;
    }

    i = 0;
    count_i = CkJsonObject_SizeOfArray(jsonResponse,"Invoice.CustomField");
    while (i < count_i) {
        CkJsonObject_putI(jsonResponse,i);
        StringValue = CkJsonObject_stringOf(jsonResponse,"Invoice.CustomField[i].StringValue");
        Type = CkJsonObject_stringOf(jsonResponse,"Invoice.CustomField[i].Type");
        Name = CkJsonObject_stringOf(jsonResponse,"Invoice.CustomField[i].Name");
        i = i + 1;
    }



    CkJsonObject_Dispose(jsonToken);
    CkRest_Dispose(rest);
    CkStringBuilder_Dispose(sbAuth);
    CkStringBuilder_Dispose(sbResponseBody);
    CkJsonObject_Dispose(jsonResponse);

    }