Sample code for 30+ languages & platforms
Unicode C

UPS Rate Request

See more UPS Examples

Simple UPS Rate Example

Chilkat Unicode C Downloads

Unicode C
#include <C_CkHttpW.h>
#include <C_CkJsonObjectW.h>
#include <C_CkHttpResponseW.h>
#include <C_CkStringBuilderW.h>

void ChilkatSample(void)
    {
    BOOL success;
    HCkHttpW http;
    HCkJsonObjectW json;
    HCkJsonObjectW jsonToken;
    HCkHttpResponseW resp;
    HCkStringBuilderW sbResponseBody;
    HCkJsonObjectW jResp;
    int respStatusCode;
    const wchar_t *Level;
    int j;
    int count_j;
    const wchar_t *Value;
    const wchar_t *ServiceCode;
    const wchar_t *ServiceDescription;
    const wchar_t *RateChart;
    const wchar_t *BillableWeightCalculationMethod;
    const wchar_t *RatingMethod;
    const wchar_t *UnitOfMeasurementCode;
    const wchar_t *UnitOfMeasurementDescription;
    const wchar_t *Weight;
    const wchar_t *CurrencyCode;
    const wchar_t *MonetaryValue;
    const wchar_t *BaseServiceChargeCurrencyCode;
    const wchar_t *BaseServiceChargeMonetaryValue;
    const wchar_t *GrossChargeCurrencyCode;
    const wchar_t *GrossChargeMonetaryValue;
    const wchar_t *DiscountAmountCurrencyCode;
    const wchar_t *DiscountAmountMonetaryValue;
    const wchar_t *DiscountPercentage;
    const wchar_t *NetChargeCurrencyCode;
    const wchar_t *NetChargeMonetaryValue;
    const wchar_t *Density;
    const wchar_t *TotalCubicFeet;
    const wchar_t *ServiceOptionsChargesCurrencyCode;
    const wchar_t *ServiceOptionsChargesMonetaryValue;
    const wchar_t *TotalChargesCurrencyCode;
    const wchar_t *TotalChargesMonetaryValue;
    const wchar_t *TotalChargesWithTaxesCurrencyCode;
    const wchar_t *TotalChargesWithTaxesMonetaryValue;
    const wchar_t *TotalChargeCurrencyCode;
    const wchar_t *TotalChargeMonetaryValue;
    const wchar_t *PickupDate;
    const wchar_t *DocumentsOnlyIndicator;
    const wchar_t *PackageBillType;
    const wchar_t *GuaranteedIndicator;
    const wchar_t *Disclaimer;
    const wchar_t *Date;
    const wchar_t *Time;
    const wchar_t *BusinessDaysInTransit;
    const wchar_t *PickupTime;
    const wchar_t *DayOfWeek;
    const wchar_t *CustomerCenterCutoff;
    const wchar_t *DelayCount;
    const wchar_t *HolidayCount;
    const wchar_t *RestDays;
    const wchar_t *TotalTransitDays;
    const wchar_t *SaturdayDelivery;
    const wchar_t *SaturdayDeliveryDisclaimer;
    const wchar_t *SundayDelivery;
    const wchar_t *SundayDeliveryDisclaimer;
    const wchar_t *AutoDutyCode;
    const wchar_t *TimeInTransitDisclaimer;
    const wchar_t *ScheduledDeliveryDate;
    const wchar_t *RoarRatedIndicator;
    const wchar_t *SubType;
    const wchar_t *Quantity;
    const wchar_t *TypeCode;
    const wchar_t *TypeDescription;
    const wchar_t *UnitOfMeasurement;
    const wchar_t *Length;
    const wchar_t *Width;
    const wchar_t *Height;
    const wchar_t *AdjustedHeightValue;
    const wchar_t *AdjustedHeightUnitOfMeasurement;
    const wchar_t *v_Type;
    const wchar_t *TransportationChargesCurrencyCode;
    const wchar_t *TransportationChargesMonetaryValue;
    const wchar_t *BillingWeightWeight;
    const wchar_t *SimpleRateCode;
    int k;
    int count_k;
    BOOL nullVal;
    const wchar_t *ModifierType;
    const wchar_t *ModifierDesc;
    const wchar_t *Amount;
    const wchar_t *Code;
    const wchar_t *Description;
    const wchar_t *CustomerContext;
    int i;
    int count_i;

    success = FALSE;

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

    http = CkHttpW_Create();

    // Use this online tool to generate code from sample JSON:
    // Generate Code to Create JSON

    // The following JSON is sent in the request body.

    // {
    //   "RateRequest": {
    //     "Request": {
    //       "TransactionReference": {
    //         "CustomerContext": "CustomerContext"
    //       }
    //     },
    //     "Shipment": {
    //       "Shipper": {
    //         "Name": "ShipperName",
    //         "ShipperNumber": "ShipperNumber",
    //         "Address": {
    //           "AddressLine": [
    //             "ShipperAddressLine",
    //             "ShipperAddressLine",
    //             "ShipperAddressLine"
    //           ],
    //           "City": "TIMONIUM",
    //           "StateProvinceCode": "MD",
    //           "PostalCode": "21093",
    //           "CountryCode": "US"
    //         }
    //       },
    //       "ShipTo": {
    //         "Name": "ShipToName",
    //         "Address": {
    //           "AddressLine": [
    //             "ShipToAddressLine",
    //             "ShipToAddressLine",
    //             "ShipToAddressLine"
    //           ],
    //           "City": "Alpharetta",
    //           "StateProvinceCode": "GA",
    //           "PostalCode": "30005",
    //           "CountryCode": "US"
    //         }
    //       },
    //       "ShipFrom": {
    //         "Name": "ShipFromName",
    //         "Address": {
    //           "AddressLine": [
    //             "ShipFromAddressLine",
    //             "ShipFromAddressLine",
    //             "ShipFromAddressLine"
    //           ],
    //           "City": "TIMONIUM",
    //           "StateProvinceCode": "MD",
    //           "PostalCode": "21093",
    //           "CountryCode": "US"
    //         }
    //       },
    //       "PaymentDetails": {
    //         "ShipmentCharge": {
    //           "Type": "01",
    //           "BillShipper": {
    //             "AccountNumber": "ShipperNumber"
    //           }
    //         }
    //       },
    //       "Service": {
    //         "Code": "03",
    //         "Description": "Ground"
    //       },
    //       "NumOfPieces": "1",
    //       "Package": {
    //         "PackagingType": {
    //           "Code": "02",
    //           "Description": "Packaging"
    //         },
    //         "Dimensions": {
    //           "UnitOfMeasurement": {
    //             "Code": "IN",
    //             "Description": "Inches"
    //           },
    //           "Length": "5",
    //           "Width": "5",
    //           "Height": "5"
    //         },
    //         "PackageWeight": {
    //           "UnitOfMeasurement": {
    //             "Code": "LBS",
    //             "Description": "Pounds"
    //           },
    //           "Weight": "1"
    //         }
    //       }
    //     }
    //   }
    // }

    json = CkJsonObjectW_Create();
    CkJsonObjectW_UpdateString(json,L"RateRequest.Request.TransactionReference.CustomerContext",L"CustomerContext");
    CkJsonObjectW_UpdateString(json,L"RateRequest.Shipment.Shipper.Name",L"ShipperName");
    CkJsonObjectW_UpdateString(json,L"RateRequest.Shipment.Shipper.ShipperNumber",L"ShipperNumber");
    CkJsonObjectW_UpdateString(json,L"RateRequest.Shipment.Shipper.Address.AddressLine[0]",L"ShipperAddressLine");
    CkJsonObjectW_UpdateString(json,L"RateRequest.Shipment.Shipper.Address.AddressLine[1]",L"ShipperAddressLine");
    CkJsonObjectW_UpdateString(json,L"RateRequest.Shipment.Shipper.Address.AddressLine[2]",L"ShipperAddressLine");
    CkJsonObjectW_UpdateString(json,L"RateRequest.Shipment.Shipper.Address.City",L"TIMONIUM");
    CkJsonObjectW_UpdateString(json,L"RateRequest.Shipment.Shipper.Address.StateProvinceCode",L"MD");
    CkJsonObjectW_UpdateString(json,L"RateRequest.Shipment.Shipper.Address.PostalCode",L"21093");
    CkJsonObjectW_UpdateString(json,L"RateRequest.Shipment.Shipper.Address.CountryCode",L"US");
    CkJsonObjectW_UpdateString(json,L"RateRequest.Shipment.ShipTo.Name",L"ShipToName");
    CkJsonObjectW_UpdateString(json,L"RateRequest.Shipment.ShipTo.Address.AddressLine[0]",L"ShipToAddressLine");
    CkJsonObjectW_UpdateString(json,L"RateRequest.Shipment.ShipTo.Address.AddressLine[1]",L"ShipToAddressLine");
    CkJsonObjectW_UpdateString(json,L"RateRequest.Shipment.ShipTo.Address.AddressLine[2]",L"ShipToAddressLine");
    CkJsonObjectW_UpdateString(json,L"RateRequest.Shipment.ShipTo.Address.City",L"Alpharetta");
    CkJsonObjectW_UpdateString(json,L"RateRequest.Shipment.ShipTo.Address.StateProvinceCode",L"GA");
    CkJsonObjectW_UpdateString(json,L"RateRequest.Shipment.ShipTo.Address.PostalCode",L"30005");
    CkJsonObjectW_UpdateString(json,L"RateRequest.Shipment.ShipTo.Address.CountryCode",L"US");
    CkJsonObjectW_UpdateString(json,L"RateRequest.Shipment.ShipFrom.Name",L"ShipFromName");
    CkJsonObjectW_UpdateString(json,L"RateRequest.Shipment.ShipFrom.Address.AddressLine[0]",L"ShipFromAddressLine");
    CkJsonObjectW_UpdateString(json,L"RateRequest.Shipment.ShipFrom.Address.AddressLine[1]",L"ShipFromAddressLine");
    CkJsonObjectW_UpdateString(json,L"RateRequest.Shipment.ShipFrom.Address.AddressLine[2]",L"ShipFromAddressLine");
    CkJsonObjectW_UpdateString(json,L"RateRequest.Shipment.ShipFrom.Address.City",L"TIMONIUM");
    CkJsonObjectW_UpdateString(json,L"RateRequest.Shipment.ShipFrom.Address.StateProvinceCode",L"MD");
    CkJsonObjectW_UpdateString(json,L"RateRequest.Shipment.ShipFrom.Address.PostalCode",L"21093");
    CkJsonObjectW_UpdateString(json,L"RateRequest.Shipment.ShipFrom.Address.CountryCode",L"US");
    CkJsonObjectW_UpdateString(json,L"RateRequest.Shipment.PaymentDetails.ShipmentCharge.Type",L"01");
    CkJsonObjectW_UpdateString(json,L"RateRequest.Shipment.PaymentDetails.ShipmentCharge.BillShipper.AccountNumber",L"ShipperNumber");
    CkJsonObjectW_UpdateString(json,L"RateRequest.Shipment.Service.Code",L"03");
    CkJsonObjectW_UpdateString(json,L"RateRequest.Shipment.Service.Description",L"Ground");
    CkJsonObjectW_UpdateString(json,L"RateRequest.Shipment.NumOfPieces",L"1");
    CkJsonObjectW_UpdateString(json,L"RateRequest.Shipment.Package.PackagingType.Code",L"02");
    CkJsonObjectW_UpdateString(json,L"RateRequest.Shipment.Package.PackagingType.Description",L"Packaging");
    CkJsonObjectW_UpdateString(json,L"RateRequest.Shipment.Package.Dimensions.UnitOfMeasurement.Code",L"IN");
    CkJsonObjectW_UpdateString(json,L"RateRequest.Shipment.Package.Dimensions.UnitOfMeasurement.Description",L"Inches");
    CkJsonObjectW_UpdateString(json,L"RateRequest.Shipment.Package.Dimensions.Length",L"5");
    CkJsonObjectW_UpdateString(json,L"RateRequest.Shipment.Package.Dimensions.Width",L"5");
    CkJsonObjectW_UpdateString(json,L"RateRequest.Shipment.Package.Dimensions.Height",L"5");
    CkJsonObjectW_UpdateString(json,L"RateRequest.Shipment.Package.PackageWeight.UnitOfMeasurement.Code",L"LBS");
    CkJsonObjectW_UpdateString(json,L"RateRequest.Shipment.Package.PackageWeight.UnitOfMeasurement.Description",L"Pounds");
    CkJsonObjectW_UpdateString(json,L"RateRequest.Shipment.Package.PackageWeight.Weight",L"1");

    // Load the OAuth2 access token obtained via client credentials as shown 
    // in this UPS OAuth2 Client Credentials example.

    jsonToken = CkJsonObjectW_Create();
    success = CkJsonObjectW_LoadFile(jsonToken,L"qa_data/tokens/ups_oauth2_token.json");
    if (success != TRUE) {
        wprintf(L"Failed to load ups_oauth2_token.json\n");
        CkHttpW_Dispose(http);
        CkJsonObjectW_Dispose(json);
        CkJsonObjectW_Dispose(jsonToken);
        return;
    }

    // The access token JSON looks something like this:

    // {
    //   "token_type": "Bearer",
    //   "issued_at": "1686911985606",
    //   "client_id": "2498righ8wr6aihe98rt8rhowirtyw9er6twe80rtywrehrt",
    //   "access_token": "eyJraW......R2sbqrY",
    //   "expires_in": "14399",
    //   "status": "approved"
    // }

    // Adds the "Authorization: Bearer <YOUR_TOKEN_HERE>" header.
    CkHttpW_putAuthToken(http,CkJsonObjectW_stringOf(jsonToken,L"access_token"));
    CkHttpW_SetRequestHeader(http,L"Content-Type",L"application/json");
    CkHttpW_SetRequestHeader(http,L"transId",L"string");
    CkHttpW_SetRequestHeader(http,L"transactionSrc",L"testing");

    // The "version" indicates Rate API to display the new release features in Rate API response based on Rate release.
    // Supported values: v1, v1601, v1607, v1701, v1707, v2108, v2205.
    CkHttpW_SetUrlVar(http,L"version",L"v1");

    // The "requestoption" has the following valid values:
    // Rate = The server rates (The default Request option is Rate if a Request Option is not provided). 
    // Shop = The server validates the shipment, and returns rates for all UPS products from the ShipFrom to the ShipTo addresses. 
    // Rate is the only valid request option for Ground Freight Pricing requests.
    CkHttpW_SetUrlVar(http,L"requestoption",L"Rate");

    resp = CkHttpResponseW_Create();
    success = CkHttpW_HttpJson(http,L"POST",L"https://wwwcie.ups.com/api/rating/{$version}/{$requestoption}?additionalinfo=string",json,L"application/json",resp);
    if (success == FALSE) {
        wprintf(L"%s\n",CkHttpW_lastErrorText(http));
        CkHttpW_Dispose(http);
        CkJsonObjectW_Dispose(json);
        CkJsonObjectW_Dispose(jsonToken);
        CkHttpResponseW_Dispose(resp);
        return;
    }

    sbResponseBody = CkStringBuilderW_Create();
    CkHttpResponseW_GetBodySb(resp,sbResponseBody);

    jResp = CkJsonObjectW_Create();
    CkJsonObjectW_LoadSb(jResp,sbResponseBody);
    CkJsonObjectW_putEmitCompact(jResp,FALSE);

    wprintf(L"Response Body:\n");
    wprintf(L"%s\n",CkJsonObjectW_emit(jResp));

    // ----------------------------------------------------------------------------------------------------------
    // Important: If you get the following error response, read further for the solution..
    // 
    // {
    //   "response": {
    //     "errors": [
    //       {
    //         "code": "250002",
    //         "message": "Invalid Authentication Information."
    //       }
    //     ]
    //   }
    // }
    // 
    // It means you didn't add the Rating API permission to your app.
    // To add the Rating API, login to your developer account and go to your Apps page at https://developer.ups.com/apps?loc=en_US
    // Then edit your app and add the Rating API.
    // ----------------------------------------------------------------------------------------------------------

    respStatusCode = CkHttpResponseW_getStatusCode(resp);
    wprintf(L"Response Status Code = %d\n",respStatusCode);
    if (respStatusCode >= 400) {
        wprintf(L"Response Header:\n");
        wprintf(L"%s\n",CkHttpResponseW_header(resp));
        wprintf(L"Failed.\n");
        CkHttpW_Dispose(http);
        CkJsonObjectW_Dispose(json);
        CkJsonObjectW_Dispose(jsonToken);
        CkHttpResponseW_Dispose(resp);
        CkStringBuilderW_Dispose(sbResponseBody);
        CkJsonObjectW_Dispose(jResp);
        return;
    }

    // Sample JSON response:
    // (Sample code for parsing the JSON response is shown below)

    // {
    //   "RateResponse": {
    //     "Response": {
    //       "ResponseStatus": {
    //         "Code": "s",
    //         "Description": "string"
    //       },
    //       "Alert": [
    //         {
    //           "Code": "string",
    //           "Description": "string"
    //         }
    //       ],
    //       "AlertDetail": [
    //         {
    //           "Code": "string",
    //           "Description": "string",
    //           "ElementLevelInformation": {
    //             "Level": "s",
    //             "ElementIdentifier": [
    //               {
    //                 "Code": null,
    //                 "Value": null
    //               }
    //             ]
    //           }
    //         }
    //       ],
    //       "TransactionReference": {
    //         "CustomerContext": "string"
    //       }
    //     },
    //     "RatedShipment": [
    //       {
    //         "Disclaimer": [
    //           {
    //             "Code": "st",
    //             "Description": "string"
    //           }
    //         ],
    //         "Service": {
    //           "Code": "str",
    //           "Description": "string"
    //         },
    //         "RateChart": "s",
    //         "RatedShipmentAlert": [
    //           {
    //             "Code": "string",
    //             "Description": "string"
    //           }
    //         ],
    //         "BillableWeightCalculationMethod": "st",
    //         "RatingMethod": "st",
    //         "BillingWeight": {
    //           "UnitOfMeasurement": {
    //             "Code": "str",
    //             "Description": "string"
    //           },
    //           "Weight": "strin"
    //         },
    //         "TransportationCharges": {
    //           "CurrencyCode": "str",
    //           "MonetaryValue": "stringstringstri"
    //         },
    //         "BaseServiceCharge": {
    //           "CurrencyCode": "str",
    //           "MonetaryValue": "stringstringstri"
    //         },
    //         "ItemizedCharges": [
    //           {
    //             "Code": "str",
    //             "Description": "string",
    //             "CurrencyCode": "str",
    //             "MonetaryValue": "string",
    //             "SubType": "string"
    //           }
    //         ],
    //         "FRSShipmentData": {
    //           "TransportationCharges": {
    //             "GrossCharge": {
    //               "CurrencyCode": "str",
    //               "MonetaryValue": "string"
    //             },
    //             "DiscountAmount": {
    //               "CurrencyCode": "str",
    //               "MonetaryValue": "string"
    //             },
    //             "DiscountPercentage": "st",
    //             "NetCharge": {
    //               "CurrencyCode": "str",
    //               "MonetaryValue": "string"
    //             }
    //           },
    //           "FreightDensityRate": {
    //             "Density": "strin",
    //             "TotalCubicFeet": "string"
    //           },
    //           "HandlingUnits": [
    //             {
    //               "Quantity": "string",
    //               "Type": {
    //                 "Code": null,
    //                 "Description": null
    //               },
    //               "Dimensions": {
    //                 "UnitOfMeasurement": null,
    //                 "Length": null,
    //                 "Width": null,
    //                 "Height": null
    //               },
    //               "AdjustedHeight": {
    //                 "Value": null,
    //                 "UnitOfMeasurement": null
    //               }
    //             }
    //           ]
    //         },
    //         "ServiceOptionsCharges": {
    //           "CurrencyCode": "str",
    //           "MonetaryValue": "string"
    //         },
    //         "TaxCharges": [
    //           {
    //             "Type": "string",
    //             "MonetaryValue": "string"
    //           }
    //         ],
    //         "TotalCharges": {
    //           "CurrencyCode": "str",
    //           "MonetaryValue": "string"
    //         },
    //         "TotalChargesWithTaxes": {
    //           "CurrencyCode": "str",
    //           "MonetaryValue": "string"
    //         },
    //         "NegotiatedRateCharges": {
    //           "ItemizedCharges": [
    //             {
    //               "Code": "str",
    //               "Description": "string",
    //               "CurrencyCode": "str",
    //               "MonetaryValue": "string",
    //               "SubType": "string"
    //             }
    //           ],
    //           "TaxCharges": [
    //             {
    //               "Type": "string",
    //               "MonetaryValue": "string"
    //             }
    //           ],
    //           "TotalCharge": {
    //             "CurrencyCode": "string",
    //             "MonetaryValue": "string"
    //           },
    //           "TotalChargesWithTaxes": {
    //             "CurrencyCode": "string",
    //             "MonetaryValue": "string"
    //           }
    //         },
    //         "RatedPackage": [
    //           {
    //             "BaseServiceCharge": {
    //               "CurrencyCode": "str",
    //               "MonetaryValue": "string"
    //             },
    //             "TransportationCharges": {
    //               "CurrencyCode": "string",
    //               "MonetaryValue": "string"
    //             },
    //             "ServiceOptionsCharges": {
    //               "CurrencyCode": "string",
    //               "MonetaryValue": "string"
    //             },
    //             "TotalCharges": {
    //               "CurrencyCode": "string",
    //               "MonetaryValue": "string"
    //             },
    //             "Weight": "string",
    //             "BillingWeight": {
    //               "UnitOfMeasurement": {
    //                 "Code": null,
    //                 "Description": null
    //               },
    //               "Weight": "string"
    //             },
    //             "Accessorial": [
    //               {
    //                 "Code": null,
    //                 "Description": null
    //               }
    //             ],
    //             "ItemizedCharges": [
    //               {
    //                 "Code": null,
    //                 "Description": null,
    //                 "CurrencyCode": null,
    //                 "MonetaryValue": null,
    //                 "SubType": null
    //               }
    //             ],
    //             "NegotiatedCharges": {
    //               "ItemizedCharges": [
    //                 null
    //               ]
    //             },
    //             "SimpleRate": {
    //               "Code": "st"
    //             },
    //             "RateModifier": [
    //               {
    //                 "ModifierType": null,
    //                 "ModifierDesc": null,
    //                 "Amount": null
    //               }
    //             ]
    //           }
    //         ],
    //         "TimeInTransit": {
    //           "PickupDate": "stringst",
    //           "DocumentsOnlyIndicator": "string",
    //           "PackageBillType": "st",
    //           "ServiceSummary": {
    //             "Service": {
    //               "Description": "string"
    //             },
    //             "GuaranteedIndicator": "string",
    //             "Disclaimer": "string",
    //             "EstimatedArrival": {
    //               "Arrival": {
    //                 "Date": null,
    //                 "Time": null
    //               },
    //               "BusinessDaysInTransit": "strin",
    //               "Pickup": {
    //                 "Date": null,
    //                 "Time": null
    //               },
    //               "DayOfWeek": "string",
    //               "CustomerCenterCutoff": "string",
    //               "DelayCount": "str",
    //               "HolidayCount": "st",
    //               "RestDays": "st",
    //               "TotalTransitDays": "strin"
    //             },
    //             "SaturdayDelivery": "string",
    //             "SaturdayDeliveryDisclaimer": "string",
    //             "SundayDelivery": "string",
    //             "SundayDeliveryDisclaimer": "string"
    //           },
    //           "AutoDutyCode": "st",
    //           "Disclaimer": "string"
    //         },
    //         "ScheduledDeliveryDate": "string",
    //         "RoarRatedIndicator": "string"
    //       }
    //     ]
    //   }
    // }

    // Sample code for parsing the JSON response...
    // Use the following online tool to generate parsing code from sample JSON:
    // Generate Parsing Code from JSON

    // 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.

    Code = CkJsonObjectW_stringOf(jResp,L"RateResponse.Response.ResponseStatus.Code");
    Description = CkJsonObjectW_stringOf(jResp,L"RateResponse.Response.ResponseStatus.Description");
    CustomerContext = CkJsonObjectW_stringOf(jResp,L"RateResponse.Response.TransactionReference.CustomerContext");
    i = 0;
    count_i = CkJsonObjectW_SizeOfArray(jResp,L"RateResponse.Response.Alert");
    while (i < count_i) {
        CkJsonObjectW_putI(jResp,i);
        Code = CkJsonObjectW_stringOf(jResp,L"RateResponse.Response.Alert[i].Code");
        Description = CkJsonObjectW_stringOf(jResp,L"RateResponse.Response.Alert[i].Description");
        i = i + 1;
    }

    i = 0;
    count_i = CkJsonObjectW_SizeOfArray(jResp,L"RateResponse.Response.AlertDetail");
    while (i < count_i) {
        CkJsonObjectW_putI(jResp,i);
        Code = CkJsonObjectW_stringOf(jResp,L"RateResponse.Response.AlertDetail[i].Code");
        Description = CkJsonObjectW_stringOf(jResp,L"RateResponse.Response.AlertDetail[i].Description");
        Level = CkJsonObjectW_stringOf(jResp,L"RateResponse.Response.AlertDetail[i].ElementLevelInformation.Level");
        j = 0;
        count_j = CkJsonObjectW_SizeOfArray(jResp,L"RateResponse.Response.AlertDetail[i].ElementLevelInformation.ElementIdentifier");
        while (j < count_j) {
            CkJsonObjectW_putJ(jResp,j);
            Code = CkJsonObjectW_stringOf(jResp,L"RateResponse.Response.AlertDetail[i].ElementLevelInformation.ElementIdentifier[j].Code");
            Value = CkJsonObjectW_stringOf(jResp,L"RateResponse.Response.AlertDetail[i].ElementLevelInformation.ElementIdentifier[j].Value");
            j = j + 1;
        }

        i = i + 1;
    }

    i = 0;
    count_i = CkJsonObjectW_SizeOfArray(jResp,L"RateResponse.RatedShipment");
    while (i < count_i) {
        CkJsonObjectW_putI(jResp,i);
        ServiceCode = CkJsonObjectW_stringOf(jResp,L"RateResponse.RatedShipment[i].Service.Code");
        ServiceDescription = CkJsonObjectW_stringOf(jResp,L"RateResponse.RatedShipment[i].Service.Description");
        RateChart = CkJsonObjectW_stringOf(jResp,L"RateResponse.RatedShipment[i].RateChart");
        BillableWeightCalculationMethod = CkJsonObjectW_stringOf(jResp,L"RateResponse.RatedShipment[i].BillableWeightCalculationMethod");
        RatingMethod = CkJsonObjectW_stringOf(jResp,L"RateResponse.RatedShipment[i].RatingMethod");
        UnitOfMeasurementCode = CkJsonObjectW_stringOf(jResp,L"RateResponse.RatedShipment[i].BillingWeight.UnitOfMeasurement.Code");
        UnitOfMeasurementDescription = CkJsonObjectW_stringOf(jResp,L"RateResponse.RatedShipment[i].BillingWeight.UnitOfMeasurement.Description");
        Weight = CkJsonObjectW_stringOf(jResp,L"RateResponse.RatedShipment[i].BillingWeight.Weight");
        CurrencyCode = CkJsonObjectW_stringOf(jResp,L"RateResponse.RatedShipment[i].TransportationCharges.CurrencyCode");
        MonetaryValue = CkJsonObjectW_stringOf(jResp,L"RateResponse.RatedShipment[i].TransportationCharges.MonetaryValue");
        BaseServiceChargeCurrencyCode = CkJsonObjectW_stringOf(jResp,L"RateResponse.RatedShipment[i].BaseServiceCharge.CurrencyCode");
        BaseServiceChargeMonetaryValue = CkJsonObjectW_stringOf(jResp,L"RateResponse.RatedShipment[i].BaseServiceCharge.MonetaryValue");
        GrossChargeCurrencyCode = CkJsonObjectW_stringOf(jResp,L"RateResponse.RatedShipment[i].FRSShipmentData.TransportationCharges.GrossCharge.CurrencyCode");
        GrossChargeMonetaryValue = CkJsonObjectW_stringOf(jResp,L"RateResponse.RatedShipment[i].FRSShipmentData.TransportationCharges.GrossCharge.MonetaryValue");
        DiscountAmountCurrencyCode = CkJsonObjectW_stringOf(jResp,L"RateResponse.RatedShipment[i].FRSShipmentData.TransportationCharges.DiscountAmount.CurrencyCode");
        DiscountAmountMonetaryValue = CkJsonObjectW_stringOf(jResp,L"RateResponse.RatedShipment[i].FRSShipmentData.TransportationCharges.DiscountAmount.MonetaryValue");
        DiscountPercentage = CkJsonObjectW_stringOf(jResp,L"RateResponse.RatedShipment[i].FRSShipmentData.TransportationCharges.DiscountPercentage");
        NetChargeCurrencyCode = CkJsonObjectW_stringOf(jResp,L"RateResponse.RatedShipment[i].FRSShipmentData.TransportationCharges.NetCharge.CurrencyCode");
        NetChargeMonetaryValue = CkJsonObjectW_stringOf(jResp,L"RateResponse.RatedShipment[i].FRSShipmentData.TransportationCharges.NetCharge.MonetaryValue");
        Density = CkJsonObjectW_stringOf(jResp,L"RateResponse.RatedShipment[i].FRSShipmentData.FreightDensityRate.Density");
        TotalCubicFeet = CkJsonObjectW_stringOf(jResp,L"RateResponse.RatedShipment[i].FRSShipmentData.FreightDensityRate.TotalCubicFeet");
        ServiceOptionsChargesCurrencyCode = CkJsonObjectW_stringOf(jResp,L"RateResponse.RatedShipment[i].ServiceOptionsCharges.CurrencyCode");
        ServiceOptionsChargesMonetaryValue = CkJsonObjectW_stringOf(jResp,L"RateResponse.RatedShipment[i].ServiceOptionsCharges.MonetaryValue");
        TotalChargesCurrencyCode = CkJsonObjectW_stringOf(jResp,L"RateResponse.RatedShipment[i].TotalCharges.CurrencyCode");
        TotalChargesMonetaryValue = CkJsonObjectW_stringOf(jResp,L"RateResponse.RatedShipment[i].TotalCharges.MonetaryValue");
        TotalChargesWithTaxesCurrencyCode = CkJsonObjectW_stringOf(jResp,L"RateResponse.RatedShipment[i].TotalChargesWithTaxes.CurrencyCode");
        TotalChargesWithTaxesMonetaryValue = CkJsonObjectW_stringOf(jResp,L"RateResponse.RatedShipment[i].TotalChargesWithTaxes.MonetaryValue");
        TotalChargeCurrencyCode = CkJsonObjectW_stringOf(jResp,L"RateResponse.RatedShipment[i].NegotiatedRateCharges.TotalCharge.CurrencyCode");
        TotalChargeMonetaryValue = CkJsonObjectW_stringOf(jResp,L"RateResponse.RatedShipment[i].NegotiatedRateCharges.TotalCharge.MonetaryValue");
        TotalChargesWithTaxesCurrencyCode = CkJsonObjectW_stringOf(jResp,L"RateResponse.RatedShipment[i].NegotiatedRateCharges.TotalChargesWithTaxes.CurrencyCode");
        TotalChargesWithTaxesMonetaryValue = CkJsonObjectW_stringOf(jResp,L"RateResponse.RatedShipment[i].NegotiatedRateCharges.TotalChargesWithTaxes.MonetaryValue");
        PickupDate = CkJsonObjectW_stringOf(jResp,L"RateResponse.RatedShipment[i].TimeInTransit.PickupDate");
        DocumentsOnlyIndicator = CkJsonObjectW_stringOf(jResp,L"RateResponse.RatedShipment[i].TimeInTransit.DocumentsOnlyIndicator");
        PackageBillType = CkJsonObjectW_stringOf(jResp,L"RateResponse.RatedShipment[i].TimeInTransit.PackageBillType");
        ServiceDescription = CkJsonObjectW_stringOf(jResp,L"RateResponse.RatedShipment[i].TimeInTransit.ServiceSummary.Service.Description");
        GuaranteedIndicator = CkJsonObjectW_stringOf(jResp,L"RateResponse.RatedShipment[i].TimeInTransit.ServiceSummary.GuaranteedIndicator");
        Disclaimer = CkJsonObjectW_stringOf(jResp,L"RateResponse.RatedShipment[i].TimeInTransit.ServiceSummary.Disclaimer");
        Date = CkJsonObjectW_stringOf(jResp,L"RateResponse.RatedShipment[i].TimeInTransit.ServiceSummary.EstimatedArrival.Arrival.Date");
        Time = CkJsonObjectW_stringOf(jResp,L"RateResponse.RatedShipment[i].TimeInTransit.ServiceSummary.EstimatedArrival.Arrival.Time");
        BusinessDaysInTransit = CkJsonObjectW_stringOf(jResp,L"RateResponse.RatedShipment[i].TimeInTransit.ServiceSummary.EstimatedArrival.BusinessDaysInTransit");
        PickupDate = CkJsonObjectW_stringOf(jResp,L"RateResponse.RatedShipment[i].TimeInTransit.ServiceSummary.EstimatedArrival.Pickup.Date");
        PickupTime = CkJsonObjectW_stringOf(jResp,L"RateResponse.RatedShipment[i].TimeInTransit.ServiceSummary.EstimatedArrival.Pickup.Time");
        DayOfWeek = CkJsonObjectW_stringOf(jResp,L"RateResponse.RatedShipment[i].TimeInTransit.ServiceSummary.EstimatedArrival.DayOfWeek");
        CustomerCenterCutoff = CkJsonObjectW_stringOf(jResp,L"RateResponse.RatedShipment[i].TimeInTransit.ServiceSummary.EstimatedArrival.CustomerCenterCutoff");
        DelayCount = CkJsonObjectW_stringOf(jResp,L"RateResponse.RatedShipment[i].TimeInTransit.ServiceSummary.EstimatedArrival.DelayCount");
        HolidayCount = CkJsonObjectW_stringOf(jResp,L"RateResponse.RatedShipment[i].TimeInTransit.ServiceSummary.EstimatedArrival.HolidayCount");
        RestDays = CkJsonObjectW_stringOf(jResp,L"RateResponse.RatedShipment[i].TimeInTransit.ServiceSummary.EstimatedArrival.RestDays");
        TotalTransitDays = CkJsonObjectW_stringOf(jResp,L"RateResponse.RatedShipment[i].TimeInTransit.ServiceSummary.EstimatedArrival.TotalTransitDays");
        SaturdayDelivery = CkJsonObjectW_stringOf(jResp,L"RateResponse.RatedShipment[i].TimeInTransit.ServiceSummary.SaturdayDelivery");
        SaturdayDeliveryDisclaimer = CkJsonObjectW_stringOf(jResp,L"RateResponse.RatedShipment[i].TimeInTransit.ServiceSummary.SaturdayDeliveryDisclaimer");
        SundayDelivery = CkJsonObjectW_stringOf(jResp,L"RateResponse.RatedShipment[i].TimeInTransit.ServiceSummary.SundayDelivery");
        SundayDeliveryDisclaimer = CkJsonObjectW_stringOf(jResp,L"RateResponse.RatedShipment[i].TimeInTransit.ServiceSummary.SundayDeliveryDisclaimer");
        AutoDutyCode = CkJsonObjectW_stringOf(jResp,L"RateResponse.RatedShipment[i].TimeInTransit.AutoDutyCode");
        TimeInTransitDisclaimer = CkJsonObjectW_stringOf(jResp,L"RateResponse.RatedShipment[i].TimeInTransit.Disclaimer");
        ScheduledDeliveryDate = CkJsonObjectW_stringOf(jResp,L"RateResponse.RatedShipment[i].ScheduledDeliveryDate");
        RoarRatedIndicator = CkJsonObjectW_stringOf(jResp,L"RateResponse.RatedShipment[i].RoarRatedIndicator");
        j = 0;
        count_j = CkJsonObjectW_SizeOfArray(jResp,L"RateResponse.RatedShipment[i].Disclaimer");
        while (j < count_j) {
            CkJsonObjectW_putJ(jResp,j);
            Code = CkJsonObjectW_stringOf(jResp,L"RateResponse.RatedShipment[i].Disclaimer[j].Code");
            Description = CkJsonObjectW_stringOf(jResp,L"RateResponse.RatedShipment[i].Disclaimer[j].Description");
            j = j + 1;
        }

        j = 0;
        count_j = CkJsonObjectW_SizeOfArray(jResp,L"RateResponse.RatedShipment[i].RatedShipmentAlert");
        while (j < count_j) {
            CkJsonObjectW_putJ(jResp,j);
            Code = CkJsonObjectW_stringOf(jResp,L"RateResponse.RatedShipment[i].RatedShipmentAlert[j].Code");
            Description = CkJsonObjectW_stringOf(jResp,L"RateResponse.RatedShipment[i].RatedShipmentAlert[j].Description");
            j = j + 1;
        }

        j = 0;
        count_j = CkJsonObjectW_SizeOfArray(jResp,L"RateResponse.RatedShipment[i].ItemizedCharges");
        while (j < count_j) {
            CkJsonObjectW_putJ(jResp,j);
            Code = CkJsonObjectW_stringOf(jResp,L"RateResponse.RatedShipment[i].ItemizedCharges[j].Code");
            Description = CkJsonObjectW_stringOf(jResp,L"RateResponse.RatedShipment[i].ItemizedCharges[j].Description");
            CurrencyCode = CkJsonObjectW_stringOf(jResp,L"RateResponse.RatedShipment[i].ItemizedCharges[j].CurrencyCode");
            MonetaryValue = CkJsonObjectW_stringOf(jResp,L"RateResponse.RatedShipment[i].ItemizedCharges[j].MonetaryValue");
            SubType = CkJsonObjectW_stringOf(jResp,L"RateResponse.RatedShipment[i].ItemizedCharges[j].SubType");
            j = j + 1;
        }

        j = 0;
        count_j = CkJsonObjectW_SizeOfArray(jResp,L"RateResponse.RatedShipment[i].FRSShipmentData.HandlingUnits");
        while (j < count_j) {
            CkJsonObjectW_putJ(jResp,j);
            Quantity = CkJsonObjectW_stringOf(jResp,L"RateResponse.RatedShipment[i].FRSShipmentData.HandlingUnits[j].Quantity");
            TypeCode = CkJsonObjectW_stringOf(jResp,L"RateResponse.RatedShipment[i].FRSShipmentData.HandlingUnits[j].Type.Code");
            TypeDescription = CkJsonObjectW_stringOf(jResp,L"RateResponse.RatedShipment[i].FRSShipmentData.HandlingUnits[j].Type.Description");
            UnitOfMeasurement = CkJsonObjectW_stringOf(jResp,L"RateResponse.RatedShipment[i].FRSShipmentData.HandlingUnits[j].Dimensions.UnitOfMeasurement");
            Length = CkJsonObjectW_stringOf(jResp,L"RateResponse.RatedShipment[i].FRSShipmentData.HandlingUnits[j].Dimensions.Length");
            Width = CkJsonObjectW_stringOf(jResp,L"RateResponse.RatedShipment[i].FRSShipmentData.HandlingUnits[j].Dimensions.Width");
            Height = CkJsonObjectW_stringOf(jResp,L"RateResponse.RatedShipment[i].FRSShipmentData.HandlingUnits[j].Dimensions.Height");
            AdjustedHeightValue = CkJsonObjectW_stringOf(jResp,L"RateResponse.RatedShipment[i].FRSShipmentData.HandlingUnits[j].AdjustedHeight.Value");
            AdjustedHeightUnitOfMeasurement = CkJsonObjectW_stringOf(jResp,L"RateResponse.RatedShipment[i].FRSShipmentData.HandlingUnits[j].AdjustedHeight.UnitOfMeasurement");
            j = j + 1;
        }

        j = 0;
        count_j = CkJsonObjectW_SizeOfArray(jResp,L"RateResponse.RatedShipment[i].TaxCharges");
        while (j < count_j) {
            CkJsonObjectW_putJ(jResp,j);
            v_Type = CkJsonObjectW_stringOf(jResp,L"RateResponse.RatedShipment[i].TaxCharges[j].Type");
            MonetaryValue = CkJsonObjectW_stringOf(jResp,L"RateResponse.RatedShipment[i].TaxCharges[j].MonetaryValue");
            j = j + 1;
        }

        j = 0;
        count_j = CkJsonObjectW_SizeOfArray(jResp,L"RateResponse.RatedShipment[i].NegotiatedRateCharges.ItemizedCharges");
        while (j < count_j) {
            CkJsonObjectW_putJ(jResp,j);
            Code = CkJsonObjectW_stringOf(jResp,L"RateResponse.RatedShipment[i].NegotiatedRateCharges.ItemizedCharges[j].Code");
            Description = CkJsonObjectW_stringOf(jResp,L"RateResponse.RatedShipment[i].NegotiatedRateCharges.ItemizedCharges[j].Description");
            CurrencyCode = CkJsonObjectW_stringOf(jResp,L"RateResponse.RatedShipment[i].NegotiatedRateCharges.ItemizedCharges[j].CurrencyCode");
            MonetaryValue = CkJsonObjectW_stringOf(jResp,L"RateResponse.RatedShipment[i].NegotiatedRateCharges.ItemizedCharges[j].MonetaryValue");
            SubType = CkJsonObjectW_stringOf(jResp,L"RateResponse.RatedShipment[i].NegotiatedRateCharges.ItemizedCharges[j].SubType");
            j = j + 1;
        }

        j = 0;
        count_j = CkJsonObjectW_SizeOfArray(jResp,L"RateResponse.RatedShipment[i].NegotiatedRateCharges.TaxCharges");
        while (j < count_j) {
            CkJsonObjectW_putJ(jResp,j);
            v_Type = CkJsonObjectW_stringOf(jResp,L"RateResponse.RatedShipment[i].NegotiatedRateCharges.TaxCharges[j].Type");
            MonetaryValue = CkJsonObjectW_stringOf(jResp,L"RateResponse.RatedShipment[i].NegotiatedRateCharges.TaxCharges[j].MonetaryValue");
            j = j + 1;
        }

        j = 0;
        count_j = CkJsonObjectW_SizeOfArray(jResp,L"RateResponse.RatedShipment[i].RatedPackage");
        while (j < count_j) {
            CkJsonObjectW_putJ(jResp,j);
            BaseServiceChargeCurrencyCode = CkJsonObjectW_stringOf(jResp,L"RateResponse.RatedShipment[i].RatedPackage[j].BaseServiceCharge.CurrencyCode");
            BaseServiceChargeMonetaryValue = CkJsonObjectW_stringOf(jResp,L"RateResponse.RatedShipment[i].RatedPackage[j].BaseServiceCharge.MonetaryValue");
            TransportationChargesCurrencyCode = CkJsonObjectW_stringOf(jResp,L"RateResponse.RatedShipment[i].RatedPackage[j].TransportationCharges.CurrencyCode");
            TransportationChargesMonetaryValue = CkJsonObjectW_stringOf(jResp,L"RateResponse.RatedShipment[i].RatedPackage[j].TransportationCharges.MonetaryValue");
            ServiceOptionsChargesCurrencyCode = CkJsonObjectW_stringOf(jResp,L"RateResponse.RatedShipment[i].RatedPackage[j].ServiceOptionsCharges.CurrencyCode");
            ServiceOptionsChargesMonetaryValue = CkJsonObjectW_stringOf(jResp,L"RateResponse.RatedShipment[i].RatedPackage[j].ServiceOptionsCharges.MonetaryValue");
            TotalChargesCurrencyCode = CkJsonObjectW_stringOf(jResp,L"RateResponse.RatedShipment[i].RatedPackage[j].TotalCharges.CurrencyCode");
            TotalChargesMonetaryValue = CkJsonObjectW_stringOf(jResp,L"RateResponse.RatedShipment[i].RatedPackage[j].TotalCharges.MonetaryValue");
            Weight = CkJsonObjectW_stringOf(jResp,L"RateResponse.RatedShipment[i].RatedPackage[j].Weight");
            UnitOfMeasurementCode = CkJsonObjectW_stringOf(jResp,L"RateResponse.RatedShipment[i].RatedPackage[j].BillingWeight.UnitOfMeasurement.Code");
            UnitOfMeasurementDescription = CkJsonObjectW_stringOf(jResp,L"RateResponse.RatedShipment[i].RatedPackage[j].BillingWeight.UnitOfMeasurement.Description");
            BillingWeightWeight = CkJsonObjectW_stringOf(jResp,L"RateResponse.RatedShipment[i].RatedPackage[j].BillingWeight.Weight");
            SimpleRateCode = CkJsonObjectW_stringOf(jResp,L"RateResponse.RatedShipment[i].RatedPackage[j].SimpleRate.Code");
            k = 0;
            count_k = CkJsonObjectW_SizeOfArray(jResp,L"RateResponse.RatedShipment[i].RatedPackage[j].Accessorial");
            while (k < count_k) {
                CkJsonObjectW_putK(jResp,k);
                Code = CkJsonObjectW_stringOf(jResp,L"RateResponse.RatedShipment[i].RatedPackage[j].Accessorial[k].Code");
                Description = CkJsonObjectW_stringOf(jResp,L"RateResponse.RatedShipment[i].RatedPackage[j].Accessorial[k].Description");
                k = k + 1;
            }

            k = 0;
            count_k = CkJsonObjectW_SizeOfArray(jResp,L"RateResponse.RatedShipment[i].RatedPackage[j].ItemizedCharges");
            while (k < count_k) {
                CkJsonObjectW_putK(jResp,k);
                Code = CkJsonObjectW_stringOf(jResp,L"RateResponse.RatedShipment[i].RatedPackage[j].ItemizedCharges[k].Code");
                Description = CkJsonObjectW_stringOf(jResp,L"RateResponse.RatedShipment[i].RatedPackage[j].ItemizedCharges[k].Description");
                CurrencyCode = CkJsonObjectW_stringOf(jResp,L"RateResponse.RatedShipment[i].RatedPackage[j].ItemizedCharges[k].CurrencyCode");
                MonetaryValue = CkJsonObjectW_stringOf(jResp,L"RateResponse.RatedShipment[i].RatedPackage[j].ItemizedCharges[k].MonetaryValue");
                SubType = CkJsonObjectW_stringOf(jResp,L"RateResponse.RatedShipment[i].RatedPackage[j].ItemizedCharges[k].SubType");
                k = k + 1;
            }

            k = 0;
            count_k = CkJsonObjectW_SizeOfArray(jResp,L"RateResponse.RatedShipment[i].RatedPackage[j].NegotiatedCharges.ItemizedCharges");
            while (k < count_k) {
                CkJsonObjectW_putK(jResp,k);
                nullVal = CkJsonObjectW_IsNullOf(jResp,L"RateResponse.RatedShipment[i].RatedPackage[j].NegotiatedCharges.ItemizedCharges[k]");
                k = k + 1;
            }

            k = 0;
            count_k = CkJsonObjectW_SizeOfArray(jResp,L"RateResponse.RatedShipment[i].RatedPackage[j].RateModifier");
            while (k < count_k) {
                CkJsonObjectW_putK(jResp,k);
                ModifierType = CkJsonObjectW_stringOf(jResp,L"RateResponse.RatedShipment[i].RatedPackage[j].RateModifier[k].ModifierType");
                ModifierDesc = CkJsonObjectW_stringOf(jResp,L"RateResponse.RatedShipment[i].RatedPackage[j].RateModifier[k].ModifierDesc");
                Amount = CkJsonObjectW_stringOf(jResp,L"RateResponse.RatedShipment[i].RatedPackage[j].RateModifier[k].Amount");
                k = k + 1;
            }

            j = j + 1;
        }

        i = i + 1;
    }



    CkHttpW_Dispose(http);
    CkJsonObjectW_Dispose(json);
    CkJsonObjectW_Dispose(jsonToken);
    CkHttpResponseW_Dispose(resp);
    CkStringBuilderW_Dispose(sbResponseBody);
    CkJsonObjectW_Dispose(jResp);

    }