Sample code for 30+ languages & platforms
Lua

UPS Rate Request

See more UPS Examples

Simple UPS Rate Example

Chilkat Lua Downloads

Lua
local chilkat = require("chilkat")

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

local http = chilkat.Http.new()

-- 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"
--         }
--       }
--     }
--   }
-- }

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

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

local jsonToken = chilkat.JsonObject.new()
local success = jsonToken:load_file("qa_data/tokens/ups_oauth2_token.json")
if not success then
    print("Failed to load ups_oauth2_token.json")
    return
end

-- 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.
http.auth_token = jsonToken:string_of("access_token")
http:set_request_header("Content-Type", "application/json")
http:set_request_header("transId", "string")
http:set_request_header("transactionSrc", "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.
http:set_url_var("version", "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.
http:set_url_var("requestoption", "Rate")

local resp = chilkat.HttpResponse.new()
success = http:http_json("POST", "https://wwwcie.ups.com/api/rating/{$version}/{$requestoption}?additionalinfo=string", json, "application/json", resp)
if not success then
    print(http.last_error_text)
    return
end

local sbResponseBody = chilkat.StringBuilder.new()
resp:get_body_sb(sbResponseBody)

local jResp = chilkat.JsonObject.new()
jResp:load_sb(sbResponseBody)
jResp.emit_compact = false

print("Response Body:")
print(jResp:emit())

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

local respStatusCode = resp.status_code
print("Response Status Code = " .. respStatusCode)
if respStatusCode >= 400 then
    print("Response Header:")
    print(resp.header)
    print("Failed.")
    return
end

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

local Level = ""
local j = 0
local count_j = 0
local Value = ""
local ServiceCode = ""
local ServiceDescription = ""
local RateChart = ""
local BillableWeightCalculationMethod = ""
local RatingMethod = ""
local UnitOfMeasurementCode = ""
local UnitOfMeasurementDescription = ""
local Weight = ""
local CurrencyCode = ""
local MonetaryValue = ""
local BaseServiceChargeCurrencyCode = ""
local BaseServiceChargeMonetaryValue = ""
local GrossChargeCurrencyCode = ""
local GrossChargeMonetaryValue = ""
local DiscountAmountCurrencyCode = ""
local DiscountAmountMonetaryValue = ""
local DiscountPercentage = ""
local NetChargeCurrencyCode = ""
local NetChargeMonetaryValue = ""
local Density = ""
local TotalCubicFeet = ""
local ServiceOptionsChargesCurrencyCode = ""
local ServiceOptionsChargesMonetaryValue = ""
local TotalChargesCurrencyCode = ""
local TotalChargesMonetaryValue = ""
local TotalChargesWithTaxesCurrencyCode = ""
local TotalChargesWithTaxesMonetaryValue = ""
local TotalChargeCurrencyCode = ""
local TotalChargeMonetaryValue = ""
local PickupDate = ""
local DocumentsOnlyIndicator = ""
local PackageBillType = ""
local GuaranteedIndicator = ""
local Disclaimer = ""
local Date = ""
local Time = ""
local BusinessDaysInTransit = ""
local PickupTime = ""
local DayOfWeek = ""
local CustomerCenterCutoff = ""
local DelayCount = ""
local HolidayCount = ""
local RestDays = ""
local TotalTransitDays = ""
local SaturdayDelivery = ""
local SaturdayDeliveryDisclaimer = ""
local SundayDelivery = ""
local SundayDeliveryDisclaimer = ""
local AutoDutyCode = ""
local TimeInTransitDisclaimer = ""
local ScheduledDeliveryDate = ""
local RoarRatedIndicator = ""
local SubType = ""
local Quantity = ""
local TypeCode = ""
local TypeDescription = ""
local UnitOfMeasurement = ""
local Length = ""
local Width = ""
local Height = ""
local AdjustedHeightValue = ""
local AdjustedHeightUnitOfMeasurement = ""
local v_Type = ""
local TransportationChargesCurrencyCode = ""
local TransportationChargesMonetaryValue = ""
local BillingWeightWeight = ""
local SimpleRateCode = ""
local k = 0
local count_k = 0
local nullVal = false
local ModifierType = ""
local ModifierDesc = ""
local Amount = ""

local Code = jResp:string_of("RateResponse.Response.ResponseStatus.Code")
local Description = jResp:string_of("RateResponse.Response.ResponseStatus.Description")
local CustomerContext = jResp:string_of("RateResponse.Response.TransactionReference.CustomerContext")
local i = 0
local count_i = jResp:size_of_array("RateResponse.Response.Alert")
while i < count_i do
    jResp.i = i
    Code = jResp:string_of("RateResponse.Response.Alert[i].Code")
    Description = jResp:string_of("RateResponse.Response.Alert[i].Description")
    i = i + 1
end

i = 0
count_i = jResp:size_of_array("RateResponse.Response.AlertDetail")
while i < count_i do
    jResp.i = i
    Code = jResp:string_of("RateResponse.Response.AlertDetail[i].Code")
    Description = jResp:string_of("RateResponse.Response.AlertDetail[i].Description")
    Level = jResp:string_of("RateResponse.Response.AlertDetail[i].ElementLevelInformation.Level")
    j = 0
    count_j = jResp:size_of_array("RateResponse.Response.AlertDetail[i].ElementLevelInformation.ElementIdentifier")
    while j < count_j do
        jResp.j = j
        Code = jResp:string_of("RateResponse.Response.AlertDetail[i].ElementLevelInformation.ElementIdentifier[j].Code")
        Value = jResp:string_of("RateResponse.Response.AlertDetail[i].ElementLevelInformation.ElementIdentifier[j].Value")
        j = j + 1
    end

    i = i + 1
end

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

    j = 0
    count_j = jResp:size_of_array("RateResponse.RatedShipment[i].RatedShipmentAlert")
    while j < count_j do
        jResp.j = j
        Code = jResp:string_of("RateResponse.RatedShipment[i].RatedShipmentAlert[j].Code")
        Description = jResp:string_of("RateResponse.RatedShipment[i].RatedShipmentAlert[j].Description")
        j = j + 1
    end

    j = 0
    count_j = jResp:size_of_array("RateResponse.RatedShipment[i].ItemizedCharges")
    while j < count_j do
        jResp.j = j
        Code = jResp:string_of("RateResponse.RatedShipment[i].ItemizedCharges[j].Code")
        Description = jResp:string_of("RateResponse.RatedShipment[i].ItemizedCharges[j].Description")
        CurrencyCode = jResp:string_of("RateResponse.RatedShipment[i].ItemizedCharges[j].CurrencyCode")
        MonetaryValue = jResp:string_of("RateResponse.RatedShipment[i].ItemizedCharges[j].MonetaryValue")
        SubType = jResp:string_of("RateResponse.RatedShipment[i].ItemizedCharges[j].SubType")
        j = j + 1
    end

    j = 0
    count_j = jResp:size_of_array("RateResponse.RatedShipment[i].FRSShipmentData.HandlingUnits")
    while j < count_j do
        jResp.j = j
        Quantity = jResp:string_of("RateResponse.RatedShipment[i].FRSShipmentData.HandlingUnits[j].Quantity")
        TypeCode = jResp:string_of("RateResponse.RatedShipment[i].FRSShipmentData.HandlingUnits[j].Type.Code")
        TypeDescription = jResp:string_of("RateResponse.RatedShipment[i].FRSShipmentData.HandlingUnits[j].Type.Description")
        UnitOfMeasurement = jResp:string_of("RateResponse.RatedShipment[i].FRSShipmentData.HandlingUnits[j].Dimensions.UnitOfMeasurement")
        Length = jResp:string_of("RateResponse.RatedShipment[i].FRSShipmentData.HandlingUnits[j].Dimensions.Length")
        Width = jResp:string_of("RateResponse.RatedShipment[i].FRSShipmentData.HandlingUnits[j].Dimensions.Width")
        Height = jResp:string_of("RateResponse.RatedShipment[i].FRSShipmentData.HandlingUnits[j].Dimensions.Height")
        AdjustedHeightValue = jResp:string_of("RateResponse.RatedShipment[i].FRSShipmentData.HandlingUnits[j].AdjustedHeight.Value")
        AdjustedHeightUnitOfMeasurement = jResp:string_of("RateResponse.RatedShipment[i].FRSShipmentData.HandlingUnits[j].AdjustedHeight.UnitOfMeasurement")
        j = j + 1
    end

    j = 0
    count_j = jResp:size_of_array("RateResponse.RatedShipment[i].TaxCharges")
    while j < count_j do
        jResp.j = j
        v_Type = jResp:string_of("RateResponse.RatedShipment[i].TaxCharges[j].Type")
        MonetaryValue = jResp:string_of("RateResponse.RatedShipment[i].TaxCharges[j].MonetaryValue")
        j = j + 1
    end

    j = 0
    count_j = jResp:size_of_array("RateResponse.RatedShipment[i].NegotiatedRateCharges.ItemizedCharges")
    while j < count_j do
        jResp.j = j
        Code = jResp:string_of("RateResponse.RatedShipment[i].NegotiatedRateCharges.ItemizedCharges[j].Code")
        Description = jResp:string_of("RateResponse.RatedShipment[i].NegotiatedRateCharges.ItemizedCharges[j].Description")
        CurrencyCode = jResp:string_of("RateResponse.RatedShipment[i].NegotiatedRateCharges.ItemizedCharges[j].CurrencyCode")
        MonetaryValue = jResp:string_of("RateResponse.RatedShipment[i].NegotiatedRateCharges.ItemizedCharges[j].MonetaryValue")
        SubType = jResp:string_of("RateResponse.RatedShipment[i].NegotiatedRateCharges.ItemizedCharges[j].SubType")
        j = j + 1
    end

    j = 0
    count_j = jResp:size_of_array("RateResponse.RatedShipment[i].NegotiatedRateCharges.TaxCharges")
    while j < count_j do
        jResp.j = j
        v_Type = jResp:string_of("RateResponse.RatedShipment[i].NegotiatedRateCharges.TaxCharges[j].Type")
        MonetaryValue = jResp:string_of("RateResponse.RatedShipment[i].NegotiatedRateCharges.TaxCharges[j].MonetaryValue")
        j = j + 1
    end

    j = 0
    count_j = jResp:size_of_array("RateResponse.RatedShipment[i].RatedPackage")
    while j < count_j do
        jResp.j = j
        BaseServiceChargeCurrencyCode = jResp:string_of("RateResponse.RatedShipment[i].RatedPackage[j].BaseServiceCharge.CurrencyCode")
        BaseServiceChargeMonetaryValue = jResp:string_of("RateResponse.RatedShipment[i].RatedPackage[j].BaseServiceCharge.MonetaryValue")
        TransportationChargesCurrencyCode = jResp:string_of("RateResponse.RatedShipment[i].RatedPackage[j].TransportationCharges.CurrencyCode")
        TransportationChargesMonetaryValue = jResp:string_of("RateResponse.RatedShipment[i].RatedPackage[j].TransportationCharges.MonetaryValue")
        ServiceOptionsChargesCurrencyCode = jResp:string_of("RateResponse.RatedShipment[i].RatedPackage[j].ServiceOptionsCharges.CurrencyCode")
        ServiceOptionsChargesMonetaryValue = jResp:string_of("RateResponse.RatedShipment[i].RatedPackage[j].ServiceOptionsCharges.MonetaryValue")
        TotalChargesCurrencyCode = jResp:string_of("RateResponse.RatedShipment[i].RatedPackage[j].TotalCharges.CurrencyCode")
        TotalChargesMonetaryValue = jResp:string_of("RateResponse.RatedShipment[i].RatedPackage[j].TotalCharges.MonetaryValue")
        Weight = jResp:string_of("RateResponse.RatedShipment[i].RatedPackage[j].Weight")
        UnitOfMeasurementCode = jResp:string_of("RateResponse.RatedShipment[i].RatedPackage[j].BillingWeight.UnitOfMeasurement.Code")
        UnitOfMeasurementDescription = jResp:string_of("RateResponse.RatedShipment[i].RatedPackage[j].BillingWeight.UnitOfMeasurement.Description")
        BillingWeightWeight = jResp:string_of("RateResponse.RatedShipment[i].RatedPackage[j].BillingWeight.Weight")
        SimpleRateCode = jResp:string_of("RateResponse.RatedShipment[i].RatedPackage[j].SimpleRate.Code")
        k = 0
        count_k = jResp:size_of_array("RateResponse.RatedShipment[i].RatedPackage[j].Accessorial")
        while k < count_k do
            jResp.k = k
            Code = jResp:string_of("RateResponse.RatedShipment[i].RatedPackage[j].Accessorial[k].Code")
            Description = jResp:string_of("RateResponse.RatedShipment[i].RatedPackage[j].Accessorial[k].Description")
            k = k + 1
        end

        k = 0
        count_k = jResp:size_of_array("RateResponse.RatedShipment[i].RatedPackage[j].ItemizedCharges")
        while k < count_k do
            jResp.k = k
            Code = jResp:string_of("RateResponse.RatedShipment[i].RatedPackage[j].ItemizedCharges[k].Code")
            Description = jResp:string_of("RateResponse.RatedShipment[i].RatedPackage[j].ItemizedCharges[k].Description")
            CurrencyCode = jResp:string_of("RateResponse.RatedShipment[i].RatedPackage[j].ItemizedCharges[k].CurrencyCode")
            MonetaryValue = jResp:string_of("RateResponse.RatedShipment[i].RatedPackage[j].ItemizedCharges[k].MonetaryValue")
            SubType = jResp:string_of("RateResponse.RatedShipment[i].RatedPackage[j].ItemizedCharges[k].SubType")
            k = k + 1
        end

        k = 0
        count_k = jResp:size_of_array("RateResponse.RatedShipment[i].RatedPackage[j].NegotiatedCharges.ItemizedCharges")
        while k < count_k do
            jResp.k = k
            nullVal = jResp:is_null_of("RateResponse.RatedShipment[i].RatedPackage[j].NegotiatedCharges.ItemizedCharges[k]")
            k = k + 1
        end

        k = 0
        count_k = jResp:size_of_array("RateResponse.RatedShipment[i].RatedPackage[j].RateModifier")
        while k < count_k do
            jResp.k = k
            ModifierType = jResp:string_of("RateResponse.RatedShipment[i].RatedPackage[j].RateModifier[k].ModifierType")
            ModifierDesc = jResp:string_of("RateResponse.RatedShipment[i].RatedPackage[j].RateModifier[k].ModifierDesc")
            Amount = jResp:string_of("RateResponse.RatedShipment[i].RatedPackage[j].RateModifier[k].Amount")
            k = k + 1
        end

        j = j + 1
    end

    i = i + 1
end