Sample code for 30+ languages & platforms
Visual FoxPro

UPS Rate Request

See more UPS Examples

Simple UPS Rate Example

Chilkat Visual FoxPro Downloads

Visual FoxPro
LOCAL lnSuccess
LOCAL loHttp
LOCAL loJson
LOCAL loJsonToken
LOCAL loResp
LOCAL loSbResponseBody
LOCAL loJResp
LOCAL lnRespStatusCode
LOCAL lcLevel
LOCAL j
LOCAL lnCount_j
LOCAL lcValue
LOCAL lcServiceCode
LOCAL lcServiceDescription
LOCAL lcRateChart
LOCAL lcBillableWeightCalculationMethod
LOCAL lcRatingMethod
LOCAL lcUnitOfMeasurementCode
LOCAL lcUnitOfMeasurementDescription
LOCAL lcWeight
LOCAL lcCurrencyCode
LOCAL lcMonetaryValue
LOCAL lcBaseServiceChargeCurrencyCode
LOCAL lcBaseServiceChargeMonetaryValue
LOCAL lcGrossChargeCurrencyCode
LOCAL lcGrossChargeMonetaryValue
LOCAL lcDiscountAmountCurrencyCode
LOCAL lcDiscountAmountMonetaryValue
LOCAL lcDiscountPercentage
LOCAL lcNetChargeCurrencyCode
LOCAL lcNetChargeMonetaryValue
LOCAL lcDensity
LOCAL lcTotalCubicFeet
LOCAL lcServiceOptionsChargesCurrencyCode
LOCAL lcServiceOptionsChargesMonetaryValue
LOCAL lcTotalChargesCurrencyCode
LOCAL lcTotalChargesMonetaryValue
LOCAL lcTotalChargesWithTaxesCurrencyCode
LOCAL lcTotalChargesWithTaxesMonetaryValue
LOCAL lcTotalChargeCurrencyCode
LOCAL lcTotalChargeMonetaryValue
LOCAL lcPickupDate
LOCAL lcDocumentsOnlyIndicator
LOCAL lcPackageBillType
LOCAL lcGuaranteedIndicator
LOCAL lcDisclaimer
LOCAL lcDate
LOCAL lcTime
LOCAL lcBusinessDaysInTransit
LOCAL lcPickupTime
LOCAL lcDayOfWeek
LOCAL lcCustomerCenterCutoff
LOCAL lcDelayCount
LOCAL lcHolidayCount
LOCAL lcRestDays
LOCAL lcTotalTransitDays
LOCAL lcSaturdayDelivery
LOCAL lcSaturdayDeliveryDisclaimer
LOCAL lcSundayDelivery
LOCAL lcSundayDeliveryDisclaimer
LOCAL lcAutoDutyCode
LOCAL lcTimeInTransitDisclaimer
LOCAL lcScheduledDeliveryDate
LOCAL lcRoarRatedIndicator
LOCAL lcSubType
LOCAL lcQuantity
LOCAL lcTypeCode
LOCAL lcTypeDescription
LOCAL lcUnitOfMeasurement
LOCAL lcLength
LOCAL lcWidth
LOCAL lcHeight
LOCAL lcAdjustedHeightValue
LOCAL lcAdjustedHeightUnitOfMeasurement
LOCAL lcV_Type
LOCAL lcTransportationChargesCurrencyCode
LOCAL lcTransportationChargesMonetaryValue
LOCAL lcBillingWeightWeight
LOCAL lcSimpleRateCode
LOCAL k
LOCAL lnCount_k
LOCAL lnNullVal
LOCAL lcModifierType
LOCAL lcModifierDesc
LOCAL lcAmount
LOCAL lcCode
LOCAL lcDescription
LOCAL lcCustomerContext
LOCAL i
LOCAL lnCount_i

lnSuccess = 0

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

loHttp = CreateObject('Chilkat.Http')

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

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

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

loJsonToken = CreateObject('Chilkat.JsonObject')
lnSuccess = loJsonToken.LoadFile("qa_data/tokens/ups_oauth2_token.json")
IF (lnSuccess <> 1) THEN
    ? "Failed to load ups_oauth2_token.json"
    RELEASE loHttp
    RELEASE loJson
    RELEASE loJsonToken
    CANCEL
ENDIF

* 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.
loHttp.AuthToken = loJsonToken.StringOf("access_token")
loHttp.SetRequestHeader("Content-Type","application/json")
loHttp.SetRequestHeader("transId","string")
loHttp.SetRequestHeader("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.
loHttp.SetUrlVar("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.
loHttp.SetUrlVar("requestoption","Rate")

loResp = CreateObject('Chilkat.HttpResponse')
lnSuccess = loHttp.HttpJson("POST","https://wwwcie.ups.com/api/rating/{$version}/{$requestoption}?additionalinfo=string",loJson,"application/json",loResp)
IF (lnSuccess = 0) THEN
    ? loHttp.LastErrorText
    RELEASE loHttp
    RELEASE loJson
    RELEASE loJsonToken
    RELEASE loResp
    CANCEL
ENDIF

loSbResponseBody = CreateObject('Chilkat.StringBuilder')
loResp.GetBodySb(loSbResponseBody)

loJResp = CreateObject('Chilkat.JsonObject')
loJResp.LoadSb(loSbResponseBody)
loJResp.EmitCompact = 0

? "Response Body:"
? loJResp.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.
* ----------------------------------------------------------------------------------------------------------

lnRespStatusCode = loResp.StatusCode
? "Response Status Code = " + STR(lnRespStatusCode)
IF (lnRespStatusCode >= 400) THEN
    ? "Response Header:"
    ? loResp.Header
    ? "Failed."
    RELEASE loHttp
    RELEASE loJson
    RELEASE loJsonToken
    RELEASE loResp
    RELEASE loSbResponseBody
    RELEASE loJResp
    CANCEL
ENDIF

* 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

lcCode = loJResp.StringOf("RateResponse.Response.ResponseStatus.Code")
lcDescription = loJResp.StringOf("RateResponse.Response.ResponseStatus.Description")
lcCustomerContext = loJResp.StringOf("RateResponse.Response.TransactionReference.CustomerContext")
i = 0
lnCount_i = loJResp.SizeOfArray("RateResponse.Response.Alert")
DO WHILE i < lnCount_i
    loJResp.I = i
    lcCode = loJResp.StringOf("RateResponse.Response.Alert[i].Code")
    lcDescription = loJResp.StringOf("RateResponse.Response.Alert[i].Description")
    i = i + 1
ENDDO
i = 0
lnCount_i = loJResp.SizeOfArray("RateResponse.Response.AlertDetail")
DO WHILE i < lnCount_i
    loJResp.I = i
    lcCode = loJResp.StringOf("RateResponse.Response.AlertDetail[i].Code")
    lcDescription = loJResp.StringOf("RateResponse.Response.AlertDetail[i].Description")
    lcLevel = loJResp.StringOf("RateResponse.Response.AlertDetail[i].ElementLevelInformation.Level")
    j = 0
    lnCount_j = loJResp.SizeOfArray("RateResponse.Response.AlertDetail[i].ElementLevelInformation.ElementIdentifier")
    DO WHILE j < lnCount_j
        loJResp.J = j
        lcCode = loJResp.StringOf("RateResponse.Response.AlertDetail[i].ElementLevelInformation.ElementIdentifier[j].Code")
        lcValue = loJResp.StringOf("RateResponse.Response.AlertDetail[i].ElementLevelInformation.ElementIdentifier[j].Value")
        j = j + 1
    ENDDO
    i = i + 1
ENDDO
i = 0
lnCount_i = loJResp.SizeOfArray("RateResponse.RatedShipment")
DO WHILE i < lnCount_i
    loJResp.I = i
    lcServiceCode = loJResp.StringOf("RateResponse.RatedShipment[i].Service.Code")
    lcServiceDescription = loJResp.StringOf("RateResponse.RatedShipment[i].Service.Description")
    lcRateChart = loJResp.StringOf("RateResponse.RatedShipment[i].RateChart")
    lcBillableWeightCalculationMethod = loJResp.StringOf("RateResponse.RatedShipment[i].BillableWeightCalculationMethod")
    lcRatingMethod = loJResp.StringOf("RateResponse.RatedShipment[i].RatingMethod")
    lcUnitOfMeasurementCode = loJResp.StringOf("RateResponse.RatedShipment[i].BillingWeight.UnitOfMeasurement.Code")
    lcUnitOfMeasurementDescription = loJResp.StringOf("RateResponse.RatedShipment[i].BillingWeight.UnitOfMeasurement.Description")
    lcWeight = loJResp.StringOf("RateResponse.RatedShipment[i].BillingWeight.Weight")
    lcCurrencyCode = loJResp.StringOf("RateResponse.RatedShipment[i].TransportationCharges.CurrencyCode")
    lcMonetaryValue = loJResp.StringOf("RateResponse.RatedShipment[i].TransportationCharges.MonetaryValue")
    lcBaseServiceChargeCurrencyCode = loJResp.StringOf("RateResponse.RatedShipment[i].BaseServiceCharge.CurrencyCode")
    lcBaseServiceChargeMonetaryValue = loJResp.StringOf("RateResponse.RatedShipment[i].BaseServiceCharge.MonetaryValue")
    lcGrossChargeCurrencyCode = loJResp.StringOf("RateResponse.RatedShipment[i].FRSShipmentData.TransportationCharges.GrossCharge.CurrencyCode")
    lcGrossChargeMonetaryValue = loJResp.StringOf("RateResponse.RatedShipment[i].FRSShipmentData.TransportationCharges.GrossCharge.MonetaryValue")
    lcDiscountAmountCurrencyCode = loJResp.StringOf("RateResponse.RatedShipment[i].FRSShipmentData.TransportationCharges.DiscountAmount.CurrencyCode")
    lcDiscountAmountMonetaryValue = loJResp.StringOf("RateResponse.RatedShipment[i].FRSShipmentData.TransportationCharges.DiscountAmount.MonetaryValue")
    lcDiscountPercentage = loJResp.StringOf("RateResponse.RatedShipment[i].FRSShipmentData.TransportationCharges.DiscountPercentage")
    lcNetChargeCurrencyCode = loJResp.StringOf("RateResponse.RatedShipment[i].FRSShipmentData.TransportationCharges.NetCharge.CurrencyCode")
    lcNetChargeMonetaryValue = loJResp.StringOf("RateResponse.RatedShipment[i].FRSShipmentData.TransportationCharges.NetCharge.MonetaryValue")
    lcDensity = loJResp.StringOf("RateResponse.RatedShipment[i].FRSShipmentData.FreightDensityRate.Density")
    lcTotalCubicFeet = loJResp.StringOf("RateResponse.RatedShipment[i].FRSShipmentData.FreightDensityRate.TotalCubicFeet")
    lcServiceOptionsChargesCurrencyCode = loJResp.StringOf("RateResponse.RatedShipment[i].ServiceOptionsCharges.CurrencyCode")
    lcServiceOptionsChargesMonetaryValue = loJResp.StringOf("RateResponse.RatedShipment[i].ServiceOptionsCharges.MonetaryValue")
    lcTotalChargesCurrencyCode = loJResp.StringOf("RateResponse.RatedShipment[i].TotalCharges.CurrencyCode")
    lcTotalChargesMonetaryValue = loJResp.StringOf("RateResponse.RatedShipment[i].TotalCharges.MonetaryValue")
    lcTotalChargesWithTaxesCurrencyCode = loJResp.StringOf("RateResponse.RatedShipment[i].TotalChargesWithTaxes.CurrencyCode")
    lcTotalChargesWithTaxesMonetaryValue = loJResp.StringOf("RateResponse.RatedShipment[i].TotalChargesWithTaxes.MonetaryValue")
    lcTotalChargeCurrencyCode = loJResp.StringOf("RateResponse.RatedShipment[i].NegotiatedRateCharges.TotalCharge.CurrencyCode")
    lcTotalChargeMonetaryValue = loJResp.StringOf("RateResponse.RatedShipment[i].NegotiatedRateCharges.TotalCharge.MonetaryValue")
    lcTotalChargesWithTaxesCurrencyCode = loJResp.StringOf("RateResponse.RatedShipment[i].NegotiatedRateCharges.TotalChargesWithTaxes.CurrencyCode")
    lcTotalChargesWithTaxesMonetaryValue = loJResp.StringOf("RateResponse.RatedShipment[i].NegotiatedRateCharges.TotalChargesWithTaxes.MonetaryValue")
    lcPickupDate = loJResp.StringOf("RateResponse.RatedShipment[i].TimeInTransit.PickupDate")
    lcDocumentsOnlyIndicator = loJResp.StringOf("RateResponse.RatedShipment[i].TimeInTransit.DocumentsOnlyIndicator")
    lcPackageBillType = loJResp.StringOf("RateResponse.RatedShipment[i].TimeInTransit.PackageBillType")
    lcServiceDescription = loJResp.StringOf("RateResponse.RatedShipment[i].TimeInTransit.ServiceSummary.Service.Description")
    lcGuaranteedIndicator = loJResp.StringOf("RateResponse.RatedShipment[i].TimeInTransit.ServiceSummary.GuaranteedIndicator")
    lcDisclaimer = loJResp.StringOf("RateResponse.RatedShipment[i].TimeInTransit.ServiceSummary.Disclaimer")
    lcDate = loJResp.StringOf("RateResponse.RatedShipment[i].TimeInTransit.ServiceSummary.EstimatedArrival.Arrival.Date")
    lcTime = loJResp.StringOf("RateResponse.RatedShipment[i].TimeInTransit.ServiceSummary.EstimatedArrival.Arrival.Time")
    lcBusinessDaysInTransit = loJResp.StringOf("RateResponse.RatedShipment[i].TimeInTransit.ServiceSummary.EstimatedArrival.BusinessDaysInTransit")
    lcPickupDate = loJResp.StringOf("RateResponse.RatedShipment[i].TimeInTransit.ServiceSummary.EstimatedArrival.Pickup.Date")
    lcPickupTime = loJResp.StringOf("RateResponse.RatedShipment[i].TimeInTransit.ServiceSummary.EstimatedArrival.Pickup.Time")
    lcDayOfWeek = loJResp.StringOf("RateResponse.RatedShipment[i].TimeInTransit.ServiceSummary.EstimatedArrival.DayOfWeek")
    lcCustomerCenterCutoff = loJResp.StringOf("RateResponse.RatedShipment[i].TimeInTransit.ServiceSummary.EstimatedArrival.CustomerCenterCutoff")
    lcDelayCount = loJResp.StringOf("RateResponse.RatedShipment[i].TimeInTransit.ServiceSummary.EstimatedArrival.DelayCount")
    lcHolidayCount = loJResp.StringOf("RateResponse.RatedShipment[i].TimeInTransit.ServiceSummary.EstimatedArrival.HolidayCount")
    lcRestDays = loJResp.StringOf("RateResponse.RatedShipment[i].TimeInTransit.ServiceSummary.EstimatedArrival.RestDays")
    lcTotalTransitDays = loJResp.StringOf("RateResponse.RatedShipment[i].TimeInTransit.ServiceSummary.EstimatedArrival.TotalTransitDays")
    lcSaturdayDelivery = loJResp.StringOf("RateResponse.RatedShipment[i].TimeInTransit.ServiceSummary.SaturdayDelivery")
    lcSaturdayDeliveryDisclaimer = loJResp.StringOf("RateResponse.RatedShipment[i].TimeInTransit.ServiceSummary.SaturdayDeliveryDisclaimer")
    lcSundayDelivery = loJResp.StringOf("RateResponse.RatedShipment[i].TimeInTransit.ServiceSummary.SundayDelivery")
    lcSundayDeliveryDisclaimer = loJResp.StringOf("RateResponse.RatedShipment[i].TimeInTransit.ServiceSummary.SundayDeliveryDisclaimer")
    lcAutoDutyCode = loJResp.StringOf("RateResponse.RatedShipment[i].TimeInTransit.AutoDutyCode")
    lcTimeInTransitDisclaimer = loJResp.StringOf("RateResponse.RatedShipment[i].TimeInTransit.Disclaimer")
    lcScheduledDeliveryDate = loJResp.StringOf("RateResponse.RatedShipment[i].ScheduledDeliveryDate")
    lcRoarRatedIndicator = loJResp.StringOf("RateResponse.RatedShipment[i].RoarRatedIndicator")
    j = 0
    lnCount_j = loJResp.SizeOfArray("RateResponse.RatedShipment[i].Disclaimer")
    DO WHILE j < lnCount_j
        loJResp.J = j
        lcCode = loJResp.StringOf("RateResponse.RatedShipment[i].Disclaimer[j].Code")
        lcDescription = loJResp.StringOf("RateResponse.RatedShipment[i].Disclaimer[j].Description")
        j = j + 1
    ENDDO
    j = 0
    lnCount_j = loJResp.SizeOfArray("RateResponse.RatedShipment[i].RatedShipmentAlert")
    DO WHILE j < lnCount_j
        loJResp.J = j
        lcCode = loJResp.StringOf("RateResponse.RatedShipment[i].RatedShipmentAlert[j].Code")
        lcDescription = loJResp.StringOf("RateResponse.RatedShipment[i].RatedShipmentAlert[j].Description")
        j = j + 1
    ENDDO
    j = 0
    lnCount_j = loJResp.SizeOfArray("RateResponse.RatedShipment[i].ItemizedCharges")
    DO WHILE j < lnCount_j
        loJResp.J = j
        lcCode = loJResp.StringOf("RateResponse.RatedShipment[i].ItemizedCharges[j].Code")
        lcDescription = loJResp.StringOf("RateResponse.RatedShipment[i].ItemizedCharges[j].Description")
        lcCurrencyCode = loJResp.StringOf("RateResponse.RatedShipment[i].ItemizedCharges[j].CurrencyCode")
        lcMonetaryValue = loJResp.StringOf("RateResponse.RatedShipment[i].ItemizedCharges[j].MonetaryValue")
        lcSubType = loJResp.StringOf("RateResponse.RatedShipment[i].ItemizedCharges[j].SubType")
        j = j + 1
    ENDDO
    j = 0
    lnCount_j = loJResp.SizeOfArray("RateResponse.RatedShipment[i].FRSShipmentData.HandlingUnits")
    DO WHILE j < lnCount_j
        loJResp.J = j
        lcQuantity = loJResp.StringOf("RateResponse.RatedShipment[i].FRSShipmentData.HandlingUnits[j].Quantity")
        lcTypeCode = loJResp.StringOf("RateResponse.RatedShipment[i].FRSShipmentData.HandlingUnits[j].Type.Code")
        lcTypeDescription = loJResp.StringOf("RateResponse.RatedShipment[i].FRSShipmentData.HandlingUnits[j].Type.Description")
        lcUnitOfMeasurement = loJResp.StringOf("RateResponse.RatedShipment[i].FRSShipmentData.HandlingUnits[j].Dimensions.UnitOfMeasurement")
        lcLength = loJResp.StringOf("RateResponse.RatedShipment[i].FRSShipmentData.HandlingUnits[j].Dimensions.Length")
        lcWidth = loJResp.StringOf("RateResponse.RatedShipment[i].FRSShipmentData.HandlingUnits[j].Dimensions.Width")
        lcHeight = loJResp.StringOf("RateResponse.RatedShipment[i].FRSShipmentData.HandlingUnits[j].Dimensions.Height")
        lcAdjustedHeightValue = loJResp.StringOf("RateResponse.RatedShipment[i].FRSShipmentData.HandlingUnits[j].AdjustedHeight.Value")
        lcAdjustedHeightUnitOfMeasurement = loJResp.StringOf("RateResponse.RatedShipment[i].FRSShipmentData.HandlingUnits[j].AdjustedHeight.UnitOfMeasurement")
        j = j + 1
    ENDDO
    j = 0
    lnCount_j = loJResp.SizeOfArray("RateResponse.RatedShipment[i].TaxCharges")
    DO WHILE j < lnCount_j
        loJResp.J = j
        lcV_Type = loJResp.StringOf("RateResponse.RatedShipment[i].TaxCharges[j].Type")
        lcMonetaryValue = loJResp.StringOf("RateResponse.RatedShipment[i].TaxCharges[j].MonetaryValue")
        j = j + 1
    ENDDO
    j = 0
    lnCount_j = loJResp.SizeOfArray("RateResponse.RatedShipment[i].NegotiatedRateCharges.ItemizedCharges")
    DO WHILE j < lnCount_j
        loJResp.J = j
        lcCode = loJResp.StringOf("RateResponse.RatedShipment[i].NegotiatedRateCharges.ItemizedCharges[j].Code")
        lcDescription = loJResp.StringOf("RateResponse.RatedShipment[i].NegotiatedRateCharges.ItemizedCharges[j].Description")
        lcCurrencyCode = loJResp.StringOf("RateResponse.RatedShipment[i].NegotiatedRateCharges.ItemizedCharges[j].CurrencyCode")
        lcMonetaryValue = loJResp.StringOf("RateResponse.RatedShipment[i].NegotiatedRateCharges.ItemizedCharges[j].MonetaryValue")
        lcSubType = loJResp.StringOf("RateResponse.RatedShipment[i].NegotiatedRateCharges.ItemizedCharges[j].SubType")
        j = j + 1
    ENDDO
    j = 0
    lnCount_j = loJResp.SizeOfArray("RateResponse.RatedShipment[i].NegotiatedRateCharges.TaxCharges")
    DO WHILE j < lnCount_j
        loJResp.J = j
        lcV_Type = loJResp.StringOf("RateResponse.RatedShipment[i].NegotiatedRateCharges.TaxCharges[j].Type")
        lcMonetaryValue = loJResp.StringOf("RateResponse.RatedShipment[i].NegotiatedRateCharges.TaxCharges[j].MonetaryValue")
        j = j + 1
    ENDDO
    j = 0
    lnCount_j = loJResp.SizeOfArray("RateResponse.RatedShipment[i].RatedPackage")
    DO WHILE j < lnCount_j
        loJResp.J = j
        lcBaseServiceChargeCurrencyCode = loJResp.StringOf("RateResponse.RatedShipment[i].RatedPackage[j].BaseServiceCharge.CurrencyCode")
        lcBaseServiceChargeMonetaryValue = loJResp.StringOf("RateResponse.RatedShipment[i].RatedPackage[j].BaseServiceCharge.MonetaryValue")
        lcTransportationChargesCurrencyCode = loJResp.StringOf("RateResponse.RatedShipment[i].RatedPackage[j].TransportationCharges.CurrencyCode")
        lcTransportationChargesMonetaryValue = loJResp.StringOf("RateResponse.RatedShipment[i].RatedPackage[j].TransportationCharges.MonetaryValue")
        lcServiceOptionsChargesCurrencyCode = loJResp.StringOf("RateResponse.RatedShipment[i].RatedPackage[j].ServiceOptionsCharges.CurrencyCode")
        lcServiceOptionsChargesMonetaryValue = loJResp.StringOf("RateResponse.RatedShipment[i].RatedPackage[j].ServiceOptionsCharges.MonetaryValue")
        lcTotalChargesCurrencyCode = loJResp.StringOf("RateResponse.RatedShipment[i].RatedPackage[j].TotalCharges.CurrencyCode")
        lcTotalChargesMonetaryValue = loJResp.StringOf("RateResponse.RatedShipment[i].RatedPackage[j].TotalCharges.MonetaryValue")
        lcWeight = loJResp.StringOf("RateResponse.RatedShipment[i].RatedPackage[j].Weight")
        lcUnitOfMeasurementCode = loJResp.StringOf("RateResponse.RatedShipment[i].RatedPackage[j].BillingWeight.UnitOfMeasurement.Code")
        lcUnitOfMeasurementDescription = loJResp.StringOf("RateResponse.RatedShipment[i].RatedPackage[j].BillingWeight.UnitOfMeasurement.Description")
        lcBillingWeightWeight = loJResp.StringOf("RateResponse.RatedShipment[i].RatedPackage[j].BillingWeight.Weight")
        lcSimpleRateCode = loJResp.StringOf("RateResponse.RatedShipment[i].RatedPackage[j].SimpleRate.Code")
        k = 0
        lnCount_k = loJResp.SizeOfArray("RateResponse.RatedShipment[i].RatedPackage[j].Accessorial")
        DO WHILE k < lnCount_k
            loJResp.K = k
            lcCode = loJResp.StringOf("RateResponse.RatedShipment[i].RatedPackage[j].Accessorial[k].Code")
            lcDescription = loJResp.StringOf("RateResponse.RatedShipment[i].RatedPackage[j].Accessorial[k].Description")
            k = k + 1
        ENDDO
        k = 0
        lnCount_k = loJResp.SizeOfArray("RateResponse.RatedShipment[i].RatedPackage[j].ItemizedCharges")
        DO WHILE k < lnCount_k
            loJResp.K = k
            lcCode = loJResp.StringOf("RateResponse.RatedShipment[i].RatedPackage[j].ItemizedCharges[k].Code")
            lcDescription = loJResp.StringOf("RateResponse.RatedShipment[i].RatedPackage[j].ItemizedCharges[k].Description")
            lcCurrencyCode = loJResp.StringOf("RateResponse.RatedShipment[i].RatedPackage[j].ItemizedCharges[k].CurrencyCode")
            lcMonetaryValue = loJResp.StringOf("RateResponse.RatedShipment[i].RatedPackage[j].ItemizedCharges[k].MonetaryValue")
            lcSubType = loJResp.StringOf("RateResponse.RatedShipment[i].RatedPackage[j].ItemizedCharges[k].SubType")
            k = k + 1
        ENDDO
        k = 0
        lnCount_k = loJResp.SizeOfArray("RateResponse.RatedShipment[i].RatedPackage[j].NegotiatedCharges.ItemizedCharges")
        DO WHILE k < lnCount_k
            loJResp.K = k
            lnNullVal = loJResp.IsNullOf("RateResponse.RatedShipment[i].RatedPackage[j].NegotiatedCharges.ItemizedCharges[k]")
            k = k + 1
        ENDDO
        k = 0
        lnCount_k = loJResp.SizeOfArray("RateResponse.RatedShipment[i].RatedPackage[j].RateModifier")
        DO WHILE k < lnCount_k
            loJResp.K = k
            lcModifierType = loJResp.StringOf("RateResponse.RatedShipment[i].RatedPackage[j].RateModifier[k].ModifierType")
            lcModifierDesc = loJResp.StringOf("RateResponse.RatedShipment[i].RatedPackage[j].RateModifier[k].ModifierDesc")
            lcAmount = loJResp.StringOf("RateResponse.RatedShipment[i].RatedPackage[j].RateModifier[k].Amount")
            k = k + 1
        ENDDO
        j = j + 1
    ENDDO
    i = i + 1
ENDDO

RELEASE loHttp
RELEASE loJson
RELEASE loJsonToken
RELEASE loResp
RELEASE loSbResponseBody
RELEASE loJResp