Chilkat Examples

ChilkatHOME.NET Core C#Android™AutoItCC#C++Chilkat2-PythonCkPythonClassic ASPDataFlexDelphi ActiveXDelphi DLLGoJavaLianjaMono C#Node.jsObjective-CPHP ActiveXPHP ExtensionPerlPowerBuilderPowerShellPureBasicRubySQL ServerSwift 2Swift 3,4,5...TclUnicode CUnicode C++VB.NETVBScriptVisual Basic 6.0Visual FoxProXojo Plugin

DataFlex Web API Examples

Primary Categories

ABN AMRO
AWS Secrets Manager
AWS Security Token Service
AWS Translate
Activix CRM
Adyen
Alibaba Cloud OSS
Amazon Cognito
Amazon DynamoDB
Amazon MWS
Amazon Pay
Amazon Rekognition
Amazon SP-API
Amazon Voice ID
Aruba Fatturazione
Azure Maps
Azure Monitor
Azure OAuth2
Azure Storage Accounts
Backblaze S3
Banco Inter
Belgian eHealth Platform
Bitfinex v2 REST
Bluzone
BrickLink
Bunny CDN
CallRail
CardConnect
Cerved
ClickBank
Clickatell
Cloudfare
Constant Contact
DocuSign
Duo Auth MFA
ETrade
Ecwid
Egypt ITIDA
Egypt eReceipt
Etsy
Facebook
Faire
Frame.io
GeoOp
GetHarvest
Global Payments
Google People
Google Search Console
Google Translate
Google Vision
Hungary NAV Invoicing
IBM Text to Speech
Ibanity
IntakeQ
JCC Cyprus
Jira
Lightspeed
MYOB
Magento
Mailgun
Malaysia MyInvois

Mastercard
MedTunnel
MercadoLibre
MessageMedia
Microsoft Calendar
Microsoft Group
Microsoft Tasks and Plans
Microsoft Teams
Moody's
Okta OAuth/OIDC
OneLogin OIDC
OneNote
OpenAI ChatGPT
PRODA
PayPal
Paynow.pl
Peoplevox
Populi
QuickBooks
Rabobank
Refinitiv
Royal Mail OBA
SCiS Schools Catalogue
SII Chile
SMSAPI
SOAP finkok.com
Salesforce
SendGrid
Shippo
Shopify
Shopware
Shopware 6
SimpleTexting
Square
Stripe
SugarCRM
TicketBAI
TikTok Shop
Trello
Twilio
Twitter API v2
Twitter v1
UPS
UniPin
VoiceBase
Vonage
WaTrend
Walmart v3
Wasabi
WhatsApp
WiX
WooCommerce
WordPress
Xero
Yahoo Mail
Yapily
Yousign
ZATCA
Zendesk
Zoom
_Miscellaneous_
eBay
effectconnect
hacienda.go.cr

 

 

 

(DataFlex) UPS Rate Request

See more UPS Examples

Simple UPS Rate Example

For more information, see https://developer.ups.com/api/reference?loc=en_US#operation/Rate

Chilkat ActiveX Downloads

ActiveX for 32-bit and 64-bit Windows

Use ChilkatAx-win32.pkg

Procedure Test
    Handle hoHttp
    Variant vJson
    Handle hoJson
    Boolean iSuccess
    Handle hoJsonToken
    Boolean iSuccess
    Variant vResp
    Handle hoResp
    Variant vSbResponseBody
    Handle hoSbResponseBody
    Handle hoJResp
    Integer iRespStatusCode
    String sLevel
    Integer j
    Integer iCount_j
    String sValue
    String sServiceCode
    String sServiceDescription
    String sRateChart
    String sBillableWeightCalculationMethod
    String sRatingMethod
    String sUnitOfMeasurementCode
    String sUnitOfMeasurementDescription
    String sWeight
    String sCurrencyCode
    String sMonetaryValue
    String sBaseServiceChargeCurrencyCode
    String sBaseServiceChargeMonetaryValue
    String sGrossChargeCurrencyCode
    String sGrossChargeMonetaryValue
    String sDiscountAmountCurrencyCode
    String sDiscountAmountMonetaryValue
    String sDiscountPercentage
    String sNetChargeCurrencyCode
    String sNetChargeMonetaryValue
    String sDensity
    String sTotalCubicFeet
    String sServiceOptionsChargesCurrencyCode
    String sServiceOptionsChargesMonetaryValue
    String sTotalChargesCurrencyCode
    String sTotalChargesMonetaryValue
    String sTotalChargesWithTaxesCurrencyCode
    String sTotalChargesWithTaxesMonetaryValue
    String sTotalChargeCurrencyCode
    String sTotalChargeMonetaryValue
    String sPickupDate
    String sDocumentsOnlyIndicator
    String sPackageBillType
    String sGuaranteedIndicator
    String sDisclaimer
    String sDate
    String sTime
    String sBusinessDaysInTransit
    String sPickupTime
    String sDayOfWeek
    String sCustomerCenterCutoff
    String sDelayCount
    String sHolidayCount
    String sRestDays
    String sTotalTransitDays
    String sSaturdayDelivery
    String sSaturdayDeliveryDisclaimer
    String sSundayDelivery
    String sSundayDeliveryDisclaimer
    String sAutoDutyCode
    String sTimeInTransitDisclaimer
    String sScheduledDeliveryDate
    String sRoarRatedIndicator
    String sSubType
    String sQuantity
    String sTypeCode
    String sTypeDescription
    String sUnitOfMeasurement
    String sLength
    String sWidth
    String sHeight
    String sAdjustedHeightValue
    String sAdjustedHeightUnitOfMeasurement
    String sV_Type
    String sTransportationChargesCurrencyCode
    String sTransportationChargesMonetaryValue
    String sBillingWeightWeight
    String sSimpleRateCode
    Integer k
    Integer iCount_k
    Boolean iNullVal
    String sModifierType
    String sModifierDesc
    String sAmount
    String sCode
    String sDescription
    String sCustomerContext
    Integer i
    Integer iCount_i
    String sTemp1
    Boolean bTemp1

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

    Get Create (RefClass(cComChilkatHttp)) To hoHttp
    If (Not(IsComObjectCreated(hoHttp))) Begin
        Send CreateComObject of hoHttp
    End

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

    Get Create (RefClass(cComChilkatJsonObject)) To hoJson
    If (Not(IsComObjectCreated(hoJson))) Begin
        Send CreateComObject of hoJson
    End
    Get ComUpdateString Of hoJson "RateRequest.Request.TransactionReference.CustomerContext" "CustomerContext" To iSuccess
    Get ComUpdateString Of hoJson "RateRequest.Shipment.Shipper.Name" "ShipperName" To iSuccess
    Get ComUpdateString Of hoJson "RateRequest.Shipment.Shipper.ShipperNumber" "ShipperNumber" To iSuccess
    Get ComUpdateString Of hoJson "RateRequest.Shipment.Shipper.Address.AddressLine[0]" "ShipperAddressLine" To iSuccess
    Get ComUpdateString Of hoJson "RateRequest.Shipment.Shipper.Address.AddressLine[1]" "ShipperAddressLine" To iSuccess
    Get ComUpdateString Of hoJson "RateRequest.Shipment.Shipper.Address.AddressLine[2]" "ShipperAddressLine" To iSuccess
    Get ComUpdateString Of hoJson "RateRequest.Shipment.Shipper.Address.City" "TIMONIUM" To iSuccess
    Get ComUpdateString Of hoJson "RateRequest.Shipment.Shipper.Address.StateProvinceCode" "MD" To iSuccess
    Get ComUpdateString Of hoJson "RateRequest.Shipment.Shipper.Address.PostalCode" "21093" To iSuccess
    Get ComUpdateString Of hoJson "RateRequest.Shipment.Shipper.Address.CountryCode" "US" To iSuccess
    Get ComUpdateString Of hoJson "RateRequest.Shipment.ShipTo.Name" "ShipToName" To iSuccess
    Get ComUpdateString Of hoJson "RateRequest.Shipment.ShipTo.Address.AddressLine[0]" "ShipToAddressLine" To iSuccess
    Get ComUpdateString Of hoJson "RateRequest.Shipment.ShipTo.Address.AddressLine[1]" "ShipToAddressLine" To iSuccess
    Get ComUpdateString Of hoJson "RateRequest.Shipment.ShipTo.Address.AddressLine[2]" "ShipToAddressLine" To iSuccess
    Get ComUpdateString Of hoJson "RateRequest.Shipment.ShipTo.Address.City" "Alpharetta" To iSuccess
    Get ComUpdateString Of hoJson "RateRequest.Shipment.ShipTo.Address.StateProvinceCode" "GA" To iSuccess
    Get ComUpdateString Of hoJson "RateRequest.Shipment.ShipTo.Address.PostalCode" "30005" To iSuccess
    Get ComUpdateString Of hoJson "RateRequest.Shipment.ShipTo.Address.CountryCode" "US" To iSuccess
    Get ComUpdateString Of hoJson "RateRequest.Shipment.ShipFrom.Name" "ShipFromName" To iSuccess
    Get ComUpdateString Of hoJson "RateRequest.Shipment.ShipFrom.Address.AddressLine[0]" "ShipFromAddressLine" To iSuccess
    Get ComUpdateString Of hoJson "RateRequest.Shipment.ShipFrom.Address.AddressLine[1]" "ShipFromAddressLine" To iSuccess
    Get ComUpdateString Of hoJson "RateRequest.Shipment.ShipFrom.Address.AddressLine[2]" "ShipFromAddressLine" To iSuccess
    Get ComUpdateString Of hoJson "RateRequest.Shipment.ShipFrom.Address.City" "TIMONIUM" To iSuccess
    Get ComUpdateString Of hoJson "RateRequest.Shipment.ShipFrom.Address.StateProvinceCode" "MD" To iSuccess
    Get ComUpdateString Of hoJson "RateRequest.Shipment.ShipFrom.Address.PostalCode" "21093" To iSuccess
    Get ComUpdateString Of hoJson "RateRequest.Shipment.ShipFrom.Address.CountryCode" "US" To iSuccess
    Get ComUpdateString Of hoJson "RateRequest.Shipment.PaymentDetails.ShipmentCharge.Type" "01" To iSuccess
    Get ComUpdateString Of hoJson "RateRequest.Shipment.PaymentDetails.ShipmentCharge.BillShipper.AccountNumber" "ShipperNumber" To iSuccess
    Get ComUpdateString Of hoJson "RateRequest.Shipment.Service.Code" "03" To iSuccess
    Get ComUpdateString Of hoJson "RateRequest.Shipment.Service.Description" "Ground" To iSuccess
    Get ComUpdateString Of hoJson "RateRequest.Shipment.NumOfPieces" "1" To iSuccess
    Get ComUpdateString Of hoJson "RateRequest.Shipment.Package.PackagingType.Code" "02" To iSuccess
    Get ComUpdateString Of hoJson "RateRequest.Shipment.Package.PackagingType.Description" "Packaging" To iSuccess
    Get ComUpdateString Of hoJson "RateRequest.Shipment.Package.Dimensions.UnitOfMeasurement.Code" "IN" To iSuccess
    Get ComUpdateString Of hoJson "RateRequest.Shipment.Package.Dimensions.UnitOfMeasurement.Description" "Inches" To iSuccess
    Get ComUpdateString Of hoJson "RateRequest.Shipment.Package.Dimensions.Length" "5" To iSuccess
    Get ComUpdateString Of hoJson "RateRequest.Shipment.Package.Dimensions.Width" "5" To iSuccess
    Get ComUpdateString Of hoJson "RateRequest.Shipment.Package.Dimensions.Height" "5" To iSuccess
    Get ComUpdateString Of hoJson "RateRequest.Shipment.Package.PackageWeight.UnitOfMeasurement.Code" "LBS" To iSuccess
    Get ComUpdateString Of hoJson "RateRequest.Shipment.Package.PackageWeight.UnitOfMeasurement.Description" "Pounds" To iSuccess
    Get ComUpdateString Of hoJson "RateRequest.Shipment.Package.PackageWeight.Weight" "1" To iSuccess

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

    Get Create (RefClass(cComChilkatJsonObject)) To hoJsonToken
    If (Not(IsComObjectCreated(hoJsonToken))) Begin
        Send CreateComObject of hoJsonToken
    End
    Get ComLoadFile Of hoJsonToken "qa_data/tokens/ups_oauth2_token.json" To iSuccess
    If (iSuccess <> True) Begin
        Showln "Failed to load ups_oauth2_token.json"
        Procedure_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.
    Get ComStringOf Of hoJsonToken "access_token" To sTemp1
    Set ComAuthToken Of hoHttp To sTemp1
    Send ComSetRequestHeader To hoHttp "Content-Type" "application/json"
    Send ComSetRequestHeader To hoHttp "transId" "string"
    Send ComSetRequestHeader To hoHttp "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.
    Get ComSetUrlVar Of hoHttp "version" "v1" To iSuccess

    // 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.
    Get ComSetUrlVar Of hoHttp "requestoption" "Rate" To iSuccess

    Get pvComObject of hoJson to vJson
    Get ComPostJson3 Of hoHttp "https://wwwcie.ups.com/api/rating/{$version}/{$requestoption}?additionalinfo=string" "application/json" vJson To vResp
    If (IsComObject(vResp)) Begin
        Get Create (RefClass(cComChilkatHttpResponse)) To hoResp
        Set pvComObject Of hoResp To vResp
    End
    Get ComLastMethodSuccess Of hoHttp To bTemp1
    If (bTemp1 = False) Begin
        Get ComLastErrorText Of hoHttp To sTemp1
        Showln sTemp1
        Procedure_Return
    End

    Get Create (RefClass(cComChilkatStringBuilder)) To hoSbResponseBody
    If (Not(IsComObjectCreated(hoSbResponseBody))) Begin
        Send CreateComObject of hoSbResponseBody
    End
    Get pvComObject of hoSbResponseBody to vSbResponseBody
    Get ComGetBodySb Of hoResp vSbResponseBody To iSuccess

    Get Create (RefClass(cComChilkatJsonObject)) To hoJResp
    If (Not(IsComObjectCreated(hoJResp))) Begin
        Send CreateComObject of hoJResp
    End
    Get pvComObject of hoSbResponseBody to vSbResponseBody
    Get ComLoadSb Of hoJResp vSbResponseBody To iSuccess
    Set ComEmitCompact Of hoJResp To False

    Showln "Response Body:"
    Get ComEmit Of hoJResp To sTemp1
    Showln sTemp1

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

    Get ComStatusCode Of hoResp To iRespStatusCode
    Showln "Response Status Code = " iRespStatusCode
    If (iRespStatusCode >= 400) Begin
        Showln "Response Header:"
        Get ComHeader Of hoResp To sTemp1
        Showln sTemp1
        Showln "Failed."
        Send Destroy of hoResp
        Procedure_Return
    End

    Send Destroy of hoResp

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

    Get ComStringOf Of hoJResp "RateResponse.Response.ResponseStatus.Code" To sCode
    Get ComStringOf Of hoJResp "RateResponse.Response.ResponseStatus.Description" To sDescription
    Get ComStringOf Of hoJResp "RateResponse.Response.TransactionReference.CustomerContext" To sCustomerContext
    Move 0 To i
    Get ComSizeOfArray Of hoJResp "RateResponse.Response.Alert" To iCount_i
    While (i < iCount_i)
        Set ComI Of hoJResp To i
        Get ComStringOf Of hoJResp "RateResponse.Response.Alert[i].Code" To sCode
        Get ComStringOf Of hoJResp "RateResponse.Response.Alert[i].Description" To sDescription
        Move (i + 1) To i
    Loop

    Move 0 To i
    Get ComSizeOfArray Of hoJResp "RateResponse.Response.AlertDetail" To iCount_i
    While (i < iCount_i)
        Set ComI Of hoJResp To i
        Get ComStringOf Of hoJResp "RateResponse.Response.AlertDetail[i].Code" To sCode
        Get ComStringOf Of hoJResp "RateResponse.Response.AlertDetail[i].Description" To sDescription
        Get ComStringOf Of hoJResp "RateResponse.Response.AlertDetail[i].ElementLevelInformation.Level" To sLevel
        Move 0 To j
        Get ComSizeOfArray Of hoJResp "RateResponse.Response.AlertDetail[i].ElementLevelInformation.ElementIdentifier" To iCount_j
        While (j < iCount_j)
            Set ComJ Of hoJResp To j
            Get ComStringOf Of hoJResp "RateResponse.Response.AlertDetail[i].ElementLevelInformation.ElementIdentifier[j].Code" To sCode
            Get ComStringOf Of hoJResp "RateResponse.Response.AlertDetail[i].ElementLevelInformation.ElementIdentifier[j].Value" To sValue
            Move (j + 1) To j
        Loop

        Move (i + 1) To i
    Loop

    Move 0 To i
    Get ComSizeOfArray Of hoJResp "RateResponse.RatedShipment" To iCount_i
    While (i < iCount_i)
        Set ComI Of hoJResp To i
        Get ComStringOf Of hoJResp "RateResponse.RatedShipment[i].Service.Code" To sServiceCode
        Get ComStringOf Of hoJResp "RateResponse.RatedShipment[i].Service.Description" To sServiceDescription
        Get ComStringOf Of hoJResp "RateResponse.RatedShipment[i].RateChart" To sRateChart
        Get ComStringOf Of hoJResp "RateResponse.RatedShipment[i].BillableWeightCalculationMethod" To sBillableWeightCalculationMethod
        Get ComStringOf Of hoJResp "RateResponse.RatedShipment[i].RatingMethod" To sRatingMethod
        Get ComStringOf Of hoJResp "RateResponse.RatedShipment[i].BillingWeight.UnitOfMeasurement.Code" To sUnitOfMeasurementCode
        Get ComStringOf Of hoJResp "RateResponse.RatedShipment[i].BillingWeight.UnitOfMeasurement.Description" To sUnitOfMeasurementDescription
        Get ComStringOf Of hoJResp "RateResponse.RatedShipment[i].BillingWeight.Weight" To sWeight
        Get ComStringOf Of hoJResp "RateResponse.RatedShipment[i].TransportationCharges.CurrencyCode" To sCurrencyCode
        Get ComStringOf Of hoJResp "RateResponse.RatedShipment[i].TransportationCharges.MonetaryValue" To sMonetaryValue
        Get ComStringOf Of hoJResp "RateResponse.RatedShipment[i].BaseServiceCharge.CurrencyCode" To sBaseServiceChargeCurrencyCode
        Get ComStringOf Of hoJResp "RateResponse.RatedShipment[i].BaseServiceCharge.MonetaryValue" To sBaseServiceChargeMonetaryValue
        Get ComStringOf Of hoJResp "RateResponse.RatedShipment[i].FRSShipmentData.TransportationCharges.GrossCharge.CurrencyCode" To sGrossChargeCurrencyCode
        Get ComStringOf Of hoJResp "RateResponse.RatedShipment[i].FRSShipmentData.TransportationCharges.GrossCharge.MonetaryValue" To sGrossChargeMonetaryValue
        Get ComStringOf Of hoJResp "RateResponse.RatedShipment[i].FRSShipmentData.TransportationCharges.DiscountAmount.CurrencyCode" To sDiscountAmountCurrencyCode
        Get ComStringOf Of hoJResp "RateResponse.RatedShipment[i].FRSShipmentData.TransportationCharges.DiscountAmount.MonetaryValue" To sDiscountAmountMonetaryValue
        Get ComStringOf Of hoJResp "RateResponse.RatedShipment[i].FRSShipmentData.TransportationCharges.DiscountPercentage" To sDiscountPercentage
        Get ComStringOf Of hoJResp "RateResponse.RatedShipment[i].FRSShipmentData.TransportationCharges.NetCharge.CurrencyCode" To sNetChargeCurrencyCode
        Get ComStringOf Of hoJResp "RateResponse.RatedShipment[i].FRSShipmentData.TransportationCharges.NetCharge.MonetaryValue" To sNetChargeMonetaryValue
        Get ComStringOf Of hoJResp "RateResponse.RatedShipment[i].FRSShipmentData.FreightDensityRate.Density" To sDensity
        Get ComStringOf Of hoJResp "RateResponse.RatedShipment[i].FRSShipmentData.FreightDensityRate.TotalCubicFeet" To sTotalCubicFeet
        Get ComStringOf Of hoJResp "RateResponse.RatedShipment[i].ServiceOptionsCharges.CurrencyCode" To sServiceOptionsChargesCurrencyCode
        Get ComStringOf Of hoJResp "RateResponse.RatedShipment[i].ServiceOptionsCharges.MonetaryValue" To sServiceOptionsChargesMonetaryValue
        Get ComStringOf Of hoJResp "RateResponse.RatedShipment[i].TotalCharges.CurrencyCode" To sTotalChargesCurrencyCode
        Get ComStringOf Of hoJResp "RateResponse.RatedShipment[i].TotalCharges.MonetaryValue" To sTotalChargesMonetaryValue
        Get ComStringOf Of hoJResp "RateResponse.RatedShipment[i].TotalChargesWithTaxes.CurrencyCode" To sTotalChargesWithTaxesCurrencyCode
        Get ComStringOf Of hoJResp "RateResponse.RatedShipment[i].TotalChargesWithTaxes.MonetaryValue" To sTotalChargesWithTaxesMonetaryValue
        Get ComStringOf Of hoJResp "RateResponse.RatedShipment[i].NegotiatedRateCharges.TotalCharge.CurrencyCode" To sTotalChargeCurrencyCode
        Get ComStringOf Of hoJResp "RateResponse.RatedShipment[i].NegotiatedRateCharges.TotalCharge.MonetaryValue" To sTotalChargeMonetaryValue
        Get ComStringOf Of hoJResp "RateResponse.RatedShipment[i].NegotiatedRateCharges.TotalChargesWithTaxes.CurrencyCode" To sTotalChargesWithTaxesCurrencyCode
        Get ComStringOf Of hoJResp "RateResponse.RatedShipment[i].NegotiatedRateCharges.TotalChargesWithTaxes.MonetaryValue" To sTotalChargesWithTaxesMonetaryValue
        Get ComStringOf Of hoJResp "RateResponse.RatedShipment[i].TimeInTransit.PickupDate" To sPickupDate
        Get ComStringOf Of hoJResp "RateResponse.RatedShipment[i].TimeInTransit.DocumentsOnlyIndicator" To sDocumentsOnlyIndicator
        Get ComStringOf Of hoJResp "RateResponse.RatedShipment[i].TimeInTransit.PackageBillType" To sPackageBillType
        Get ComStringOf Of hoJResp "RateResponse.RatedShipment[i].TimeInTransit.ServiceSummary.Service.Description" To sServiceDescription
        Get ComStringOf Of hoJResp "RateResponse.RatedShipment[i].TimeInTransit.ServiceSummary.GuaranteedIndicator" To sGuaranteedIndicator
        Get ComStringOf Of hoJResp "RateResponse.RatedShipment[i].TimeInTransit.ServiceSummary.Disclaimer" To sDisclaimer
        Get ComStringOf Of hoJResp "RateResponse.RatedShipment[i].TimeInTransit.ServiceSummary.EstimatedArrival.Arrival.Date" To sDate
        Get ComStringOf Of hoJResp "RateResponse.RatedShipment[i].TimeInTransit.ServiceSummary.EstimatedArrival.Arrival.Time" To sTime
        Get ComStringOf Of hoJResp "RateResponse.RatedShipment[i].TimeInTransit.ServiceSummary.EstimatedArrival.BusinessDaysInTransit" To sBusinessDaysInTransit
        Get ComStringOf Of hoJResp "RateResponse.RatedShipment[i].TimeInTransit.ServiceSummary.EstimatedArrival.Pickup.Date" To sPickupDate
        Get ComStringOf Of hoJResp "RateResponse.RatedShipment[i].TimeInTransit.ServiceSummary.EstimatedArrival.Pickup.Time" To sPickupTime
        Get ComStringOf Of hoJResp "RateResponse.RatedShipment[i].TimeInTransit.ServiceSummary.EstimatedArrival.DayOfWeek" To sDayOfWeek
        Get ComStringOf Of hoJResp "RateResponse.RatedShipment[i].TimeInTransit.ServiceSummary.EstimatedArrival.CustomerCenterCutoff" To sCustomerCenterCutoff
        Get ComStringOf Of hoJResp "RateResponse.RatedShipment[i].TimeInTransit.ServiceSummary.EstimatedArrival.DelayCount" To sDelayCount
        Get ComStringOf Of hoJResp "RateResponse.RatedShipment[i].TimeInTransit.ServiceSummary.EstimatedArrival.HolidayCount" To sHolidayCount
        Get ComStringOf Of hoJResp "RateResponse.RatedShipment[i].TimeInTransit.ServiceSummary.EstimatedArrival.RestDays" To sRestDays
        Get ComStringOf Of hoJResp "RateResponse.RatedShipment[i].TimeInTransit.ServiceSummary.EstimatedArrival.TotalTransitDays" To sTotalTransitDays
        Get ComStringOf Of hoJResp "RateResponse.RatedShipment[i].TimeInTransit.ServiceSummary.SaturdayDelivery" To sSaturdayDelivery
        Get ComStringOf Of hoJResp "RateResponse.RatedShipment[i].TimeInTransit.ServiceSummary.SaturdayDeliveryDisclaimer" To sSaturdayDeliveryDisclaimer
        Get ComStringOf Of hoJResp "RateResponse.RatedShipment[i].TimeInTransit.ServiceSummary.SundayDelivery" To sSundayDelivery
        Get ComStringOf Of hoJResp "RateResponse.RatedShipment[i].TimeInTransit.ServiceSummary.SundayDeliveryDisclaimer" To sSundayDeliveryDisclaimer
        Get ComStringOf Of hoJResp "RateResponse.RatedShipment[i].TimeInTransit.AutoDutyCode" To sAutoDutyCode
        Get ComStringOf Of hoJResp "RateResponse.RatedShipment[i].TimeInTransit.Disclaimer" To sTimeInTransitDisclaimer
        Get ComStringOf Of hoJResp "RateResponse.RatedShipment[i].ScheduledDeliveryDate" To sScheduledDeliveryDate
        Get ComStringOf Of hoJResp "RateResponse.RatedShipment[i].RoarRatedIndicator" To sRoarRatedIndicator
        Move 0 To j
        Get ComSizeOfArray Of hoJResp "RateResponse.RatedShipment[i].Disclaimer" To iCount_j
        While (j < iCount_j)
            Set ComJ Of hoJResp To j
            Get ComStringOf Of hoJResp "RateResponse.RatedShipment[i].Disclaimer[j].Code" To sCode
            Get ComStringOf Of hoJResp "RateResponse.RatedShipment[i].Disclaimer[j].Description" To sDescription
            Move (j + 1) To j
        Loop

        Move 0 To j
        Get ComSizeOfArray Of hoJResp "RateResponse.RatedShipment[i].RatedShipmentAlert" To iCount_j
        While (j < iCount_j)
            Set ComJ Of hoJResp To j
            Get ComStringOf Of hoJResp "RateResponse.RatedShipment[i].RatedShipmentAlert[j].Code" To sCode
            Get ComStringOf Of hoJResp "RateResponse.RatedShipment[i].RatedShipmentAlert[j].Description" To sDescription
            Move (j + 1) To j
        Loop

        Move 0 To j
        Get ComSizeOfArray Of hoJResp "RateResponse.RatedShipment[i].ItemizedCharges" To iCount_j
        While (j < iCount_j)
            Set ComJ Of hoJResp To j
            Get ComStringOf Of hoJResp "RateResponse.RatedShipment[i].ItemizedCharges[j].Code" To sCode
            Get ComStringOf Of hoJResp "RateResponse.RatedShipment[i].ItemizedCharges[j].Description" To sDescription
            Get ComStringOf Of hoJResp "RateResponse.RatedShipment[i].ItemizedCharges[j].CurrencyCode" To sCurrencyCode
            Get ComStringOf Of hoJResp "RateResponse.RatedShipment[i].ItemizedCharges[j].MonetaryValue" To sMonetaryValue
            Get ComStringOf Of hoJResp "RateResponse.RatedShipment[i].ItemizedCharges[j].SubType" To sSubType
            Move (j + 1) To j
        Loop

        Move 0 To j
        Get ComSizeOfArray Of hoJResp "RateResponse.RatedShipment[i].FRSShipmentData.HandlingUnits" To iCount_j
        While (j < iCount_j)
            Set ComJ Of hoJResp To j
            Get ComStringOf Of hoJResp "RateResponse.RatedShipment[i].FRSShipmentData.HandlingUnits[j].Quantity" To sQuantity
            Get ComStringOf Of hoJResp "RateResponse.RatedShipment[i].FRSShipmentData.HandlingUnits[j].Type.Code" To sTypeCode
            Get ComStringOf Of hoJResp "RateResponse.RatedShipment[i].FRSShipmentData.HandlingUnits[j].Type.Description" To sTypeDescription
            Get ComStringOf Of hoJResp "RateResponse.RatedShipment[i].FRSShipmentData.HandlingUnits[j].Dimensions.UnitOfMeasurement" To sUnitOfMeasurement
            Get ComStringOf Of hoJResp "RateResponse.RatedShipment[i].FRSShipmentData.HandlingUnits[j].Dimensions.Length" To sLength
            Get ComStringOf Of hoJResp "RateResponse.RatedShipment[i].FRSShipmentData.HandlingUnits[j].Dimensions.Width" To sWidth
            Get ComStringOf Of hoJResp "RateResponse.RatedShipment[i].FRSShipmentData.HandlingUnits[j].Dimensions.Height" To sHeight
            Get ComStringOf Of hoJResp "RateResponse.RatedShipment[i].FRSShipmentData.HandlingUnits[j].AdjustedHeight.Value" To sAdjustedHeightValue
            Get ComStringOf Of hoJResp "RateResponse.RatedShipment[i].FRSShipmentData.HandlingUnits[j].AdjustedHeight.UnitOfMeasurement" To sAdjustedHeightUnitOfMeasurement
            Move (j + 1) To j
        Loop

        Move 0 To j
        Get ComSizeOfArray Of hoJResp "RateResponse.RatedShipment[i].TaxCharges" To iCount_j
        While (j < iCount_j)
            Set ComJ Of hoJResp To j
            Get ComStringOf Of hoJResp "RateResponse.RatedShipment[i].TaxCharges[j].Type" To sV_Type
            Get ComStringOf Of hoJResp "RateResponse.RatedShipment[i].TaxCharges[j].MonetaryValue" To sMonetaryValue
            Move (j + 1) To j
        Loop

        Move 0 To j
        Get ComSizeOfArray Of hoJResp "RateResponse.RatedShipment[i].NegotiatedRateCharges.ItemizedCharges" To iCount_j
        While (j < iCount_j)
            Set ComJ Of hoJResp To j
            Get ComStringOf Of hoJResp "RateResponse.RatedShipment[i].NegotiatedRateCharges.ItemizedCharges[j].Code" To sCode
            Get ComStringOf Of hoJResp "RateResponse.RatedShipment[i].NegotiatedRateCharges.ItemizedCharges[j].Description" To sDescription
            Get ComStringOf Of hoJResp "RateResponse.RatedShipment[i].NegotiatedRateCharges.ItemizedCharges[j].CurrencyCode" To sCurrencyCode
            Get ComStringOf Of hoJResp "RateResponse.RatedShipment[i].NegotiatedRateCharges.ItemizedCharges[j].MonetaryValue" To sMonetaryValue
            Get ComStringOf Of hoJResp "RateResponse.RatedShipment[i].NegotiatedRateCharges.ItemizedCharges[j].SubType" To sSubType
            Move (j + 1) To j
        Loop

        Move 0 To j
        Get ComSizeOfArray Of hoJResp "RateResponse.RatedShipment[i].NegotiatedRateCharges.TaxCharges" To iCount_j
        While (j < iCount_j)
            Set ComJ Of hoJResp To j
            Get ComStringOf Of hoJResp "RateResponse.RatedShipment[i].NegotiatedRateCharges.TaxCharges[j].Type" To sV_Type
            Get ComStringOf Of hoJResp "RateResponse.RatedShipment[i].NegotiatedRateCharges.TaxCharges[j].MonetaryValue" To sMonetaryValue
            Move (j + 1) To j
        Loop

        Move 0 To j
        Get ComSizeOfArray Of hoJResp "RateResponse.RatedShipment[i].RatedPackage" To iCount_j
        While (j < iCount_j)
            Set ComJ Of hoJResp To j
            Get ComStringOf Of hoJResp "RateResponse.RatedShipment[i].RatedPackage[j].BaseServiceCharge.CurrencyCode" To sBaseServiceChargeCurrencyCode
            Get ComStringOf Of hoJResp "RateResponse.RatedShipment[i].RatedPackage[j].BaseServiceCharge.MonetaryValue" To sBaseServiceChargeMonetaryValue
            Get ComStringOf Of hoJResp "RateResponse.RatedShipment[i].RatedPackage[j].TransportationCharges.CurrencyCode" To sTransportationChargesCurrencyCode
            Get ComStringOf Of hoJResp "RateResponse.RatedShipment[i].RatedPackage[j].TransportationCharges.MonetaryValue" To sTransportationChargesMonetaryValue
            Get ComStringOf Of hoJResp "RateResponse.RatedShipment[i].RatedPackage[j].ServiceOptionsCharges.CurrencyCode" To sServiceOptionsChargesCurrencyCode
            Get ComStringOf Of hoJResp "RateResponse.RatedShipment[i].RatedPackage[j].ServiceOptionsCharges.MonetaryValue" To sServiceOptionsChargesMonetaryValue
            Get ComStringOf Of hoJResp "RateResponse.RatedShipment[i].RatedPackage[j].TotalCharges.CurrencyCode" To sTotalChargesCurrencyCode
            Get ComStringOf Of hoJResp "RateResponse.RatedShipment[i].RatedPackage[j].TotalCharges.MonetaryValue" To sTotalChargesMonetaryValue
            Get ComStringOf Of hoJResp "RateResponse.RatedShipment[i].RatedPackage[j].Weight" To sWeight
            Get ComStringOf Of hoJResp "RateResponse.RatedShipment[i].RatedPackage[j].BillingWeight.UnitOfMeasurement.Code" To sUnitOfMeasurementCode
            Get ComStringOf Of hoJResp "RateResponse.RatedShipment[i].RatedPackage[j].BillingWeight.UnitOfMeasurement.Description" To sUnitOfMeasurementDescription
            Get ComStringOf Of hoJResp "RateResponse.RatedShipment[i].RatedPackage[j].BillingWeight.Weight" To sBillingWeightWeight
            Get ComStringOf Of hoJResp "RateResponse.RatedShipment[i].RatedPackage[j].SimpleRate.Code" To sSimpleRateCode
            Move 0 To k
            Get ComSizeOfArray Of hoJResp "RateResponse.RatedShipment[i].RatedPackage[j].Accessorial" To iCount_k
            While (k < iCount_k)
                Set ComK Of hoJResp To k
                Get ComStringOf Of hoJResp "RateResponse.RatedShipment[i].RatedPackage[j].Accessorial[k].Code" To sCode
                Get ComStringOf Of hoJResp "RateResponse.RatedShipment[i].RatedPackage[j].Accessorial[k].Description" To sDescription
                Move (k + 1) To k
            Loop

            Move 0 To k
            Get ComSizeOfArray Of hoJResp "RateResponse.RatedShipment[i].RatedPackage[j].ItemizedCharges" To iCount_k
            While (k < iCount_k)
                Set ComK Of hoJResp To k
                Get ComStringOf Of hoJResp "RateResponse.RatedShipment[i].RatedPackage[j].ItemizedCharges[k].Code" To sCode
                Get ComStringOf Of hoJResp "RateResponse.RatedShipment[i].RatedPackage[j].ItemizedCharges[k].Description" To sDescription
                Get ComStringOf Of hoJResp "RateResponse.RatedShipment[i].RatedPackage[j].ItemizedCharges[k].CurrencyCode" To sCurrencyCode
                Get ComStringOf Of hoJResp "RateResponse.RatedShipment[i].RatedPackage[j].ItemizedCharges[k].MonetaryValue" To sMonetaryValue
                Get ComStringOf Of hoJResp "RateResponse.RatedShipment[i].RatedPackage[j].ItemizedCharges[k].SubType" To sSubType
                Move (k + 1) To k
            Loop

            Move 0 To k
            Get ComSizeOfArray Of hoJResp "RateResponse.RatedShipment[i].RatedPackage[j].NegotiatedCharges.ItemizedCharges" To iCount_k
            While (k < iCount_k)
                Set ComK Of hoJResp To k
                Get ComIsNullOf Of hoJResp "RateResponse.RatedShipment[i].RatedPackage[j].NegotiatedCharges.ItemizedCharges[k]" To iNullVal
                Move (k + 1) To k
            Loop

            Move 0 To k
            Get ComSizeOfArray Of hoJResp "RateResponse.RatedShipment[i].RatedPackage[j].RateModifier" To iCount_k
            While (k < iCount_k)
                Set ComK Of hoJResp To k
                Get ComStringOf Of hoJResp "RateResponse.RatedShipment[i].RatedPackage[j].RateModifier[k].ModifierType" To sModifierType
                Get ComStringOf Of hoJResp "RateResponse.RatedShipment[i].RatedPackage[j].RateModifier[k].ModifierDesc" To sModifierDesc
                Get ComStringOf Of hoJResp "RateResponse.RatedShipment[i].RatedPackage[j].RateModifier[k].Amount" To sAmount
                Move (k + 1) To k
            Loop

            Move (j + 1) To j
        Loop

        Move (i + 1) To i
    Loop



End_Procedure

 

© 2000-2024 Chilkat Software, Inc. All Rights Reserved.