Chilkat HOME .NET Core C# Android™ AutoIt C C# C++ Chilkat2-Python CkPython Classic ASP DataFlex Delphi ActiveX Delphi DLL Go Java Lianja Mono C# Node.js Objective-C PHP ActiveX PHP Extension Perl PowerBuilder PowerShell PureBasic Ruby SQL Server Swift 2 Swift 3,4,5... Tcl Unicode C Unicode C++ VB.NET VBScript Visual Basic 6.0 Visual FoxPro Xojo Plugin
(PureBasic) UPS Rate RequestSee more UPS ExamplesSimple UPS Rate Example For more information, see https://developer.ups.com/api/reference?loc=en_US#operation/Rate
IncludeFile "CkHttpResponse.pb" IncludeFile "CkHttp.pb" IncludeFile "CkStringBuilder.pb" IncludeFile "CkJsonObject.pb" Procedure ChilkatExample() ; This example assumes the Chilkat API to have been previously unlocked. ; See Global Unlock Sample for sample code. http.i = CkHttp::ckCreate() If http.i = 0 Debug "Failed to create object." ProcedureReturn EndIf ; Use this online tool to generate code from sample JSON: ; Generate Code to Create JSON ; The following JSON is sent in the request body. ; { ; "RateRequest": { ; "Request": { ; "TransactionReference": { ; "CustomerContext": "CustomerContext" ; } ; }, ; "Shipment": { ; "Shipper": { ; "Name": "ShipperName", ; "ShipperNumber": "ShipperNumber", ; "Address": { ; "AddressLine": [ ; "ShipperAddressLine", ; "ShipperAddressLine", ; "ShipperAddressLine" ; ], ; "City": "TIMONIUM", ; "StateProvinceCode": "MD", ; "PostalCode": "21093", ; "CountryCode": "US" ; } ; }, ; "ShipTo": { ; "Name": "ShipToName", ; "Address": { ; "AddressLine": [ ; "ShipToAddressLine", ; "ShipToAddressLine", ; "ShipToAddressLine" ; ], ; "City": "Alpharetta", ; "StateProvinceCode": "GA", ; "PostalCode": "30005", ; "CountryCode": "US" ; } ; }, ; "ShipFrom": { ; "Name": "ShipFromName", ; "Address": { ; "AddressLine": [ ; "ShipFromAddressLine", ; "ShipFromAddressLine", ; "ShipFromAddressLine" ; ], ; "City": "TIMONIUM", ; "StateProvinceCode": "MD", ; "PostalCode": "21093", ; "CountryCode": "US" ; } ; }, ; "PaymentDetails": { ; "ShipmentCharge": { ; "Type": "01", ; "BillShipper": { ; "AccountNumber": "ShipperNumber" ; } ; } ; }, ; "Service": { ; "Code": "03", ; "Description": "Ground" ; }, ; "NumOfPieces": "1", ; "Package": { ; "PackagingType": { ; "Code": "02", ; "Description": "Packaging" ; }, ; "Dimensions": { ; "UnitOfMeasurement": { ; "Code": "IN", ; "Description": "Inches" ; }, ; "Length": "5", ; "Width": "5", ; "Height": "5" ; }, ; "PackageWeight": { ; "UnitOfMeasurement": { ; "Code": "LBS", ; "Description": "Pounds" ; }, ; "Weight": "1" ; } ; } ; } ; } ; } json.i = CkJsonObject::ckCreate() If json.i = 0 Debug "Failed to create object." ProcedureReturn EndIf CkJsonObject::ckUpdateString(json,"RateRequest.Request.TransactionReference.CustomerContext","CustomerContext") CkJsonObject::ckUpdateString(json,"RateRequest.Shipment.Shipper.Name","ShipperName") CkJsonObject::ckUpdateString(json,"RateRequest.Shipment.Shipper.ShipperNumber","ShipperNumber") CkJsonObject::ckUpdateString(json,"RateRequest.Shipment.Shipper.Address.AddressLine[0]","ShipperAddressLine") CkJsonObject::ckUpdateString(json,"RateRequest.Shipment.Shipper.Address.AddressLine[1]","ShipperAddressLine") CkJsonObject::ckUpdateString(json,"RateRequest.Shipment.Shipper.Address.AddressLine[2]","ShipperAddressLine") CkJsonObject::ckUpdateString(json,"RateRequest.Shipment.Shipper.Address.City","TIMONIUM") CkJsonObject::ckUpdateString(json,"RateRequest.Shipment.Shipper.Address.StateProvinceCode","MD") CkJsonObject::ckUpdateString(json,"RateRequest.Shipment.Shipper.Address.PostalCode","21093") CkJsonObject::ckUpdateString(json,"RateRequest.Shipment.Shipper.Address.CountryCode","US") CkJsonObject::ckUpdateString(json,"RateRequest.Shipment.ShipTo.Name","ShipToName") CkJsonObject::ckUpdateString(json,"RateRequest.Shipment.ShipTo.Address.AddressLine[0]","ShipToAddressLine") CkJsonObject::ckUpdateString(json,"RateRequest.Shipment.ShipTo.Address.AddressLine[1]","ShipToAddressLine") CkJsonObject::ckUpdateString(json,"RateRequest.Shipment.ShipTo.Address.AddressLine[2]","ShipToAddressLine") CkJsonObject::ckUpdateString(json,"RateRequest.Shipment.ShipTo.Address.City","Alpharetta") CkJsonObject::ckUpdateString(json,"RateRequest.Shipment.ShipTo.Address.StateProvinceCode","GA") CkJsonObject::ckUpdateString(json,"RateRequest.Shipment.ShipTo.Address.PostalCode","30005") CkJsonObject::ckUpdateString(json,"RateRequest.Shipment.ShipTo.Address.CountryCode","US") CkJsonObject::ckUpdateString(json,"RateRequest.Shipment.ShipFrom.Name","ShipFromName") CkJsonObject::ckUpdateString(json,"RateRequest.Shipment.ShipFrom.Address.AddressLine[0]","ShipFromAddressLine") CkJsonObject::ckUpdateString(json,"RateRequest.Shipment.ShipFrom.Address.AddressLine[1]","ShipFromAddressLine") CkJsonObject::ckUpdateString(json,"RateRequest.Shipment.ShipFrom.Address.AddressLine[2]","ShipFromAddressLine") CkJsonObject::ckUpdateString(json,"RateRequest.Shipment.ShipFrom.Address.City","TIMONIUM") CkJsonObject::ckUpdateString(json,"RateRequest.Shipment.ShipFrom.Address.StateProvinceCode","MD") CkJsonObject::ckUpdateString(json,"RateRequest.Shipment.ShipFrom.Address.PostalCode","21093") CkJsonObject::ckUpdateString(json,"RateRequest.Shipment.ShipFrom.Address.CountryCode","US") CkJsonObject::ckUpdateString(json,"RateRequest.Shipment.PaymentDetails.ShipmentCharge.Type","01") CkJsonObject::ckUpdateString(json,"RateRequest.Shipment.PaymentDetails.ShipmentCharge.BillShipper.AccountNumber","ShipperNumber") CkJsonObject::ckUpdateString(json,"RateRequest.Shipment.Service.Code","03") CkJsonObject::ckUpdateString(json,"RateRequest.Shipment.Service.Description","Ground") CkJsonObject::ckUpdateString(json,"RateRequest.Shipment.NumOfPieces","1") CkJsonObject::ckUpdateString(json,"RateRequest.Shipment.Package.PackagingType.Code","02") CkJsonObject::ckUpdateString(json,"RateRequest.Shipment.Package.PackagingType.Description","Packaging") CkJsonObject::ckUpdateString(json,"RateRequest.Shipment.Package.Dimensions.UnitOfMeasurement.Code","IN") CkJsonObject::ckUpdateString(json,"RateRequest.Shipment.Package.Dimensions.UnitOfMeasurement.Description","Inches") CkJsonObject::ckUpdateString(json,"RateRequest.Shipment.Package.Dimensions.Length","5") CkJsonObject::ckUpdateString(json,"RateRequest.Shipment.Package.Dimensions.Width","5") CkJsonObject::ckUpdateString(json,"RateRequest.Shipment.Package.Dimensions.Height","5") CkJsonObject::ckUpdateString(json,"RateRequest.Shipment.Package.PackageWeight.UnitOfMeasurement.Code","LBS") CkJsonObject::ckUpdateString(json,"RateRequest.Shipment.Package.PackageWeight.UnitOfMeasurement.Description","Pounds") CkJsonObject::ckUpdateString(json,"RateRequest.Shipment.Package.PackageWeight.Weight","1") ; Load the OAuth2 access token obtained via client credentials as shown ; in this UPS OAuth2 Client Credentials example. jsonToken.i = CkJsonObject::ckCreate() If jsonToken.i = 0 Debug "Failed to create object." ProcedureReturn EndIf success.i = CkJsonObject::ckLoadFile(jsonToken,"qa_data/tokens/ups_oauth2_token.json") If success <> 1 Debug "Failed to load ups_oauth2_token.json" CkHttp::ckDispose(http) CkJsonObject::ckDispose(json) CkJsonObject::ckDispose(jsonToken) ProcedureReturn 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. CkHttp::setCkAuthToken(http, CkJsonObject::ckStringOf(jsonToken,"access_token")) CkHttp::ckSetRequestHeader(http,"Content-Type","application/json") CkHttp::ckSetRequestHeader(http,"transId","string") CkHttp::ckSetRequestHeader(http,"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. CkHttp::ckSetUrlVar(http,"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. CkHttp::ckSetUrlVar(http,"requestoption","Rate") resp.i = CkHttp::ckPostJson3(http,"https://wwwcie.ups.com/api/rating/{$version}/{$requestoption}?additionalinfo=string","application/json",json) If CkHttp::ckLastMethodSuccess(http) = 0 Debug CkHttp::ckLastErrorText(http) CkHttp::ckDispose(http) CkJsonObject::ckDispose(json) CkJsonObject::ckDispose(jsonToken) ProcedureReturn EndIf sbResponseBody.i = CkStringBuilder::ckCreate() If sbResponseBody.i = 0 Debug "Failed to create object." ProcedureReturn EndIf CkHttpResponse::ckGetBodySb(resp,sbResponseBody) jResp.i = CkJsonObject::ckCreate() If jResp.i = 0 Debug "Failed to create object." ProcedureReturn EndIf CkJsonObject::ckLoadSb(jResp,sbResponseBody) CkJsonObject::setCkEmitCompact(jResp, 0) Debug "Response Body:" Debug CkJsonObject::ckEmit(jResp) ; ---------------------------------------------------------------------------------------------------------- ; Important: If you get the following error response, read further for the solution.. ; ; { ; "response": { ; "errors": [ ; { ; "code": "250002", ; "message": "Invalid Authentication Information." ; } ; ] ; } ; } ; ; It means you didn't add the Rating API permission to your app. ; To add the Rating API, login to your developer account and go to your Apps page at https://developer.ups.com/apps?loc=en_US ; Then edit your app and add the Rating API. ; ---------------------------------------------------------------------------------------------------------- respStatusCode.i = CkHttpResponse::ckStatusCode(resp) Debug "Response Status Code = " + Str(respStatusCode) If respStatusCode >= 400 Debug "Response Header:" Debug CkHttpResponse::ckHeader(resp) Debug "Failed." CkHttpResponse::ckDispose(resp) CkHttp::ckDispose(http) CkJsonObject::ckDispose(json) CkJsonObject::ckDispose(jsonToken) CkStringBuilder::ckDispose(sbResponseBody) CkJsonObject::ckDispose(jResp) ProcedureReturn EndIf CkHttpResponse::ckDispose(resp) ; 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 Level.s j.i count_j.i Value.s ServiceCode.s ServiceDescription.s RateChart.s BillableWeightCalculationMethod.s RatingMethod.s UnitOfMeasurementCode.s UnitOfMeasurementDescription.s Weight.s CurrencyCode.s MonetaryValue.s BaseServiceChargeCurrencyCode.s BaseServiceChargeMonetaryValue.s GrossChargeCurrencyCode.s GrossChargeMonetaryValue.s DiscountAmountCurrencyCode.s DiscountAmountMonetaryValue.s DiscountPercentage.s NetChargeCurrencyCode.s NetChargeMonetaryValue.s Density.s TotalCubicFeet.s ServiceOptionsChargesCurrencyCode.s ServiceOptionsChargesMonetaryValue.s TotalChargesCurrencyCode.s TotalChargesMonetaryValue.s TotalChargesWithTaxesCurrencyCode.s TotalChargesWithTaxesMonetaryValue.s TotalChargeCurrencyCode.s TotalChargeMonetaryValue.s PickupDate.s DocumentsOnlyIndicator.s PackageBillType.s GuaranteedIndicator.s Disclaimer.s Date.s Time.s BusinessDaysInTransit.s PickupTime.s DayOfWeek.s CustomerCenterCutoff.s DelayCount.s HolidayCount.s RestDays.s TotalTransitDays.s SaturdayDelivery.s SaturdayDeliveryDisclaimer.s SundayDelivery.s SundayDeliveryDisclaimer.s AutoDutyCode.s TimeInTransitDisclaimer.s ScheduledDeliveryDate.s RoarRatedIndicator.s SubType.s Quantity.s TypeCode.s TypeDescription.s UnitOfMeasurement.s Length.s Width.s Height.s AdjustedHeightValue.s AdjustedHeightUnitOfMeasurement.s v_Type.s TransportationChargesCurrencyCode.s TransportationChargesMonetaryValue.s BillingWeightWeight.s SimpleRateCode.s k.i count_k.i nullVal.i ModifierType.s ModifierDesc.s Amount.s Code.s = CkJsonObject::ckStringOf(jResp,"RateResponse.Response.ResponseStatus.Code") Description.s = CkJsonObject::ckStringOf(jResp,"RateResponse.Response.ResponseStatus.Description") CustomerContext.s = CkJsonObject::ckStringOf(jResp,"RateResponse.Response.TransactionReference.CustomerContext") i.i = 0 count_i.i = CkJsonObject::ckSizeOfArray(jResp,"RateResponse.Response.Alert") While i < count_i CkJsonObject::setCkI(jResp, i) Code = CkJsonObject::ckStringOf(jResp,"RateResponse.Response.Alert[i].Code") Description = CkJsonObject::ckStringOf(jResp,"RateResponse.Response.Alert[i].Description") i = i + 1 Wend i = 0 count_i = CkJsonObject::ckSizeOfArray(jResp,"RateResponse.Response.AlertDetail") While i < count_i CkJsonObject::setCkI(jResp, i) Code = CkJsonObject::ckStringOf(jResp,"RateResponse.Response.AlertDetail[i].Code") Description = CkJsonObject::ckStringOf(jResp,"RateResponse.Response.AlertDetail[i].Description") Level = CkJsonObject::ckStringOf(jResp,"RateResponse.Response.AlertDetail[i].ElementLevelInformation.Level") j = 0 count_j = CkJsonObject::ckSizeOfArray(jResp,"RateResponse.Response.AlertDetail[i].ElementLevelInformation.ElementIdentifier") While j < count_j CkJsonObject::setCkJ(jResp, j) Code = CkJsonObject::ckStringOf(jResp,"RateResponse.Response.AlertDetail[i].ElementLevelInformation.ElementIdentifier[j].Code") Value = CkJsonObject::ckStringOf(jResp,"RateResponse.Response.AlertDetail[i].ElementLevelInformation.ElementIdentifier[j].Value") j = j + 1 Wend i = i + 1 Wend i = 0 count_i = CkJsonObject::ckSizeOfArray(jResp,"RateResponse.RatedShipment") While i < count_i CkJsonObject::setCkI(jResp, i) ServiceCode = CkJsonObject::ckStringOf(jResp,"RateResponse.RatedShipment[i].Service.Code") ServiceDescription = CkJsonObject::ckStringOf(jResp,"RateResponse.RatedShipment[i].Service.Description") RateChart = CkJsonObject::ckStringOf(jResp,"RateResponse.RatedShipment[i].RateChart") BillableWeightCalculationMethod = CkJsonObject::ckStringOf(jResp,"RateResponse.RatedShipment[i].BillableWeightCalculationMethod") RatingMethod = CkJsonObject::ckStringOf(jResp,"RateResponse.RatedShipment[i].RatingMethod") UnitOfMeasurementCode = CkJsonObject::ckStringOf(jResp,"RateResponse.RatedShipment[i].BillingWeight.UnitOfMeasurement.Code") UnitOfMeasurementDescription = CkJsonObject::ckStringOf(jResp,"RateResponse.RatedShipment[i].BillingWeight.UnitOfMeasurement.Description") Weight = CkJsonObject::ckStringOf(jResp,"RateResponse.RatedShipment[i].BillingWeight.Weight") CurrencyCode = CkJsonObject::ckStringOf(jResp,"RateResponse.RatedShipment[i].TransportationCharges.CurrencyCode") MonetaryValue = CkJsonObject::ckStringOf(jResp,"RateResponse.RatedShipment[i].TransportationCharges.MonetaryValue") BaseServiceChargeCurrencyCode = CkJsonObject::ckStringOf(jResp,"RateResponse.RatedShipment[i].BaseServiceCharge.CurrencyCode") BaseServiceChargeMonetaryValue = CkJsonObject::ckStringOf(jResp,"RateResponse.RatedShipment[i].BaseServiceCharge.MonetaryValue") GrossChargeCurrencyCode = CkJsonObject::ckStringOf(jResp,"RateResponse.RatedShipment[i].FRSShipmentData.TransportationCharges.GrossCharge.CurrencyCode") GrossChargeMonetaryValue = CkJsonObject::ckStringOf(jResp,"RateResponse.RatedShipment[i].FRSShipmentData.TransportationCharges.GrossCharge.MonetaryValue") DiscountAmountCurrencyCode = CkJsonObject::ckStringOf(jResp,"RateResponse.RatedShipment[i].FRSShipmentData.TransportationCharges.DiscountAmount.CurrencyCode") DiscountAmountMonetaryValue = CkJsonObject::ckStringOf(jResp,"RateResponse.RatedShipment[i].FRSShipmentData.TransportationCharges.DiscountAmount.MonetaryValue") DiscountPercentage = CkJsonObject::ckStringOf(jResp,"RateResponse.RatedShipment[i].FRSShipmentData.TransportationCharges.DiscountPercentage") NetChargeCurrencyCode = CkJsonObject::ckStringOf(jResp,"RateResponse.RatedShipment[i].FRSShipmentData.TransportationCharges.NetCharge.CurrencyCode") NetChargeMonetaryValue = CkJsonObject::ckStringOf(jResp,"RateResponse.RatedShipment[i].FRSShipmentData.TransportationCharges.NetCharge.MonetaryValue") Density = CkJsonObject::ckStringOf(jResp,"RateResponse.RatedShipment[i].FRSShipmentData.FreightDensityRate.Density") TotalCubicFeet = CkJsonObject::ckStringOf(jResp,"RateResponse.RatedShipment[i].FRSShipmentData.FreightDensityRate.TotalCubicFeet") ServiceOptionsChargesCurrencyCode = CkJsonObject::ckStringOf(jResp,"RateResponse.RatedShipment[i].ServiceOptionsCharges.CurrencyCode") ServiceOptionsChargesMonetaryValue = CkJsonObject::ckStringOf(jResp,"RateResponse.RatedShipment[i].ServiceOptionsCharges.MonetaryValue") TotalChargesCurrencyCode = CkJsonObject::ckStringOf(jResp,"RateResponse.RatedShipment[i].TotalCharges.CurrencyCode") TotalChargesMonetaryValue = CkJsonObject::ckStringOf(jResp,"RateResponse.RatedShipment[i].TotalCharges.MonetaryValue") TotalChargesWithTaxesCurrencyCode = CkJsonObject::ckStringOf(jResp,"RateResponse.RatedShipment[i].TotalChargesWithTaxes.CurrencyCode") TotalChargesWithTaxesMonetaryValue = CkJsonObject::ckStringOf(jResp,"RateResponse.RatedShipment[i].TotalChargesWithTaxes.MonetaryValue") TotalChargeCurrencyCode = CkJsonObject::ckStringOf(jResp,"RateResponse.RatedShipment[i].NegotiatedRateCharges.TotalCharge.CurrencyCode") TotalChargeMonetaryValue = CkJsonObject::ckStringOf(jResp,"RateResponse.RatedShipment[i].NegotiatedRateCharges.TotalCharge.MonetaryValue") TotalChargesWithTaxesCurrencyCode = CkJsonObject::ckStringOf(jResp,"RateResponse.RatedShipment[i].NegotiatedRateCharges.TotalChargesWithTaxes.CurrencyCode") TotalChargesWithTaxesMonetaryValue = CkJsonObject::ckStringOf(jResp,"RateResponse.RatedShipment[i].NegotiatedRateCharges.TotalChargesWithTaxes.MonetaryValue") PickupDate = CkJsonObject::ckStringOf(jResp,"RateResponse.RatedShipment[i].TimeInTransit.PickupDate") DocumentsOnlyIndicator = CkJsonObject::ckStringOf(jResp,"RateResponse.RatedShipment[i].TimeInTransit.DocumentsOnlyIndicator") PackageBillType = CkJsonObject::ckStringOf(jResp,"RateResponse.RatedShipment[i].TimeInTransit.PackageBillType") ServiceDescription = CkJsonObject::ckStringOf(jResp,"RateResponse.RatedShipment[i].TimeInTransit.ServiceSummary.Service.Description") GuaranteedIndicator = CkJsonObject::ckStringOf(jResp,"RateResponse.RatedShipment[i].TimeInTransit.ServiceSummary.GuaranteedIndicator") Disclaimer = CkJsonObject::ckStringOf(jResp,"RateResponse.RatedShipment[i].TimeInTransit.ServiceSummary.Disclaimer") Date = CkJsonObject::ckStringOf(jResp,"RateResponse.RatedShipment[i].TimeInTransit.ServiceSummary.EstimatedArrival.Arrival.Date") Time = CkJsonObject::ckStringOf(jResp,"RateResponse.RatedShipment[i].TimeInTransit.ServiceSummary.EstimatedArrival.Arrival.Time") BusinessDaysInTransit = CkJsonObject::ckStringOf(jResp,"RateResponse.RatedShipment[i].TimeInTransit.ServiceSummary.EstimatedArrival.BusinessDaysInTransit") PickupDate = CkJsonObject::ckStringOf(jResp,"RateResponse.RatedShipment[i].TimeInTransit.ServiceSummary.EstimatedArrival.Pickup.Date") PickupTime = CkJsonObject::ckStringOf(jResp,"RateResponse.RatedShipment[i].TimeInTransit.ServiceSummary.EstimatedArrival.Pickup.Time") DayOfWeek = CkJsonObject::ckStringOf(jResp,"RateResponse.RatedShipment[i].TimeInTransit.ServiceSummary.EstimatedArrival.DayOfWeek") CustomerCenterCutoff = CkJsonObject::ckStringOf(jResp,"RateResponse.RatedShipment[i].TimeInTransit.ServiceSummary.EstimatedArrival.CustomerCenterCutoff") DelayCount = CkJsonObject::ckStringOf(jResp,"RateResponse.RatedShipment[i].TimeInTransit.ServiceSummary.EstimatedArrival.DelayCount") HolidayCount = CkJsonObject::ckStringOf(jResp,"RateResponse.RatedShipment[i].TimeInTransit.ServiceSummary.EstimatedArrival.HolidayCount") RestDays = CkJsonObject::ckStringOf(jResp,"RateResponse.RatedShipment[i].TimeInTransit.ServiceSummary.EstimatedArrival.RestDays") TotalTransitDays = CkJsonObject::ckStringOf(jResp,"RateResponse.RatedShipment[i].TimeInTransit.ServiceSummary.EstimatedArrival.TotalTransitDays") SaturdayDelivery = CkJsonObject::ckStringOf(jResp,"RateResponse.RatedShipment[i].TimeInTransit.ServiceSummary.SaturdayDelivery") SaturdayDeliveryDisclaimer = CkJsonObject::ckStringOf(jResp,"RateResponse.RatedShipment[i].TimeInTransit.ServiceSummary.SaturdayDeliveryDisclaimer") SundayDelivery = CkJsonObject::ckStringOf(jResp,"RateResponse.RatedShipment[i].TimeInTransit.ServiceSummary.SundayDelivery") SundayDeliveryDisclaimer = CkJsonObject::ckStringOf(jResp,"RateResponse.RatedShipment[i].TimeInTransit.ServiceSummary.SundayDeliveryDisclaimer") AutoDutyCode = CkJsonObject::ckStringOf(jResp,"RateResponse.RatedShipment[i].TimeInTransit.AutoDutyCode") TimeInTransitDisclaimer = CkJsonObject::ckStringOf(jResp,"RateResponse.RatedShipment[i].TimeInTransit.Disclaimer") ScheduledDeliveryDate = CkJsonObject::ckStringOf(jResp,"RateResponse.RatedShipment[i].ScheduledDeliveryDate") RoarRatedIndicator = CkJsonObject::ckStringOf(jResp,"RateResponse.RatedShipment[i].RoarRatedIndicator") j = 0 count_j = CkJsonObject::ckSizeOfArray(jResp,"RateResponse.RatedShipment[i].Disclaimer") While j < count_j CkJsonObject::setCkJ(jResp, j) Code = CkJsonObject::ckStringOf(jResp,"RateResponse.RatedShipment[i].Disclaimer[j].Code") Description = CkJsonObject::ckStringOf(jResp,"RateResponse.RatedShipment[i].Disclaimer[j].Description") j = j + 1 Wend j = 0 count_j = CkJsonObject::ckSizeOfArray(jResp,"RateResponse.RatedShipment[i].RatedShipmentAlert") While j < count_j CkJsonObject::setCkJ(jResp, j) Code = CkJsonObject::ckStringOf(jResp,"RateResponse.RatedShipment[i].RatedShipmentAlert[j].Code") Description = CkJsonObject::ckStringOf(jResp,"RateResponse.RatedShipment[i].RatedShipmentAlert[j].Description") j = j + 1 Wend j = 0 count_j = CkJsonObject::ckSizeOfArray(jResp,"RateResponse.RatedShipment[i].ItemizedCharges") While j < count_j CkJsonObject::setCkJ(jResp, j) Code = CkJsonObject::ckStringOf(jResp,"RateResponse.RatedShipment[i].ItemizedCharges[j].Code") Description = CkJsonObject::ckStringOf(jResp,"RateResponse.RatedShipment[i].ItemizedCharges[j].Description") CurrencyCode = CkJsonObject::ckStringOf(jResp,"RateResponse.RatedShipment[i].ItemizedCharges[j].CurrencyCode") MonetaryValue = CkJsonObject::ckStringOf(jResp,"RateResponse.RatedShipment[i].ItemizedCharges[j].MonetaryValue") SubType = CkJsonObject::ckStringOf(jResp,"RateResponse.RatedShipment[i].ItemizedCharges[j].SubType") j = j + 1 Wend j = 0 count_j = CkJsonObject::ckSizeOfArray(jResp,"RateResponse.RatedShipment[i].FRSShipmentData.HandlingUnits") While j < count_j CkJsonObject::setCkJ(jResp, j) Quantity = CkJsonObject::ckStringOf(jResp,"RateResponse.RatedShipment[i].FRSShipmentData.HandlingUnits[j].Quantity") TypeCode = CkJsonObject::ckStringOf(jResp,"RateResponse.RatedShipment[i].FRSShipmentData.HandlingUnits[j].Type.Code") TypeDescription = CkJsonObject::ckStringOf(jResp,"RateResponse.RatedShipment[i].FRSShipmentData.HandlingUnits[j].Type.Description") UnitOfMeasurement = CkJsonObject::ckStringOf(jResp,"RateResponse.RatedShipment[i].FRSShipmentData.HandlingUnits[j].Dimensions.UnitOfMeasurement") Length = CkJsonObject::ckStringOf(jResp,"RateResponse.RatedShipment[i].FRSShipmentData.HandlingUnits[j].Dimensions.Length") Width = CkJsonObject::ckStringOf(jResp,"RateResponse.RatedShipment[i].FRSShipmentData.HandlingUnits[j].Dimensions.Width") Height = CkJsonObject::ckStringOf(jResp,"RateResponse.RatedShipment[i].FRSShipmentData.HandlingUnits[j].Dimensions.Height") AdjustedHeightValue = CkJsonObject::ckStringOf(jResp,"RateResponse.RatedShipment[i].FRSShipmentData.HandlingUnits[j].AdjustedHeight.Value") AdjustedHeightUnitOfMeasurement = CkJsonObject::ckStringOf(jResp,"RateResponse.RatedShipment[i].FRSShipmentData.HandlingUnits[j].AdjustedHeight.UnitOfMeasurement") j = j + 1 Wend j = 0 count_j = CkJsonObject::ckSizeOfArray(jResp,"RateResponse.RatedShipment[i].TaxCharges") While j < count_j CkJsonObject::setCkJ(jResp, j) v_Type = CkJsonObject::ckStringOf(jResp,"RateResponse.RatedShipment[i].TaxCharges[j].Type") MonetaryValue = CkJsonObject::ckStringOf(jResp,"RateResponse.RatedShipment[i].TaxCharges[j].MonetaryValue") j = j + 1 Wend j = 0 count_j = CkJsonObject::ckSizeOfArray(jResp,"RateResponse.RatedShipment[i].NegotiatedRateCharges.ItemizedCharges") While j < count_j CkJsonObject::setCkJ(jResp, j) Code = CkJsonObject::ckStringOf(jResp,"RateResponse.RatedShipment[i].NegotiatedRateCharges.ItemizedCharges[j].Code") Description = CkJsonObject::ckStringOf(jResp,"RateResponse.RatedShipment[i].NegotiatedRateCharges.ItemizedCharges[j].Description") CurrencyCode = CkJsonObject::ckStringOf(jResp,"RateResponse.RatedShipment[i].NegotiatedRateCharges.ItemizedCharges[j].CurrencyCode") MonetaryValue = CkJsonObject::ckStringOf(jResp,"RateResponse.RatedShipment[i].NegotiatedRateCharges.ItemizedCharges[j].MonetaryValue") SubType = CkJsonObject::ckStringOf(jResp,"RateResponse.RatedShipment[i].NegotiatedRateCharges.ItemizedCharges[j].SubType") j = j + 1 Wend j = 0 count_j = CkJsonObject::ckSizeOfArray(jResp,"RateResponse.RatedShipment[i].NegotiatedRateCharges.TaxCharges") While j < count_j CkJsonObject::setCkJ(jResp, j) v_Type = CkJsonObject::ckStringOf(jResp,"RateResponse.RatedShipment[i].NegotiatedRateCharges.TaxCharges[j].Type") MonetaryValue = CkJsonObject::ckStringOf(jResp,"RateResponse.RatedShipment[i].NegotiatedRateCharges.TaxCharges[j].MonetaryValue") j = j + 1 Wend j = 0 count_j = CkJsonObject::ckSizeOfArray(jResp,"RateResponse.RatedShipment[i].RatedPackage") While j < count_j CkJsonObject::setCkJ(jResp, j) BaseServiceChargeCurrencyCode = CkJsonObject::ckStringOf(jResp,"RateResponse.RatedShipment[i].RatedPackage[j].BaseServiceCharge.CurrencyCode") BaseServiceChargeMonetaryValue = CkJsonObject::ckStringOf(jResp,"RateResponse.RatedShipment[i].RatedPackage[j].BaseServiceCharge.MonetaryValue") TransportationChargesCurrencyCode = CkJsonObject::ckStringOf(jResp,"RateResponse.RatedShipment[i].RatedPackage[j].TransportationCharges.CurrencyCode") TransportationChargesMonetaryValue = CkJsonObject::ckStringOf(jResp,"RateResponse.RatedShipment[i].RatedPackage[j].TransportationCharges.MonetaryValue") ServiceOptionsChargesCurrencyCode = CkJsonObject::ckStringOf(jResp,"RateResponse.RatedShipment[i].RatedPackage[j].ServiceOptionsCharges.CurrencyCode") ServiceOptionsChargesMonetaryValue = CkJsonObject::ckStringOf(jResp,"RateResponse.RatedShipment[i].RatedPackage[j].ServiceOptionsCharges.MonetaryValue") TotalChargesCurrencyCode = CkJsonObject::ckStringOf(jResp,"RateResponse.RatedShipment[i].RatedPackage[j].TotalCharges.CurrencyCode") TotalChargesMonetaryValue = CkJsonObject::ckStringOf(jResp,"RateResponse.RatedShipment[i].RatedPackage[j].TotalCharges.MonetaryValue") Weight = CkJsonObject::ckStringOf(jResp,"RateResponse.RatedShipment[i].RatedPackage[j].Weight") UnitOfMeasurementCode = CkJsonObject::ckStringOf(jResp,"RateResponse.RatedShipment[i].RatedPackage[j].BillingWeight.UnitOfMeasurement.Code") UnitOfMeasurementDescription = CkJsonObject::ckStringOf(jResp,"RateResponse.RatedShipment[i].RatedPackage[j].BillingWeight.UnitOfMeasurement.Description") BillingWeightWeight = CkJsonObject::ckStringOf(jResp,"RateResponse.RatedShipment[i].RatedPackage[j].BillingWeight.Weight") SimpleRateCode = CkJsonObject::ckStringOf(jResp,"RateResponse.RatedShipment[i].RatedPackage[j].SimpleRate.Code") k = 0 count_k = CkJsonObject::ckSizeOfArray(jResp,"RateResponse.RatedShipment[i].RatedPackage[j].Accessorial") While k < count_k CkJsonObject::setCkK(jResp, k) Code = CkJsonObject::ckStringOf(jResp,"RateResponse.RatedShipment[i].RatedPackage[j].Accessorial[k].Code") Description = CkJsonObject::ckStringOf(jResp,"RateResponse.RatedShipment[i].RatedPackage[j].Accessorial[k].Description") k = k + 1 Wend k = 0 count_k = CkJsonObject::ckSizeOfArray(jResp,"RateResponse.RatedShipment[i].RatedPackage[j].ItemizedCharges") While k < count_k CkJsonObject::setCkK(jResp, k) Code = CkJsonObject::ckStringOf(jResp,"RateResponse.RatedShipment[i].RatedPackage[j].ItemizedCharges[k].Code") Description = CkJsonObject::ckStringOf(jResp,"RateResponse.RatedShipment[i].RatedPackage[j].ItemizedCharges[k].Description") CurrencyCode = CkJsonObject::ckStringOf(jResp,"RateResponse.RatedShipment[i].RatedPackage[j].ItemizedCharges[k].CurrencyCode") MonetaryValue = CkJsonObject::ckStringOf(jResp,"RateResponse.RatedShipment[i].RatedPackage[j].ItemizedCharges[k].MonetaryValue") SubType = CkJsonObject::ckStringOf(jResp,"RateResponse.RatedShipment[i].RatedPackage[j].ItemizedCharges[k].SubType") k = k + 1 Wend k = 0 count_k = CkJsonObject::ckSizeOfArray(jResp,"RateResponse.RatedShipment[i].RatedPackage[j].NegotiatedCharges.ItemizedCharges") While k < count_k CkJsonObject::setCkK(jResp, k) nullVal = CkJsonObject::ckIsNullOf(jResp,"RateResponse.RatedShipment[i].RatedPackage[j].NegotiatedCharges.ItemizedCharges[k]") k = k + 1 Wend k = 0 count_k = CkJsonObject::ckSizeOfArray(jResp,"RateResponse.RatedShipment[i].RatedPackage[j].RateModifier") While k < count_k CkJsonObject::setCkK(jResp, k) ModifierType = CkJsonObject::ckStringOf(jResp,"RateResponse.RatedShipment[i].RatedPackage[j].RateModifier[k].ModifierType") ModifierDesc = CkJsonObject::ckStringOf(jResp,"RateResponse.RatedShipment[i].RatedPackage[j].RateModifier[k].ModifierDesc") Amount = CkJsonObject::ckStringOf(jResp,"RateResponse.RatedShipment[i].RatedPackage[j].RateModifier[k].Amount") k = k + 1 Wend j = j + 1 Wend i = i + 1 Wend CkHttp::ckDispose(http) CkJsonObject::ckDispose(json) CkJsonObject::ckDispose(jsonToken) CkStringBuilder::ckDispose(sbResponseBody) CkJsonObject::ckDispose(jResp) ProcedureReturn EndProcedure |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.