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
(C) UPS Rate RequestSee more UPS ExamplesSimple UPS Rate Example For more information, see https://developer.ups.com/api/reference?loc=en_US#operation/Rate
#include <C_CkHttp.h> #include <C_CkJsonObject.h> #include <C_CkHttpResponse.h> #include <C_CkStringBuilder.h> void ChilkatSample(void) { HCkHttp http; HCkJsonObject json; HCkJsonObject jsonToken; BOOL success; HCkHttpResponse resp; HCkStringBuilder sbResponseBody; HCkJsonObject jResp; int respStatusCode; const char *Level; int j; int count_j; const char *Value; const char *ServiceCode; const char *ServiceDescription; const char *RateChart; const char *BillableWeightCalculationMethod; const char *RatingMethod; const char *UnitOfMeasurementCode; const char *UnitOfMeasurementDescription; const char *Weight; const char *CurrencyCode; const char *MonetaryValue; const char *BaseServiceChargeCurrencyCode; const char *BaseServiceChargeMonetaryValue; const char *GrossChargeCurrencyCode; const char *GrossChargeMonetaryValue; const char *DiscountAmountCurrencyCode; const char *DiscountAmountMonetaryValue; const char *DiscountPercentage; const char *NetChargeCurrencyCode; const char *NetChargeMonetaryValue; const char *Density; const char *TotalCubicFeet; const char *ServiceOptionsChargesCurrencyCode; const char *ServiceOptionsChargesMonetaryValue; const char *TotalChargesCurrencyCode; const char *TotalChargesMonetaryValue; const char *TotalChargesWithTaxesCurrencyCode; const char *TotalChargesWithTaxesMonetaryValue; const char *TotalChargeCurrencyCode; const char *TotalChargeMonetaryValue; const char *PickupDate; const char *DocumentsOnlyIndicator; const char *PackageBillType; const char *GuaranteedIndicator; const char *Disclaimer; const char *Date; const char *Time; const char *BusinessDaysInTransit; const char *PickupTime; const char *DayOfWeek; const char *CustomerCenterCutoff; const char *DelayCount; const char *HolidayCount; const char *RestDays; const char *TotalTransitDays; const char *SaturdayDelivery; const char *SaturdayDeliveryDisclaimer; const char *SundayDelivery; const char *SundayDeliveryDisclaimer; const char *AutoDutyCode; const char *TimeInTransitDisclaimer; const char *ScheduledDeliveryDate; const char *RoarRatedIndicator; const char *SubType; const char *Quantity; const char *TypeCode; const char *TypeDescription; const char *UnitOfMeasurement; const char *Length; const char *Width; const char *Height; const char *AdjustedHeightValue; const char *AdjustedHeightUnitOfMeasurement; const char *v_Type; const char *TransportationChargesCurrencyCode; const char *TransportationChargesMonetaryValue; const char *BillingWeightWeight; const char *SimpleRateCode; int k; int count_k; BOOL nullVal; const char *ModifierType; const char *ModifierDesc; const char *Amount; const char *Code; const char *Description; const char *CustomerContext; int i; int count_i; // This example assumes the Chilkat API to have been previously unlocked. // See Global Unlock Sample for sample code. http = CkHttp_Create(); // Use this online tool to generate code from sample JSON: // Generate Code to Create JSON // The following JSON is sent in the request body. // { // "RateRequest": { // "Request": { // "TransactionReference": { // "CustomerContext": "CustomerContext" // } // }, // "Shipment": { // "Shipper": { // "Name": "ShipperName", // "ShipperNumber": "ShipperNumber", // "Address": { // "AddressLine": [ // "ShipperAddressLine", // "ShipperAddressLine", // "ShipperAddressLine" // ], // "City": "TIMONIUM", // "StateProvinceCode": "MD", // "PostalCode": "21093", // "CountryCode": "US" // } // }, // "ShipTo": { // "Name": "ShipToName", // "Address": { // "AddressLine": [ // "ShipToAddressLine", // "ShipToAddressLine", // "ShipToAddressLine" // ], // "City": "Alpharetta", // "StateProvinceCode": "GA", // "PostalCode": "30005", // "CountryCode": "US" // } // }, // "ShipFrom": { // "Name": "ShipFromName", // "Address": { // "AddressLine": [ // "ShipFromAddressLine", // "ShipFromAddressLine", // "ShipFromAddressLine" // ], // "City": "TIMONIUM", // "StateProvinceCode": "MD", // "PostalCode": "21093", // "CountryCode": "US" // } // }, // "PaymentDetails": { // "ShipmentCharge": { // "Type": "01", // "BillShipper": { // "AccountNumber": "ShipperNumber" // } // } // }, // "Service": { // "Code": "03", // "Description": "Ground" // }, // "NumOfPieces": "1", // "Package": { // "PackagingType": { // "Code": "02", // "Description": "Packaging" // }, // "Dimensions": { // "UnitOfMeasurement": { // "Code": "IN", // "Description": "Inches" // }, // "Length": "5", // "Width": "5", // "Height": "5" // }, // "PackageWeight": { // "UnitOfMeasurement": { // "Code": "LBS", // "Description": "Pounds" // }, // "Weight": "1" // } // } // } // } // } json = CkJsonObject_Create(); CkJsonObject_UpdateString(json,"RateRequest.Request.TransactionReference.CustomerContext","CustomerContext"); CkJsonObject_UpdateString(json,"RateRequest.Shipment.Shipper.Name","ShipperName"); CkJsonObject_UpdateString(json,"RateRequest.Shipment.Shipper.ShipperNumber","ShipperNumber"); CkJsonObject_UpdateString(json,"RateRequest.Shipment.Shipper.Address.AddressLine[0]","ShipperAddressLine"); CkJsonObject_UpdateString(json,"RateRequest.Shipment.Shipper.Address.AddressLine[1]","ShipperAddressLine"); CkJsonObject_UpdateString(json,"RateRequest.Shipment.Shipper.Address.AddressLine[2]","ShipperAddressLine"); CkJsonObject_UpdateString(json,"RateRequest.Shipment.Shipper.Address.City","TIMONIUM"); CkJsonObject_UpdateString(json,"RateRequest.Shipment.Shipper.Address.StateProvinceCode","MD"); CkJsonObject_UpdateString(json,"RateRequest.Shipment.Shipper.Address.PostalCode","21093"); CkJsonObject_UpdateString(json,"RateRequest.Shipment.Shipper.Address.CountryCode","US"); CkJsonObject_UpdateString(json,"RateRequest.Shipment.ShipTo.Name","ShipToName"); CkJsonObject_UpdateString(json,"RateRequest.Shipment.ShipTo.Address.AddressLine[0]","ShipToAddressLine"); CkJsonObject_UpdateString(json,"RateRequest.Shipment.ShipTo.Address.AddressLine[1]","ShipToAddressLine"); CkJsonObject_UpdateString(json,"RateRequest.Shipment.ShipTo.Address.AddressLine[2]","ShipToAddressLine"); CkJsonObject_UpdateString(json,"RateRequest.Shipment.ShipTo.Address.City","Alpharetta"); CkJsonObject_UpdateString(json,"RateRequest.Shipment.ShipTo.Address.StateProvinceCode","GA"); CkJsonObject_UpdateString(json,"RateRequest.Shipment.ShipTo.Address.PostalCode","30005"); CkJsonObject_UpdateString(json,"RateRequest.Shipment.ShipTo.Address.CountryCode","US"); CkJsonObject_UpdateString(json,"RateRequest.Shipment.ShipFrom.Name","ShipFromName"); CkJsonObject_UpdateString(json,"RateRequest.Shipment.ShipFrom.Address.AddressLine[0]","ShipFromAddressLine"); CkJsonObject_UpdateString(json,"RateRequest.Shipment.ShipFrom.Address.AddressLine[1]","ShipFromAddressLine"); CkJsonObject_UpdateString(json,"RateRequest.Shipment.ShipFrom.Address.AddressLine[2]","ShipFromAddressLine"); CkJsonObject_UpdateString(json,"RateRequest.Shipment.ShipFrom.Address.City","TIMONIUM"); CkJsonObject_UpdateString(json,"RateRequest.Shipment.ShipFrom.Address.StateProvinceCode","MD"); CkJsonObject_UpdateString(json,"RateRequest.Shipment.ShipFrom.Address.PostalCode","21093"); CkJsonObject_UpdateString(json,"RateRequest.Shipment.ShipFrom.Address.CountryCode","US"); CkJsonObject_UpdateString(json,"RateRequest.Shipment.PaymentDetails.ShipmentCharge.Type","01"); CkJsonObject_UpdateString(json,"RateRequest.Shipment.PaymentDetails.ShipmentCharge.BillShipper.AccountNumber","ShipperNumber"); CkJsonObject_UpdateString(json,"RateRequest.Shipment.Service.Code","03"); CkJsonObject_UpdateString(json,"RateRequest.Shipment.Service.Description","Ground"); CkJsonObject_UpdateString(json,"RateRequest.Shipment.NumOfPieces","1"); CkJsonObject_UpdateString(json,"RateRequest.Shipment.Package.PackagingType.Code","02"); CkJsonObject_UpdateString(json,"RateRequest.Shipment.Package.PackagingType.Description","Packaging"); CkJsonObject_UpdateString(json,"RateRequest.Shipment.Package.Dimensions.UnitOfMeasurement.Code","IN"); CkJsonObject_UpdateString(json,"RateRequest.Shipment.Package.Dimensions.UnitOfMeasurement.Description","Inches"); CkJsonObject_UpdateString(json,"RateRequest.Shipment.Package.Dimensions.Length","5"); CkJsonObject_UpdateString(json,"RateRequest.Shipment.Package.Dimensions.Width","5"); CkJsonObject_UpdateString(json,"RateRequest.Shipment.Package.Dimensions.Height","5"); CkJsonObject_UpdateString(json,"RateRequest.Shipment.Package.PackageWeight.UnitOfMeasurement.Code","LBS"); CkJsonObject_UpdateString(json,"RateRequest.Shipment.Package.PackageWeight.UnitOfMeasurement.Description","Pounds"); CkJsonObject_UpdateString(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 = CkJsonObject_Create(); success = CkJsonObject_LoadFile(jsonToken,"qa_data/tokens/ups_oauth2_token.json"); if (success != TRUE) { printf("Failed to load ups_oauth2_token.json\n"); CkHttp_Dispose(http); CkJsonObject_Dispose(json); CkJsonObject_Dispose(jsonToken); return; } // The access token JSON looks something like this: // { // "token_type": "Bearer", // "issued_at": "1686911985606", // "client_id": "2498righ8wr6aihe98rt8rhowirtyw9er6twe80rtywrehrt", // "access_token": "eyJraW......R2sbqrY", // "expires_in": "14399", // "status": "approved" // } // Adds the "Authorization: Bearer <YOUR_TOKEN_HERE>" header. CkHttp_putAuthToken(http,CkJsonObject_stringOf(jsonToken,"access_token")); CkHttp_SetRequestHeader(http,"Content-Type","application/json"); CkHttp_SetRequestHeader(http,"transId","string"); CkHttp_SetRequestHeader(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_SetUrlVar(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_SetUrlVar(http,"requestoption","Rate"); resp = CkHttp_PostJson3(http,"https://wwwcie.ups.com/api/rating/{$version}/{$requestoption}?additionalinfo=string","application/json",json); if (CkHttp_getLastMethodSuccess(http) == FALSE) { printf("%s\n",CkHttp_lastErrorText(http)); CkHttp_Dispose(http); CkJsonObject_Dispose(json); CkJsonObject_Dispose(jsonToken); return; } sbResponseBody = CkStringBuilder_Create(); CkHttpResponse_GetBodySb(resp,sbResponseBody); jResp = CkJsonObject_Create(); CkJsonObject_LoadSb(jResp,sbResponseBody); CkJsonObject_putEmitCompact(jResp,FALSE); printf("Response Body:\n"); printf("%s\n",CkJsonObject_emit(jResp)); // ---------------------------------------------------------------------------------------------------------- // Important: If you get the following error response, read further for the solution.. // // { // "response": { // "errors": [ // { // "code": "250002", // "message": "Invalid Authentication Information." // } // ] // } // } // // It means you didn't add the Rating API permission to your app. // To add the Rating API, login to your developer account and go to your Apps page at https://developer.ups.com/apps?loc=en_US // Then edit your app and add the Rating API. // ---------------------------------------------------------------------------------------------------------- respStatusCode = CkHttpResponse_getStatusCode(resp); printf("Response Status Code = %d\n",respStatusCode); if (respStatusCode >= 400) { printf("Response Header:\n"); printf("%s\n",CkHttpResponse_header(resp)); printf("Failed.\n"); CkHttpResponse_Dispose(resp); CkHttp_Dispose(http); CkJsonObject_Dispose(json); CkJsonObject_Dispose(jsonToken); CkStringBuilder_Dispose(sbResponseBody); CkJsonObject_Dispose(jResp); return; } CkHttpResponse_Dispose(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 // Chilkat functions returning "const char *" return a pointer to temporary internal memory owned and managed by Chilkat. // See this example explaining how this memory should be used: const char * functions. Code = CkJsonObject_stringOf(jResp,"RateResponse.Response.ResponseStatus.Code"); Description = CkJsonObject_stringOf(jResp,"RateResponse.Response.ResponseStatus.Description"); CustomerContext = CkJsonObject_stringOf(jResp,"RateResponse.Response.TransactionReference.CustomerContext"); i = 0; count_i = CkJsonObject_SizeOfArray(jResp,"RateResponse.Response.Alert"); while (i < count_i) { CkJsonObject_putI(jResp,i); Code = CkJsonObject_stringOf(jResp,"RateResponse.Response.Alert[i].Code"); Description = CkJsonObject_stringOf(jResp,"RateResponse.Response.Alert[i].Description"); i = i + 1; } i = 0; count_i = CkJsonObject_SizeOfArray(jResp,"RateResponse.Response.AlertDetail"); while (i < count_i) { CkJsonObject_putI(jResp,i); Code = CkJsonObject_stringOf(jResp,"RateResponse.Response.AlertDetail[i].Code"); Description = CkJsonObject_stringOf(jResp,"RateResponse.Response.AlertDetail[i].Description"); Level = CkJsonObject_stringOf(jResp,"RateResponse.Response.AlertDetail[i].ElementLevelInformation.Level"); j = 0; count_j = CkJsonObject_SizeOfArray(jResp,"RateResponse.Response.AlertDetail[i].ElementLevelInformation.ElementIdentifier"); while (j < count_j) { CkJsonObject_putJ(jResp,j); Code = CkJsonObject_stringOf(jResp,"RateResponse.Response.AlertDetail[i].ElementLevelInformation.ElementIdentifier[j].Code"); Value = CkJsonObject_stringOf(jResp,"RateResponse.Response.AlertDetail[i].ElementLevelInformation.ElementIdentifier[j].Value"); j = j + 1; } i = i + 1; } i = 0; count_i = CkJsonObject_SizeOfArray(jResp,"RateResponse.RatedShipment"); while (i < count_i) { CkJsonObject_putI(jResp,i); ServiceCode = CkJsonObject_stringOf(jResp,"RateResponse.RatedShipment[i].Service.Code"); ServiceDescription = CkJsonObject_stringOf(jResp,"RateResponse.RatedShipment[i].Service.Description"); RateChart = CkJsonObject_stringOf(jResp,"RateResponse.RatedShipment[i].RateChart"); BillableWeightCalculationMethod = CkJsonObject_stringOf(jResp,"RateResponse.RatedShipment[i].BillableWeightCalculationMethod"); RatingMethod = CkJsonObject_stringOf(jResp,"RateResponse.RatedShipment[i].RatingMethod"); UnitOfMeasurementCode = CkJsonObject_stringOf(jResp,"RateResponse.RatedShipment[i].BillingWeight.UnitOfMeasurement.Code"); UnitOfMeasurementDescription = CkJsonObject_stringOf(jResp,"RateResponse.RatedShipment[i].BillingWeight.UnitOfMeasurement.Description"); Weight = CkJsonObject_stringOf(jResp,"RateResponse.RatedShipment[i].BillingWeight.Weight"); CurrencyCode = CkJsonObject_stringOf(jResp,"RateResponse.RatedShipment[i].TransportationCharges.CurrencyCode"); MonetaryValue = CkJsonObject_stringOf(jResp,"RateResponse.RatedShipment[i].TransportationCharges.MonetaryValue"); BaseServiceChargeCurrencyCode = CkJsonObject_stringOf(jResp,"RateResponse.RatedShipment[i].BaseServiceCharge.CurrencyCode"); BaseServiceChargeMonetaryValue = CkJsonObject_stringOf(jResp,"RateResponse.RatedShipment[i].BaseServiceCharge.MonetaryValue"); GrossChargeCurrencyCode = CkJsonObject_stringOf(jResp,"RateResponse.RatedShipment[i].FRSShipmentData.TransportationCharges.GrossCharge.CurrencyCode"); GrossChargeMonetaryValue = CkJsonObject_stringOf(jResp,"RateResponse.RatedShipment[i].FRSShipmentData.TransportationCharges.GrossCharge.MonetaryValue"); DiscountAmountCurrencyCode = CkJsonObject_stringOf(jResp,"RateResponse.RatedShipment[i].FRSShipmentData.TransportationCharges.DiscountAmount.CurrencyCode"); DiscountAmountMonetaryValue = CkJsonObject_stringOf(jResp,"RateResponse.RatedShipment[i].FRSShipmentData.TransportationCharges.DiscountAmount.MonetaryValue"); DiscountPercentage = CkJsonObject_stringOf(jResp,"RateResponse.RatedShipment[i].FRSShipmentData.TransportationCharges.DiscountPercentage"); NetChargeCurrencyCode = CkJsonObject_stringOf(jResp,"RateResponse.RatedShipment[i].FRSShipmentData.TransportationCharges.NetCharge.CurrencyCode"); NetChargeMonetaryValue = CkJsonObject_stringOf(jResp,"RateResponse.RatedShipment[i].FRSShipmentData.TransportationCharges.NetCharge.MonetaryValue"); Density = CkJsonObject_stringOf(jResp,"RateResponse.RatedShipment[i].FRSShipmentData.FreightDensityRate.Density"); TotalCubicFeet = CkJsonObject_stringOf(jResp,"RateResponse.RatedShipment[i].FRSShipmentData.FreightDensityRate.TotalCubicFeet"); ServiceOptionsChargesCurrencyCode = CkJsonObject_stringOf(jResp,"RateResponse.RatedShipment[i].ServiceOptionsCharges.CurrencyCode"); ServiceOptionsChargesMonetaryValue = CkJsonObject_stringOf(jResp,"RateResponse.RatedShipment[i].ServiceOptionsCharges.MonetaryValue"); TotalChargesCurrencyCode = CkJsonObject_stringOf(jResp,"RateResponse.RatedShipment[i].TotalCharges.CurrencyCode"); TotalChargesMonetaryValue = CkJsonObject_stringOf(jResp,"RateResponse.RatedShipment[i].TotalCharges.MonetaryValue"); TotalChargesWithTaxesCurrencyCode = CkJsonObject_stringOf(jResp,"RateResponse.RatedShipment[i].TotalChargesWithTaxes.CurrencyCode"); TotalChargesWithTaxesMonetaryValue = CkJsonObject_stringOf(jResp,"RateResponse.RatedShipment[i].TotalChargesWithTaxes.MonetaryValue"); TotalChargeCurrencyCode = CkJsonObject_stringOf(jResp,"RateResponse.RatedShipment[i].NegotiatedRateCharges.TotalCharge.CurrencyCode"); TotalChargeMonetaryValue = CkJsonObject_stringOf(jResp,"RateResponse.RatedShipment[i].NegotiatedRateCharges.TotalCharge.MonetaryValue"); TotalChargesWithTaxesCurrencyCode = CkJsonObject_stringOf(jResp,"RateResponse.RatedShipment[i].NegotiatedRateCharges.TotalChargesWithTaxes.CurrencyCode"); TotalChargesWithTaxesMonetaryValue = CkJsonObject_stringOf(jResp,"RateResponse.RatedShipment[i].NegotiatedRateCharges.TotalChargesWithTaxes.MonetaryValue"); PickupDate = CkJsonObject_stringOf(jResp,"RateResponse.RatedShipment[i].TimeInTransit.PickupDate"); DocumentsOnlyIndicator = CkJsonObject_stringOf(jResp,"RateResponse.RatedShipment[i].TimeInTransit.DocumentsOnlyIndicator"); PackageBillType = CkJsonObject_stringOf(jResp,"RateResponse.RatedShipment[i].TimeInTransit.PackageBillType"); ServiceDescription = CkJsonObject_stringOf(jResp,"RateResponse.RatedShipment[i].TimeInTransit.ServiceSummary.Service.Description"); GuaranteedIndicator = CkJsonObject_stringOf(jResp,"RateResponse.RatedShipment[i].TimeInTransit.ServiceSummary.GuaranteedIndicator"); Disclaimer = CkJsonObject_stringOf(jResp,"RateResponse.RatedShipment[i].TimeInTransit.ServiceSummary.Disclaimer"); Date = CkJsonObject_stringOf(jResp,"RateResponse.RatedShipment[i].TimeInTransit.ServiceSummary.EstimatedArrival.Arrival.Date"); Time = CkJsonObject_stringOf(jResp,"RateResponse.RatedShipment[i].TimeInTransit.ServiceSummary.EstimatedArrival.Arrival.Time"); BusinessDaysInTransit = CkJsonObject_stringOf(jResp,"RateResponse.RatedShipment[i].TimeInTransit.ServiceSummary.EstimatedArrival.BusinessDaysInTransit"); PickupDate = CkJsonObject_stringOf(jResp,"RateResponse.RatedShipment[i].TimeInTransit.ServiceSummary.EstimatedArrival.Pickup.Date"); PickupTime = CkJsonObject_stringOf(jResp,"RateResponse.RatedShipment[i].TimeInTransit.ServiceSummary.EstimatedArrival.Pickup.Time"); DayOfWeek = CkJsonObject_stringOf(jResp,"RateResponse.RatedShipment[i].TimeInTransit.ServiceSummary.EstimatedArrival.DayOfWeek"); CustomerCenterCutoff = CkJsonObject_stringOf(jResp,"RateResponse.RatedShipment[i].TimeInTransit.ServiceSummary.EstimatedArrival.CustomerCenterCutoff"); DelayCount = CkJsonObject_stringOf(jResp,"RateResponse.RatedShipment[i].TimeInTransit.ServiceSummary.EstimatedArrival.DelayCount"); HolidayCount = CkJsonObject_stringOf(jResp,"RateResponse.RatedShipment[i].TimeInTransit.ServiceSummary.EstimatedArrival.HolidayCount"); RestDays = CkJsonObject_stringOf(jResp,"RateResponse.RatedShipment[i].TimeInTransit.ServiceSummary.EstimatedArrival.RestDays"); TotalTransitDays = CkJsonObject_stringOf(jResp,"RateResponse.RatedShipment[i].TimeInTransit.ServiceSummary.EstimatedArrival.TotalTransitDays"); SaturdayDelivery = CkJsonObject_stringOf(jResp,"RateResponse.RatedShipment[i].TimeInTransit.ServiceSummary.SaturdayDelivery"); SaturdayDeliveryDisclaimer = CkJsonObject_stringOf(jResp,"RateResponse.RatedShipment[i].TimeInTransit.ServiceSummary.SaturdayDeliveryDisclaimer"); SundayDelivery = CkJsonObject_stringOf(jResp,"RateResponse.RatedShipment[i].TimeInTransit.ServiceSummary.SundayDelivery"); SundayDeliveryDisclaimer = CkJsonObject_stringOf(jResp,"RateResponse.RatedShipment[i].TimeInTransit.ServiceSummary.SundayDeliveryDisclaimer"); AutoDutyCode = CkJsonObject_stringOf(jResp,"RateResponse.RatedShipment[i].TimeInTransit.AutoDutyCode"); TimeInTransitDisclaimer = CkJsonObject_stringOf(jResp,"RateResponse.RatedShipment[i].TimeInTransit.Disclaimer"); ScheduledDeliveryDate = CkJsonObject_stringOf(jResp,"RateResponse.RatedShipment[i].ScheduledDeliveryDate"); RoarRatedIndicator = CkJsonObject_stringOf(jResp,"RateResponse.RatedShipment[i].RoarRatedIndicator"); j = 0; count_j = CkJsonObject_SizeOfArray(jResp,"RateResponse.RatedShipment[i].Disclaimer"); while (j < count_j) { CkJsonObject_putJ(jResp,j); Code = CkJsonObject_stringOf(jResp,"RateResponse.RatedShipment[i].Disclaimer[j].Code"); Description = CkJsonObject_stringOf(jResp,"RateResponse.RatedShipment[i].Disclaimer[j].Description"); j = j + 1; } j = 0; count_j = CkJsonObject_SizeOfArray(jResp,"RateResponse.RatedShipment[i].RatedShipmentAlert"); while (j < count_j) { CkJsonObject_putJ(jResp,j); Code = CkJsonObject_stringOf(jResp,"RateResponse.RatedShipment[i].RatedShipmentAlert[j].Code"); Description = CkJsonObject_stringOf(jResp,"RateResponse.RatedShipment[i].RatedShipmentAlert[j].Description"); j = j + 1; } j = 0; count_j = CkJsonObject_SizeOfArray(jResp,"RateResponse.RatedShipment[i].ItemizedCharges"); while (j < count_j) { CkJsonObject_putJ(jResp,j); Code = CkJsonObject_stringOf(jResp,"RateResponse.RatedShipment[i].ItemizedCharges[j].Code"); Description = CkJsonObject_stringOf(jResp,"RateResponse.RatedShipment[i].ItemizedCharges[j].Description"); CurrencyCode = CkJsonObject_stringOf(jResp,"RateResponse.RatedShipment[i].ItemizedCharges[j].CurrencyCode"); MonetaryValue = CkJsonObject_stringOf(jResp,"RateResponse.RatedShipment[i].ItemizedCharges[j].MonetaryValue"); SubType = CkJsonObject_stringOf(jResp,"RateResponse.RatedShipment[i].ItemizedCharges[j].SubType"); j = j + 1; } j = 0; count_j = CkJsonObject_SizeOfArray(jResp,"RateResponse.RatedShipment[i].FRSShipmentData.HandlingUnits"); while (j < count_j) { CkJsonObject_putJ(jResp,j); Quantity = CkJsonObject_stringOf(jResp,"RateResponse.RatedShipment[i].FRSShipmentData.HandlingUnits[j].Quantity"); TypeCode = CkJsonObject_stringOf(jResp,"RateResponse.RatedShipment[i].FRSShipmentData.HandlingUnits[j].Type.Code"); TypeDescription = CkJsonObject_stringOf(jResp,"RateResponse.RatedShipment[i].FRSShipmentData.HandlingUnits[j].Type.Description"); UnitOfMeasurement = CkJsonObject_stringOf(jResp,"RateResponse.RatedShipment[i].FRSShipmentData.HandlingUnits[j].Dimensions.UnitOfMeasurement"); Length = CkJsonObject_stringOf(jResp,"RateResponse.RatedShipment[i].FRSShipmentData.HandlingUnits[j].Dimensions.Length"); Width = CkJsonObject_stringOf(jResp,"RateResponse.RatedShipment[i].FRSShipmentData.HandlingUnits[j].Dimensions.Width"); Height = CkJsonObject_stringOf(jResp,"RateResponse.RatedShipment[i].FRSShipmentData.HandlingUnits[j].Dimensions.Height"); AdjustedHeightValue = CkJsonObject_stringOf(jResp,"RateResponse.RatedShipment[i].FRSShipmentData.HandlingUnits[j].AdjustedHeight.Value"); AdjustedHeightUnitOfMeasurement = CkJsonObject_stringOf(jResp,"RateResponse.RatedShipment[i].FRSShipmentData.HandlingUnits[j].AdjustedHeight.UnitOfMeasurement"); j = j + 1; } j = 0; count_j = CkJsonObject_SizeOfArray(jResp,"RateResponse.RatedShipment[i].TaxCharges"); while (j < count_j) { CkJsonObject_putJ(jResp,j); v_Type = CkJsonObject_stringOf(jResp,"RateResponse.RatedShipment[i].TaxCharges[j].Type"); MonetaryValue = CkJsonObject_stringOf(jResp,"RateResponse.RatedShipment[i].TaxCharges[j].MonetaryValue"); j = j + 1; } j = 0; count_j = CkJsonObject_SizeOfArray(jResp,"RateResponse.RatedShipment[i].NegotiatedRateCharges.ItemizedCharges"); while (j < count_j) { CkJsonObject_putJ(jResp,j); Code = CkJsonObject_stringOf(jResp,"RateResponse.RatedShipment[i].NegotiatedRateCharges.ItemizedCharges[j].Code"); Description = CkJsonObject_stringOf(jResp,"RateResponse.RatedShipment[i].NegotiatedRateCharges.ItemizedCharges[j].Description"); CurrencyCode = CkJsonObject_stringOf(jResp,"RateResponse.RatedShipment[i].NegotiatedRateCharges.ItemizedCharges[j].CurrencyCode"); MonetaryValue = CkJsonObject_stringOf(jResp,"RateResponse.RatedShipment[i].NegotiatedRateCharges.ItemizedCharges[j].MonetaryValue"); SubType = CkJsonObject_stringOf(jResp,"RateResponse.RatedShipment[i].NegotiatedRateCharges.ItemizedCharges[j].SubType"); j = j + 1; } j = 0; count_j = CkJsonObject_SizeOfArray(jResp,"RateResponse.RatedShipment[i].NegotiatedRateCharges.TaxCharges"); while (j < count_j) { CkJsonObject_putJ(jResp,j); v_Type = CkJsonObject_stringOf(jResp,"RateResponse.RatedShipment[i].NegotiatedRateCharges.TaxCharges[j].Type"); MonetaryValue = CkJsonObject_stringOf(jResp,"RateResponse.RatedShipment[i].NegotiatedRateCharges.TaxCharges[j].MonetaryValue"); j = j + 1; } j = 0; count_j = CkJsonObject_SizeOfArray(jResp,"RateResponse.RatedShipment[i].RatedPackage"); while (j < count_j) { CkJsonObject_putJ(jResp,j); BaseServiceChargeCurrencyCode = CkJsonObject_stringOf(jResp,"RateResponse.RatedShipment[i].RatedPackage[j].BaseServiceCharge.CurrencyCode"); BaseServiceChargeMonetaryValue = CkJsonObject_stringOf(jResp,"RateResponse.RatedShipment[i].RatedPackage[j].BaseServiceCharge.MonetaryValue"); TransportationChargesCurrencyCode = CkJsonObject_stringOf(jResp,"RateResponse.RatedShipment[i].RatedPackage[j].TransportationCharges.CurrencyCode"); TransportationChargesMonetaryValue = CkJsonObject_stringOf(jResp,"RateResponse.RatedShipment[i].RatedPackage[j].TransportationCharges.MonetaryValue"); ServiceOptionsChargesCurrencyCode = CkJsonObject_stringOf(jResp,"RateResponse.RatedShipment[i].RatedPackage[j].ServiceOptionsCharges.CurrencyCode"); ServiceOptionsChargesMonetaryValue = CkJsonObject_stringOf(jResp,"RateResponse.RatedShipment[i].RatedPackage[j].ServiceOptionsCharges.MonetaryValue"); TotalChargesCurrencyCode = CkJsonObject_stringOf(jResp,"RateResponse.RatedShipment[i].RatedPackage[j].TotalCharges.CurrencyCode"); TotalChargesMonetaryValue = CkJsonObject_stringOf(jResp,"RateResponse.RatedShipment[i].RatedPackage[j].TotalCharges.MonetaryValue"); Weight = CkJsonObject_stringOf(jResp,"RateResponse.RatedShipment[i].RatedPackage[j].Weight"); UnitOfMeasurementCode = CkJsonObject_stringOf(jResp,"RateResponse.RatedShipment[i].RatedPackage[j].BillingWeight.UnitOfMeasurement.Code"); UnitOfMeasurementDescription = CkJsonObject_stringOf(jResp,"RateResponse.RatedShipment[i].RatedPackage[j].BillingWeight.UnitOfMeasurement.Description"); BillingWeightWeight = CkJsonObject_stringOf(jResp,"RateResponse.RatedShipment[i].RatedPackage[j].BillingWeight.Weight"); SimpleRateCode = CkJsonObject_stringOf(jResp,"RateResponse.RatedShipment[i].RatedPackage[j].SimpleRate.Code"); k = 0; count_k = CkJsonObject_SizeOfArray(jResp,"RateResponse.RatedShipment[i].RatedPackage[j].Accessorial"); while (k < count_k) { CkJsonObject_putK(jResp,k); Code = CkJsonObject_stringOf(jResp,"RateResponse.RatedShipment[i].RatedPackage[j].Accessorial[k].Code"); Description = CkJsonObject_stringOf(jResp,"RateResponse.RatedShipment[i].RatedPackage[j].Accessorial[k].Description"); k = k + 1; } k = 0; count_k = CkJsonObject_SizeOfArray(jResp,"RateResponse.RatedShipment[i].RatedPackage[j].ItemizedCharges"); while (k < count_k) { CkJsonObject_putK(jResp,k); Code = CkJsonObject_stringOf(jResp,"RateResponse.RatedShipment[i].RatedPackage[j].ItemizedCharges[k].Code"); Description = CkJsonObject_stringOf(jResp,"RateResponse.RatedShipment[i].RatedPackage[j].ItemizedCharges[k].Description"); CurrencyCode = CkJsonObject_stringOf(jResp,"RateResponse.RatedShipment[i].RatedPackage[j].ItemizedCharges[k].CurrencyCode"); MonetaryValue = CkJsonObject_stringOf(jResp,"RateResponse.RatedShipment[i].RatedPackage[j].ItemizedCharges[k].MonetaryValue"); SubType = CkJsonObject_stringOf(jResp,"RateResponse.RatedShipment[i].RatedPackage[j].ItemizedCharges[k].SubType"); k = k + 1; } k = 0; count_k = CkJsonObject_SizeOfArray(jResp,"RateResponse.RatedShipment[i].RatedPackage[j].NegotiatedCharges.ItemizedCharges"); while (k < count_k) { CkJsonObject_putK(jResp,k); nullVal = CkJsonObject_IsNullOf(jResp,"RateResponse.RatedShipment[i].RatedPackage[j].NegotiatedCharges.ItemizedCharges[k]"); k = k + 1; } k = 0; count_k = CkJsonObject_SizeOfArray(jResp,"RateResponse.RatedShipment[i].RatedPackage[j].RateModifier"); while (k < count_k) { CkJsonObject_putK(jResp,k); ModifierType = CkJsonObject_stringOf(jResp,"RateResponse.RatedShipment[i].RatedPackage[j].RateModifier[k].ModifierType"); ModifierDesc = CkJsonObject_stringOf(jResp,"RateResponse.RatedShipment[i].RatedPackage[j].RateModifier[k].ModifierDesc"); Amount = CkJsonObject_stringOf(jResp,"RateResponse.RatedShipment[i].RatedPackage[j].RateModifier[k].Amount"); k = k + 1; } j = j + 1; } i = i + 1; } CkHttp_Dispose(http); CkJsonObject_Dispose(json); CkJsonObject_Dispose(jsonToken); CkStringBuilder_Dispose(sbResponseBody); CkJsonObject_Dispose(jResp); } |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.