Chilkat Online Tools

DataFlex / ShipEngine Walkthrough / Get rate estimates (minimal)

Back to Collection Items

Use ChilkatAx-9.5.0-win32.pkg

Procedure Test
    Handle hoHttp
    Boolean iSuccess
    Variant vJson
    Handle hoJson
    Variant vResp
    Handle hoResp
    Variant vSbResponseBody
    Handle hoSbResponseBody
    Handle hoJarrResp
    Integer iRespStatusCode
    Variant vJson
    Handle hoJson
    String sRate_type
    String sCarrier_id
    String sV_Currency
    String sAmount
    String sInsurance_amountCurrency
    Integer iInsurance_amountAmount
    String sConfirmation_amountCurrency
    Integer iConfirmation_amountAmount
    String sOther_amountCurrency
    Integer iOther_amountAmount
    Integer iZone
    String sPackage_type
    Integer iDelivery_days
    Boolean iGuaranteed_service
    String sEstimated_delivery_date
    String sCarrier_delivery_days
    String sShip_date
    Boolean iNegotiated_rate
    String sService_type
    String sService_code
    Boolean iTrackable
    String sCarrier_code
    String sCarrier_nickname
    String sCarrier_friendly_name
    String sValidation_status
    Integer j
    Integer iCount_j
    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.

    // {
    //   "carrier_ids": [
    //     "{{stamps_com}}",
    //     "{{fedex}}",
    //     "{{ups}}"
    //   ],
    //   "from_country_code": "US",
    //   "from_postal_code": "78756",
    //   "to_country_code": "US",
    //   "to_postal_code": "91521",
    //   "weight": {
    //     "value": 17,
    //     "unit": "pound"
    //   }
    // }

    Get Create (RefClass(cComChilkatJsonObject)) To hoJson
    If (Not(IsComObjectCreated(hoJson))) Begin
        Send CreateComObject of hoJson
    End
    Get ComUpdateString Of hoJson "carrier_ids[0]" "{{stamps_com}}" To iSuccess
    Get ComUpdateString Of hoJson "carrier_ids[1]" "{{fedex}}" To iSuccess
    Get ComUpdateString Of hoJson "carrier_ids[2]" "{{ups}}" To iSuccess
    Get ComUpdateString Of hoJson "from_country_code" "US" To iSuccess
    Get ComUpdateString Of hoJson "from_postal_code" "78756" To iSuccess
    Get ComUpdateString Of hoJson "to_country_code" "US" To iSuccess
    Get ComUpdateString Of hoJson "to_postal_code" "91521" To iSuccess
    Get ComUpdateInt Of hoJson "weight.value" 17 To iSuccess
    Get ComUpdateString Of hoJson "weight.unit" "pound" To iSuccess

    Send ComSetRequestHeader To hoHttp "API-Key" "{{API_KEY}}"
    Send ComSetRequestHeader To hoHttp "Content-Type" "application/json"

    Get pvComObject of hoJson to vJson
    Get ComPostJson3 Of hoHttp "https://api.shipengine.com/v1/rates/estimate" "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(cComChilkatJsonArray)) To hoJarrResp
    If (Not(IsComObjectCreated(hoJarrResp))) Begin
        Send CreateComObject of hoJarrResp
    End
    Get pvComObject of hoSbResponseBody to vSbResponseBody
    Get ComLoadSb Of hoJarrResp vSbResponseBody To iSuccess
    Set ComEmitCompact Of hoJarrResp To False

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

    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)

    // [
    //   {
    //     "rate_type": "check",
    //     "carrier_id": "se-121861",
    //     "shipping_amount": {
    //       "currency": "usd",
    //       "amount": 11.07
    //     },
    //     "insurance_amount": {
    //       "currency": "usd",
    //       "amount": 0
    //     },
    //     "confirmation_amount": {
    //       "currency": "usd",
    //       "amount": 0
    //     },
    //     "other_amount": {
    //       "currency": "usd",
    //       "amount": 0
    //     },
    //     "zone": 6,
    //     "package_type": "package",
    //     "delivery_days": 7,
    //     "guaranteed_service": false,
    //     "estimated_delivery_date": "2019-09-24T00:00:00Z",
    //     "carrier_delivery_days": "6",
    //     "ship_date": "2019-09-17T00:00:00Z",
    //     "negotiated_rate": false,
    //     "service_type": "USPS Media Mail",
    //     "service_code": "usps_media_mail",
    //     "trackable": true,
    //     "carrier_code": "stamps_com",
    //     "carrier_nickname": "ShipEngine Test Account - Stamps.com",
    //     "carrier_friendly_name": "Stamps.com",
    //     "validation_status": "unknown",
    //     "warning_messages": [
    //     ],
    //     "error_messages": [
    //     ]
    //   },
    //   {
    //     "rate_type": "check",
    //     "carrier_id": "se-121861",
    //     "shipping_amount": {
    //       "currency": "usd",
    //       "amount": 38.98
    //     },
    //     "insurance_amount": {
    //       "currency": "usd",
    //       "amount": 0
    //     },
    //     "confirmation_amount": {
    //       "currency": "usd",
    //       "amount": 0
    //     },
    //     "other_amount": {
    //       "currency": "usd",
    //       "amount": 0
    //     },
    //     "zone": 6,
    //     "package_type": "package",
    //     "delivery_days": 7,
    //     "guaranteed_service": false,
    //     "estimated_delivery_date": "2019-09-24T00:00:00Z",
    //     "carrier_delivery_days": "6",
    //     "ship_date": "2019-09-17T00:00:00Z",
    //     "negotiated_rate": false,
    //     "service_type": "USPS Parcel Select Ground",
    //     "service_code": "usps_parcel_select",
    //     "trackable": true,
    //     "carrier_code": "stamps_com",
    //     "carrier_nickname": "ShipEngine Test Account - Stamps.com",
    //     "carrier_friendly_name": "Stamps.com",
    //     "validation_status": "unknown",
    //     "warning_messages": [
    //     ],
    //     "error_messages": [
    //     ]
    //   },
    //   {
    //     "rate_type": "check",
    //     "carrier_id": "se-121861",
    //     "shipping_amount": {
    //       "currency": "usd",
    //       "amount": 39.23
    //     },
    //     "insurance_amount": {
    //       "currency": "usd",
    //       "amount": 0
    //     },
    //     "confirmation_amount": {
    //       "currency": "usd",
    //       "amount": 0
    //     },
    //     "other_amount": {
    //       "currency": "usd",
    //       "amount": 0
    //     },
    //     "zone": 6,
    //     "package_type": "package",
    //     "delivery_days": 3,
    //     "guaranteed_service": false,
    //     "estimated_delivery_date": "2019-09-20T00:00:00Z",
    //     "carrier_delivery_days": "3",
    //     "ship_date": "2019-09-17T00:00:00Z",
    //     "negotiated_rate": false,
    //     "service_type": "USPS Priority Mail",
    //     "service_code": "usps_priority_mail",
    //     "trackable": true,
    //     "carrier_code": "stamps_com",
    //     "carrier_nickname": "ShipEngine Test Account - Stamps.com",
    //     "carrier_friendly_name": "Stamps.com",
    //     "validation_status": "unknown",
    //     "warning_messages": [
    //     ],
    //     "error_messages": [
    //     ]
    //   },
    //   {
    //     "rate_type": "check",
    //     "carrier_id": "se-121861",
    //     "shipping_amount": {
    //       "currency": "usd",
    //       "amount": 12.72
    //     },
    //     "insurance_amount": {
    //       "currency": "usd",
    //       "amount": 0
    //     },
    //     "confirmation_amount": {
    //       "currency": "usd",
    //       "amount": 0
    //     },
    //     "other_amount": {
    //       "currency": "usd",
    //       "amount": 0
    //     },
    //     "zone": 6,
    //     "package_type": "medium_flat_rate_box",
    //     "delivery_days": 3,
    //     "guaranteed_service": false,
    //     "estimated_delivery_date": "2019-09-20T00:00:00Z",
    //     "carrier_delivery_days": "3",
    //     "ship_date": "2019-09-17T00:00:00Z",
    //     "negotiated_rate": false,
    //     "service_type": "USPS Priority Mail",
    //     "service_code": "usps_priority_mail",
    //     "trackable": true,
    //     "carrier_code": "stamps_com",
    //     "carrier_nickname": "ShipEngine Test Account - Stamps.com",
    //     "carrier_friendly_name": "Stamps.com",
    //     "validation_status": "unknown",
    //     "warning_messages": [
    //     ],
    //     "error_messages": [
    //     ]
    //   },
    //   {
    //     "rate_type": "check",
    //     "carrier_id": "se-121861",
    //     "shipping_amount": {
    //       "currency": "usd",
    //       "amount": 6.98
    //     },
    //     "insurance_amount": {
    //       "currency": "usd",
    //       "amount": 0
    //     },
    //     "confirmation_amount": {
    //       "currency": "usd",
    //       "amount": 0
    //     },
    //     "other_amount": {
    //       "currency": "usd",
    //       "amount": 0
    //     },
    //     "zone": 6,
    //     "package_type": "small_flat_rate_box",
    //     "delivery_days": 3,
    //     "guaranteed_service": false,
    //     "estimated_delivery_date": "2019-09-20T00:00:00Z",
    //     "carrier_delivery_days": "3",
    //     "ship_date": "2019-09-17T00:00:00Z",
    //     "negotiated_rate": false,
    //     "service_type": "USPS Priority Mail",
    //     "service_code": "usps_priority_mail",
    //     "trackable": true,
    //     "carrier_code": "stamps_com",
    //     "carrier_nickname": "ShipEngine Test Account - Stamps.com",
    //     "carrier_friendly_name": "Stamps.com",
    //     "validation_status": "unknown",
    //     "warning_messages": [
    //     ],
    //     "error_messages": [
    //     ]
    //   },
    //   {
    //     "rate_type": "check",
    //     "carrier_id": "se-121861",
    //     "shipping_amount": {
    //       "currency": "usd",
    //       "amount": 17.47
    //     },
    //     "insurance_amount": {
    //       "currency": "usd",
    //       "amount": 0
    //     },
    //     "confirmation_amount": {
    //       "currency": "usd",
    //       "amount": 0
    //     },
    //     "other_amount": {
    //       "currency": "usd",
    //       "amount": 0
    //     },
    //     "zone": 6,
    //     "package_type": "large_flat_rate_box",
    //     "delivery_days": 3,
    //     "guaranteed_service": false,
    //     "estimated_delivery_date": "2019-09-20T00:00:00Z",
    //     "carrier_delivery_days": "3",
    //     "ship_date": "2019-09-17T00:00:00Z",
    //     "negotiated_rate": false,
    //     "service_type": "USPS Priority Mail",
    //     "service_code": "usps_priority_mail",
    //     "trackable": true,
    //     "carrier_code": "stamps_com",
    //     "carrier_nickname": "ShipEngine Test Account - Stamps.com",
    //     "carrier_friendly_name": "Stamps.com",
    //     "validation_status": "unknown",
    //     "warning_messages": [
    //     ],
    //     "error_messages": [
    //     ]
    //   },
    //   {
    //     "rate_type": "check",
    //     "carrier_id": "se-121861",
    //     "shipping_amount": {
    //       "currency": "usd",
    //       "amount": 6.48
    //     },
    //     "insurance_amount": {
    //       "currency": "usd",
    //       "amount": 0
    //     },
    //     "confirmation_amount": {
    //       "currency": "usd",
    //       "amount": 0
    //     },
    //     "other_amount": {
    //       "currency": "usd",
    //       "amount": 0
    //     },
    //     "zone": 6,
    //     "package_type": "flat_rate_envelope",
    //     "delivery_days": 3,
    //     "guaranteed_service": false,
    //     "estimated_delivery_date": "2019-09-20T00:00:00Z",
    //     "carrier_delivery_days": "3",
    //     "ship_date": "2019-09-17T00:00:00Z",
    //     "negotiated_rate": false,
    //     "service_type": "USPS Priority Mail",
    //     "service_code": "usps_priority_mail",
    //     "trackable": true,
    //     "carrier_code": "stamps_com",
    //     "carrier_nickname": "ShipEngine Test Account - Stamps.com",
    //     "carrier_friendly_name": "Stamps.com",
    //     "validation_status": "unknown",
    //     "warning_messages": [
    //     ],
    //     "error_messages": [
    //     ]
    //   },
    //   {
    //     "rate_type": "check",
    //     "carrier_id": "se-121861",
    //     "shipping_amount": {
    //       "currency": "usd",
    //       "amount": 7.03
    //     },
    //     "insurance_amount": {
    //       "currency": "usd",
    //       "amount": 0
    //     },
    //     "confirmation_amount": {
    //       "currency": "usd",
    //       "amount": 0
    //     },
    //     "other_amount": {
    //       "currency": "usd",
    //       "amount": 0
    //     },
    //     "zone": 6,
    //     "package_type": "flat_rate_padded_envelope",
    //     "delivery_days": 3,
    //     "guaranteed_service": false,
    //     "estimated_delivery_date": "2019-09-20T00:00:00Z",
    //     "carrier_delivery_days": "3",
    //     "ship_date": "2019-09-17T00:00:00Z",
    //     "negotiated_rate": false,
    //     "service_type": "USPS Priority Mail",
    //     "service_code": "usps_priority_mail",
    //     "trackable": true,
    //     "carrier_code": "stamps_com",
    //     "carrier_nickname": "ShipEngine Test Account - Stamps.com",
    //     "carrier_friendly_name": "Stamps.com",
    //     "validation_status": "unknown",
    //     "warning_messages": [
    //     ],
    //     "error_messages": [
    //     ]
    //   },
    //   {
    //     "rate_type": "check",
    //     "carrier_id": "se-121861",
    //     "shipping_amount": {
    //       "currency": "usd",
    //       "amount": 16.1
    //     },
    //     "insurance_amount": {
    //       "currency": "usd",
    //       "amount": 0
    //     },
    //     "confirmation_amount": {
    //       "currency": "usd",
    //       "amount": 0
    //     },
    //     "other_amount": {
    //       "currency": "usd",
    //       "amount": 0
    //     },
    //     "zone": 6,
    //     "package_type": "regional_rate_box_b",
    //     "delivery_days": 3,
    //     "guaranteed_service": false,
    //     "estimated_delivery_date": "2019-09-20T00:00:00Z",
    //     "carrier_delivery_days": "3",
    //     "ship_date": "2019-09-17T00:00:00Z",
    //     "negotiated_rate": false,
    //     "service_type": "USPS Priority Mail",
    //     "service_code": "usps_priority_mail",
    //     "trackable": true,
    //     "carrier_code": "stamps_com",
    //     "carrier_nickname": "ShipEngine Test Account - Stamps.com",
    //     "carrier_friendly_name": "Stamps.com",
    //     "validation_status": "unknown",
    //     "warning_messages": [
    //     ],
    //     "error_messages": [
    //     ]
    //   },
    //   {
    //     "rate_type": "check",
    //     "carrier_id": "se-121861",
    //     "shipping_amount": {
    //       "currency": "usd",
    //       "amount": 6.78
    //     },
    //     "insurance_amount": {
    //       "currency": "usd",
    //       "amount": 0
    //     },
    //     "confirmation_amount": {
    //       "currency": "usd",
    //       "amount": 0
    //     },
    //     "other_amount": {
    //       "currency": "usd",
    //       "amount": 0
    //     },
    //     "zone": 6,
    //     "package_type": "flat_rate_legal_envelope",
    //     "delivery_days": 3,
    //     "guaranteed_service": false,
    //     "estimated_delivery_date": "2019-09-20T00:00:00Z",
    //     "carrier_delivery_days": "3",
    //     "ship_date": "2019-09-17T00:00:00Z",
    //     "negotiated_rate": false,
    //     "service_type": "USPS Priority Mail",
    //     "service_code": "usps_priority_mail",
    //     "trackable": true,
    //     "carrier_code": "stamps_com",
    //     "carrier_nickname": "ShipEngine Test Account - Stamps.com",
    //     "carrier_friendly_name": "Stamps.com",
    //     "validation_status": "unknown",
    //     "warning_messages": [
    //     ],
    //     "error_messages": [
    //     ]
    //   },
    //   {
    //     "rate_type": "check",
    //     "carrier_id": "se-121861",
    //     "shipping_amount": {
    //       "currency": "usd",
    //       "amount": 103.04
    //     },
    //     "insurance_amount": {
    //       "currency": "usd",
    //       "amount": 0
    //     },
    //     "confirmation_amount": {
    //       "currency": "usd",
    //       "amount": 0
    //     },
    //     "other_amount": {
    //       "currency": "usd",
    //       "amount": 0
    //     },
    //     "zone": 6,
    //     "package_type": "package",
    //     "delivery_days": 2,
    //     "guaranteed_service": false,
    //     "estimated_delivery_date": "2019-09-19T00:00:00Z",
    //     "carrier_delivery_days": "1-2",
    //     "ship_date": "2019-09-17T00:00:00Z",
    //     "negotiated_rate": false,
    //     "service_type": "USPS Priority Mail Express",
    //     "service_code": "usps_priority_mail_express",
    //     "trackable": true,
    //     "carrier_code": "stamps_com",
    //     "carrier_nickname": "ShipEngine Test Account - Stamps.com",
    //     "carrier_friendly_name": "Stamps.com",
    //     "validation_status": "unknown",
    //     "warning_messages": [
    //     ],
    //     "error_messages": [
    //     ]
    //   },
    //   {
    //     "rate_type": "check",
    //     "carrier_id": "se-121861",
    //     "shipping_amount": {
    //       "currency": "usd",
    //       "amount": 22.68
    //     },
    //     "insurance_amount": {
    //       "currency": "usd",
    //       "amount": 0
    //     },
    //     "confirmation_amount": {
    //       "currency": "usd",
    //       "amount": 0
    //     },
    //     "other_amount": {
    //       "currency": "usd",
    //       "amount": 0
    //     },
    //     "zone": 6,
    //     "package_type": "flat_rate_envelope",
    //     "delivery_days": 2,
    //     "guaranteed_service": false,
    //     "estimated_delivery_date": "2019-09-19T00:00:00Z",
    //     "carrier_delivery_days": "1-2",
    //     "ship_date": "2019-09-17T00:00:00Z",
    //     "negotiated_rate": false,
    //     "service_type": "USPS Priority Mail Express",
    //     "service_code": "usps_priority_mail_express",
    //     "trackable": true,
    //     "carrier_code": "stamps_com",
    //     "carrier_nickname": "ShipEngine Test Account - Stamps.com",
    //     "carrier_friendly_name": "Stamps.com",
    //     "validation_status": "unknown",
    //     "warning_messages": [
    //     ],
    //     "error_messages": [
    //     ]
    //   },
    //   {
    //     "rate_type": "check",
    //     "carrier_id": "se-121861",
    //     "shipping_amount": {
    //       "currency": "usd",
    //       "amount": 23.18
    //     },
    //     "insurance_amount": {
    //       "currency": "usd",
    //       "amount": 0
    //     },
    //     "confirmation_amount": {
    //       "currency": "usd",
    //       "amount": 0
    //     },
    //     "other_amount": {
    //       "currency": "usd",
    //       "amount": 0
    //     },
    //     "zone": 6,
    //     "package_type": "flat_rate_padded_envelope",
    //     "delivery_days": 2,
    //     "guaranteed_service": false,
    //     "estimated_delivery_date": "2019-09-19T00:00:00Z",
    //     "carrier_delivery_days": "1-2",
    //     "ship_date": "2019-09-17T00:00:00Z",
    //     "negotiated_rate": false,
    //     "service_type": "USPS Priority Mail Express",
    //     "service_code": "usps_priority_mail_express",
    //     "trackable": true,
    //     "carrier_code": "stamps_com",
    //     "carrier_nickname": "ShipEngine Test Account - Stamps.com",
    //     "carrier_friendly_name": "Stamps.com",
    //     "validation_status": "unknown",
    //     "warning_messages": [
    //     ],
    //     "error_messages": [
    //     ]
    //   },
    //   {
    //     "rate_type": "check",
    //     "carrier_id": "se-121861",
    //     "shipping_amount": {
    //       "currency": "usd",
    //       "amount": 22.8
    //     },
    //     "insurance_amount": {
    //       "currency": "usd",
    //       "amount": 0
    //     },
    //     "confirmation_amount": {
    //       "currency": "usd",
    //       "amount": 0
    //     },
    //     "other_amount": {
    //       "currency": "usd",
    //       "amount": 0
    //     },
    //     "zone": 6,
    //     "package_type": "flat_rate_legal_envelope",
    //     "delivery_days": 2,
    //     "guaranteed_service": false,
    //     "estimated_delivery_date": "2019-09-19T00:00:00Z",
    //     "carrier_delivery_days": "1-2",
    //     "ship_date": "2019-09-17T00:00:00Z",
    //     "negotiated_rate": false,
    //     "service_type": "USPS Priority Mail Express",
    //     "service_code": "usps_priority_mail_express",
    //     "trackable": true,
    //     "carrier_code": "stamps_com",
    //     "carrier_nickname": "ShipEngine Test Account - Stamps.com",
    //     "carrier_friendly_name": "Stamps.com",
    //     "validation_status": "unknown",
    //     "warning_messages": [
    //     ],
    //     "error_messages": [
    //     ]
    //   }
    // ]

    // Sample code for parsing the JSON response...
    // Use this online tool to generate parsing code from sample JSON: Generate JSON Parsing Code

    Move 0 To i
    Get ComSize Of hoJarrResp To iCount_i
    While (i < iCount_i)
        Get ComObjectAt Of hoJarrResp i To vJson
        If (IsComObject(vJson)) Begin
            Get Create (RefClass(cComChilkatJsonObject)) To hoJson
            Set pvComObject Of hoJson To vJson
        End
        Get ComStringOf Of hoJson "rate_type" To sRate_type
        Get ComStringOf Of hoJson "carrier_id" To sCarrier_id
        Get ComStringOf Of hoJson "shipping_amount.currency" To sV_Currency
        Get ComStringOf Of hoJson "shipping_amount.amount" To sAmount
        Get ComStringOf Of hoJson "insurance_amount.currency" To sInsurance_amountCurrency
        Get ComIntOf Of hoJson "insurance_amount.amount" To iInsurance_amountAmount
        Get ComStringOf Of hoJson "confirmation_amount.currency" To sConfirmation_amountCurrency
        Get ComIntOf Of hoJson "confirmation_amount.amount" To iConfirmation_amountAmount
        Get ComStringOf Of hoJson "other_amount.currency" To sOther_amountCurrency
        Get ComIntOf Of hoJson "other_amount.amount" To iOther_amountAmount
        Get ComIntOf Of hoJson "zone" To iZone
        Get ComStringOf Of hoJson "package_type" To sPackage_type
        Get ComIntOf Of hoJson "delivery_days" To iDelivery_days
        Get ComBoolOf Of hoJson "guaranteed_service" To iGuaranteed_service
        Get ComStringOf Of hoJson "estimated_delivery_date" To sEstimated_delivery_date
        Get ComStringOf Of hoJson "carrier_delivery_days" To sCarrier_delivery_days
        Get ComStringOf Of hoJson "ship_date" To sShip_date
        Get ComBoolOf Of hoJson "negotiated_rate" To iNegotiated_rate
        Get ComStringOf Of hoJson "service_type" To sService_type
        Get ComStringOf Of hoJson "service_code" To sService_code
        Get ComBoolOf Of hoJson "trackable" To iTrackable
        Get ComStringOf Of hoJson "carrier_code" To sCarrier_code
        Get ComStringOf Of hoJson "carrier_nickname" To sCarrier_nickname
        Get ComStringOf Of hoJson "carrier_friendly_name" To sCarrier_friendly_name
        Get ComStringOf Of hoJson "validation_status" To sValidation_status
        Move 0 To j
        Get ComSizeOfArray Of hoJson "warning_messages" To iCount_j
        While (j < iCount_j)
            Set ComJ Of hoJson To j
            Move (j + 1) To j
        Loop

        Move 0 To j
        Get ComSizeOfArray Of hoJson "error_messages" To iCount_j
        While (j < iCount_j)
            Set ComJ Of hoJson To j
            Move (j + 1) To j
        Loop

        Send Destroy of hoJson
        Move (i + 1) To i
    Loop



End_Procedure

Curl Command

curl -X POST
	-H "API-Key: {{API_KEY}}"
	-H "Content-Type: application/json"
	-d '{
	"carrier_ids": [
		"{{stamps_com}}",
		"{{fedex}}",
		"{{ups}}"
	],
	"from_country_code": "US",
	"from_postal_code": "78756",
	"to_country_code": "US",
	"to_postal_code": "91521",
	"weight": {
		"value": 17,
		"unit": "pound"
	}
}'
https://api.shipengine.com/v1/rates/estimate

Postman Collection Item JSON

{
  "name": "Get rate estimates (minimal)",
  "event": [
    {
      "listen": "test",
      "script": {
        "exec": [
          ""
        ],
        "type": "text/javascript"
      }
    }
  ],
  "request": {
    "method": "POST",
    "header": [
      {
        "key": "Content-Type",
        "name": "Content-Type",
        "value": "application/json",
        "type": "text"
      }
    ],
    "body": {
      "mode": "raw",
      "raw": "{\n\t\"carrier_ids\": [\n\t\t\"{{stamps_com}}\",\n\t\t\"{{fedex}}\",\n\t\t\"{{ups}}\"\n\t],\n\t\"from_country_code\": \"US\",\n\t\"from_postal_code\": \"78756\",\n\t\"to_country_code\": \"US\",\n\t\"to_postal_code\": \"91521\",\n\t\"weight\": {\n\t\t\"value\": 17,\n\t\t\"unit\": \"pound\"\n\t}\n}"
    },
    "url": {
      "raw": "https://api.shipengine.com/v1/rates/estimate",
      "protocol": "https",
      "host": [
        "api",
        "shipengine",
        "com"
      ],
      "path": [
        "v1",
        "rates",
        "estimate"
      ]
    },
    "description": "This request shows you how to get rate estimates when you don't know the full delivery address yet."
  },
  "response": [
    {
      "name": "Get rate estimates (minimal)",
      "originalRequest": {
        "method": "POST",
        "header": [
          {
            "key": "Content-Type",
            "name": "Content-Type",
            "value": "application/json",
            "type": "text"
          }
        ],
        "body": {
          "mode": "raw",
          "raw": "{\n\t\"carrier_id\": \"{{stamps_com}}\",\n\t\"from_country_code\": \"US\",\n\t\"from_postal_code\": \"78756\",\n\t\"to_country_code\": \"US\",\n\t\"to_postal_code\": \"91521\",\n\t\"weight\": {\n\t\t\"value\": 17,\n\t\t\"unit\": \"pound\"\n\t}\n}",
          "options": {
            "raw": {
              "language": "json"
            }
          }
        },
        "url": {
          "raw": "https://api.shipengine.com/v1/rates/estimate",
          "protocol": "https",
          "host": [
            "api",
            "shipengine",
            "com"
          ],
          "path": [
            "v1",
            "rates",
            "estimate"
          ]
        }
      },
      "status": "OK",
      "code": 200,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "Date",
          "value": "Tue, 17 Sep 2019 17:48:57 GMT"
        },
        {
          "key": "Content-Type",
          "value": "application/json; charset=utf-8"
        },
        {
          "key": "Content-Length",
          "value": "14422"
        },
        {
          "key": "Connection",
          "value": "keep-alive"
        },
        {
          "key": "Access-Control-Allow-Origin",
          "value": "https://www.shipengine.com"
        },
        {
          "key": "Vary",
          "value": "Origin"
        },
        {
          "key": "x-shipengine-requestid",
          "value": "a0122561-502b-4e6e-93d1-f1498bf6a0b3"
        }
      ],
      "cookie": [
      ],
      "body": "[\n    {\n        \"rate_type\": \"check\",\n        \"carrier_id\": \"se-121861\",\n        \"shipping_amount\": {\n            \"currency\": \"usd\",\n            \"amount\": 11.07\n        },\n        \"insurance_amount\": {\n            \"currency\": \"usd\",\n            \"amount\": 0\n        },\n        \"confirmation_amount\": {\n            \"currency\": \"usd\",\n            \"amount\": 0\n        },\n        \"other_amount\": {\n            \"currency\": \"usd\",\n            \"amount\": 0\n        },\n        \"zone\": 6,\n        \"package_type\": \"package\",\n        \"delivery_days\": 7,\n        \"guaranteed_service\": false,\n        \"estimated_delivery_date\": \"2019-09-24T00:00:00Z\",\n        \"carrier_delivery_days\": \"6\",\n        \"ship_date\": \"2019-09-17T00:00:00Z\",\n        \"negotiated_rate\": false,\n        \"service_type\": \"USPS Media Mail\",\n        \"service_code\": \"usps_media_mail\",\n        \"trackable\": true,\n        \"carrier_code\": \"stamps_com\",\n        \"carrier_nickname\": \"ShipEngine Test Account - Stamps.com\",\n        \"carrier_friendly_name\": \"Stamps.com\",\n        \"validation_status\": \"unknown\",\n        \"warning_messages\": [],\n        \"error_messages\": []\n    },\n    {\n        \"rate_type\": \"check\",\n        \"carrier_id\": \"se-121861\",\n        \"shipping_amount\": {\n            \"currency\": \"usd\",\n            \"amount\": 38.98\n        },\n        \"insurance_amount\": {\n            \"currency\": \"usd\",\n            \"amount\": 0\n        },\n        \"confirmation_amount\": {\n            \"currency\": \"usd\",\n            \"amount\": 0\n        },\n        \"other_amount\": {\n            \"currency\": \"usd\",\n            \"amount\": 0\n        },\n        \"zone\": 6,\n        \"package_type\": \"package\",\n        \"delivery_days\": 7,\n        \"guaranteed_service\": false,\n        \"estimated_delivery_date\": \"2019-09-24T00:00:00Z\",\n        \"carrier_delivery_days\": \"6\",\n        \"ship_date\": \"2019-09-17T00:00:00Z\",\n        \"negotiated_rate\": false,\n        \"service_type\": \"USPS Parcel Select Ground\",\n        \"service_code\": \"usps_parcel_select\",\n        \"trackable\": true,\n        \"carrier_code\": \"stamps_com\",\n        \"carrier_nickname\": \"ShipEngine Test Account - Stamps.com\",\n        \"carrier_friendly_name\": \"Stamps.com\",\n        \"validation_status\": \"unknown\",\n        \"warning_messages\": [],\n        \"error_messages\": []\n    },\n    {\n        \"rate_type\": \"check\",\n        \"carrier_id\": \"se-121861\",\n        \"shipping_amount\": {\n            \"currency\": \"usd\",\n            \"amount\": 39.23\n        },\n        \"insurance_amount\": {\n            \"currency\": \"usd\",\n            \"amount\": 0\n        },\n        \"confirmation_amount\": {\n            \"currency\": \"usd\",\n            \"amount\": 0\n        },\n        \"other_amount\": {\n            \"currency\": \"usd\",\n            \"amount\": 0\n        },\n        \"zone\": 6,\n        \"package_type\": \"package\",\n        \"delivery_days\": 3,\n        \"guaranteed_service\": false,\n        \"estimated_delivery_date\": \"2019-09-20T00:00:00Z\",\n        \"carrier_delivery_days\": \"3\",\n        \"ship_date\": \"2019-09-17T00:00:00Z\",\n        \"negotiated_rate\": false,\n        \"service_type\": \"USPS Priority Mail\",\n        \"service_code\": \"usps_priority_mail\",\n        \"trackable\": true,\n        \"carrier_code\": \"stamps_com\",\n        \"carrier_nickname\": \"ShipEngine Test Account - Stamps.com\",\n        \"carrier_friendly_name\": \"Stamps.com\",\n        \"validation_status\": \"unknown\",\n        \"warning_messages\": [],\n        \"error_messages\": []\n    },\n    {\n        \"rate_type\": \"check\",\n        \"carrier_id\": \"se-121861\",\n        \"shipping_amount\": {\n            \"currency\": \"usd\",\n            \"amount\": 12.72\n        },\n        \"insurance_amount\": {\n            \"currency\": \"usd\",\n            \"amount\": 0\n        },\n        \"confirmation_amount\": {\n            \"currency\": \"usd\",\n            \"amount\": 0\n        },\n        \"other_amount\": {\n            \"currency\": \"usd\",\n            \"amount\": 0\n        },\n        \"zone\": 6,\n        \"package_type\": \"medium_flat_rate_box\",\n        \"delivery_days\": 3,\n        \"guaranteed_service\": false,\n        \"estimated_delivery_date\": \"2019-09-20T00:00:00Z\",\n        \"carrier_delivery_days\": \"3\",\n        \"ship_date\": \"2019-09-17T00:00:00Z\",\n        \"negotiated_rate\": false,\n        \"service_type\": \"USPS Priority Mail\",\n        \"service_code\": \"usps_priority_mail\",\n        \"trackable\": true,\n        \"carrier_code\": \"stamps_com\",\n        \"carrier_nickname\": \"ShipEngine Test Account - Stamps.com\",\n        \"carrier_friendly_name\": \"Stamps.com\",\n        \"validation_status\": \"unknown\",\n        \"warning_messages\": [],\n        \"error_messages\": []\n    },\n    {\n        \"rate_type\": \"check\",\n        \"carrier_id\": \"se-121861\",\n        \"shipping_amount\": {\n            \"currency\": \"usd\",\n            \"amount\": 6.98\n        },\n        \"insurance_amount\": {\n            \"currency\": \"usd\",\n            \"amount\": 0\n        },\n        \"confirmation_amount\": {\n            \"currency\": \"usd\",\n            \"amount\": 0\n        },\n        \"other_amount\": {\n            \"currency\": \"usd\",\n            \"amount\": 0\n        },\n        \"zone\": 6,\n        \"package_type\": \"small_flat_rate_box\",\n        \"delivery_days\": 3,\n        \"guaranteed_service\": false,\n        \"estimated_delivery_date\": \"2019-09-20T00:00:00Z\",\n        \"carrier_delivery_days\": \"3\",\n        \"ship_date\": \"2019-09-17T00:00:00Z\",\n        \"negotiated_rate\": false,\n        \"service_type\": \"USPS Priority Mail\",\n        \"service_code\": \"usps_priority_mail\",\n        \"trackable\": true,\n        \"carrier_code\": \"stamps_com\",\n        \"carrier_nickname\": \"ShipEngine Test Account - Stamps.com\",\n        \"carrier_friendly_name\": \"Stamps.com\",\n        \"validation_status\": \"unknown\",\n        \"warning_messages\": [],\n        \"error_messages\": []\n    },\n    {\n        \"rate_type\": \"check\",\n        \"carrier_id\": \"se-121861\",\n        \"shipping_amount\": {\n            \"currency\": \"usd\",\n            \"amount\": 17.47\n        },\n        \"insurance_amount\": {\n            \"currency\": \"usd\",\n            \"amount\": 0\n        },\n        \"confirmation_amount\": {\n            \"currency\": \"usd\",\n            \"amount\": 0\n        },\n        \"other_amount\": {\n            \"currency\": \"usd\",\n            \"amount\": 0\n        },\n        \"zone\": 6,\n        \"package_type\": \"large_flat_rate_box\",\n        \"delivery_days\": 3,\n        \"guaranteed_service\": false,\n        \"estimated_delivery_date\": \"2019-09-20T00:00:00Z\",\n        \"carrier_delivery_days\": \"3\",\n        \"ship_date\": \"2019-09-17T00:00:00Z\",\n        \"negotiated_rate\": false,\n        \"service_type\": \"USPS Priority Mail\",\n        \"service_code\": \"usps_priority_mail\",\n        \"trackable\": true,\n        \"carrier_code\": \"stamps_com\",\n        \"carrier_nickname\": \"ShipEngine Test Account - Stamps.com\",\n        \"carrier_friendly_name\": \"Stamps.com\",\n        \"validation_status\": \"unknown\",\n        \"warning_messages\": [],\n        \"error_messages\": []\n    },\n    {\n        \"rate_type\": \"check\",\n        \"carrier_id\": \"se-121861\",\n        \"shipping_amount\": {\n            \"currency\": \"usd\",\n            \"amount\": 6.48\n        },\n        \"insurance_amount\": {\n            \"currency\": \"usd\",\n            \"amount\": 0\n        },\n        \"confirmation_amount\": {\n            \"currency\": \"usd\",\n            \"amount\": 0\n        },\n        \"other_amount\": {\n            \"currency\": \"usd\",\n            \"amount\": 0\n        },\n        \"zone\": 6,\n        \"package_type\": \"flat_rate_envelope\",\n        \"delivery_days\": 3,\n        \"guaranteed_service\": false,\n        \"estimated_delivery_date\": \"2019-09-20T00:00:00Z\",\n        \"carrier_delivery_days\": \"3\",\n        \"ship_date\": \"2019-09-17T00:00:00Z\",\n        \"negotiated_rate\": false,\n        \"service_type\": \"USPS Priority Mail\",\n        \"service_code\": \"usps_priority_mail\",\n        \"trackable\": true,\n        \"carrier_code\": \"stamps_com\",\n        \"carrier_nickname\": \"ShipEngine Test Account - Stamps.com\",\n        \"carrier_friendly_name\": \"Stamps.com\",\n        \"validation_status\": \"unknown\",\n        \"warning_messages\": [],\n        \"error_messages\": []\n    },\n    {\n        \"rate_type\": \"check\",\n        \"carrier_id\": \"se-121861\",\n        \"shipping_amount\": {\n            \"currency\": \"usd\",\n            \"amount\": 7.03\n        },\n        \"insurance_amount\": {\n            \"currency\": \"usd\",\n            \"amount\": 0\n        },\n        \"confirmation_amount\": {\n            \"currency\": \"usd\",\n            \"amount\": 0\n        },\n        \"other_amount\": {\n            \"currency\": \"usd\",\n            \"amount\": 0\n        },\n        \"zone\": 6,\n        \"package_type\": \"flat_rate_padded_envelope\",\n        \"delivery_days\": 3,\n        \"guaranteed_service\": false,\n        \"estimated_delivery_date\": \"2019-09-20T00:00:00Z\",\n        \"carrier_delivery_days\": \"3\",\n        \"ship_date\": \"2019-09-17T00:00:00Z\",\n        \"negotiated_rate\": false,\n        \"service_type\": \"USPS Priority Mail\",\n        \"service_code\": \"usps_priority_mail\",\n        \"trackable\": true,\n        \"carrier_code\": \"stamps_com\",\n        \"carrier_nickname\": \"ShipEngine Test Account - Stamps.com\",\n        \"carrier_friendly_name\": \"Stamps.com\",\n        \"validation_status\": \"unknown\",\n        \"warning_messages\": [],\n        \"error_messages\": []\n    },\n    {\n        \"rate_type\": \"check\",\n        \"carrier_id\": \"se-121861\",\n        \"shipping_amount\": {\n            \"currency\": \"usd\",\n            \"amount\": 16.1\n        },\n        \"insurance_amount\": {\n            \"currency\": \"usd\",\n            \"amount\": 0\n        },\n        \"confirmation_amount\": {\n            \"currency\": \"usd\",\n            \"amount\": 0\n        },\n        \"other_amount\": {\n            \"currency\": \"usd\",\n            \"amount\": 0\n        },\n        \"zone\": 6,\n        \"package_type\": \"regional_rate_box_b\",\n        \"delivery_days\": 3,\n        \"guaranteed_service\": false,\n        \"estimated_delivery_date\": \"2019-09-20T00:00:00Z\",\n        \"carrier_delivery_days\": \"3\",\n        \"ship_date\": \"2019-09-17T00:00:00Z\",\n        \"negotiated_rate\": false,\n        \"service_type\": \"USPS Priority Mail\",\n        \"service_code\": \"usps_priority_mail\",\n        \"trackable\": true,\n        \"carrier_code\": \"stamps_com\",\n        \"carrier_nickname\": \"ShipEngine Test Account - Stamps.com\",\n        \"carrier_friendly_name\": \"Stamps.com\",\n        \"validation_status\": \"unknown\",\n        \"warning_messages\": [],\n        \"error_messages\": []\n    },\n    {\n        \"rate_type\": \"check\",\n        \"carrier_id\": \"se-121861\",\n        \"shipping_amount\": {\n            \"currency\": \"usd\",\n            \"amount\": 6.78\n        },\n        \"insurance_amount\": {\n            \"currency\": \"usd\",\n            \"amount\": 0\n        },\n        \"confirmation_amount\": {\n            \"currency\": \"usd\",\n            \"amount\": 0\n        },\n        \"other_amount\": {\n            \"currency\": \"usd\",\n            \"amount\": 0\n        },\n        \"zone\": 6,\n        \"package_type\": \"flat_rate_legal_envelope\",\n        \"delivery_days\": 3,\n        \"guaranteed_service\": false,\n        \"estimated_delivery_date\": \"2019-09-20T00:00:00Z\",\n        \"carrier_delivery_days\": \"3\",\n        \"ship_date\": \"2019-09-17T00:00:00Z\",\n        \"negotiated_rate\": false,\n        \"service_type\": \"USPS Priority Mail\",\n        \"service_code\": \"usps_priority_mail\",\n        \"trackable\": true,\n        \"carrier_code\": \"stamps_com\",\n        \"carrier_nickname\": \"ShipEngine Test Account - Stamps.com\",\n        \"carrier_friendly_name\": \"Stamps.com\",\n        \"validation_status\": \"unknown\",\n        \"warning_messages\": [],\n        \"error_messages\": []\n    },\n    {\n        \"rate_type\": \"check\",\n        \"carrier_id\": \"se-121861\",\n        \"shipping_amount\": {\n            \"currency\": \"usd\",\n            \"amount\": 103.04\n        },\n        \"insurance_amount\": {\n            \"currency\": \"usd\",\n            \"amount\": 0\n        },\n        \"confirmation_amount\": {\n            \"currency\": \"usd\",\n            \"amount\": 0\n        },\n        \"other_amount\": {\n            \"currency\": \"usd\",\n            \"amount\": 0\n        },\n        \"zone\": 6,\n        \"package_type\": \"package\",\n        \"delivery_days\": 2,\n        \"guaranteed_service\": false,\n        \"estimated_delivery_date\": \"2019-09-19T00:00:00Z\",\n        \"carrier_delivery_days\": \"1-2\",\n        \"ship_date\": \"2019-09-17T00:00:00Z\",\n        \"negotiated_rate\": false,\n        \"service_type\": \"USPS Priority Mail Express\",\n        \"service_code\": \"usps_priority_mail_express\",\n        \"trackable\": true,\n        \"carrier_code\": \"stamps_com\",\n        \"carrier_nickname\": \"ShipEngine Test Account - Stamps.com\",\n        \"carrier_friendly_name\": \"Stamps.com\",\n        \"validation_status\": \"unknown\",\n        \"warning_messages\": [],\n        \"error_messages\": []\n    },\n    {\n        \"rate_type\": \"check\",\n        \"carrier_id\": \"se-121861\",\n        \"shipping_amount\": {\n            \"currency\": \"usd\",\n            \"amount\": 22.68\n        },\n        \"insurance_amount\": {\n            \"currency\": \"usd\",\n            \"amount\": 0\n        },\n        \"confirmation_amount\": {\n            \"currency\": \"usd\",\n            \"amount\": 0\n        },\n        \"other_amount\": {\n            \"currency\": \"usd\",\n            \"amount\": 0\n        },\n        \"zone\": 6,\n        \"package_type\": \"flat_rate_envelope\",\n        \"delivery_days\": 2,\n        \"guaranteed_service\": false,\n        \"estimated_delivery_date\": \"2019-09-19T00:00:00Z\",\n        \"carrier_delivery_days\": \"1-2\",\n        \"ship_date\": \"2019-09-17T00:00:00Z\",\n        \"negotiated_rate\": false,\n        \"service_type\": \"USPS Priority Mail Express\",\n        \"service_code\": \"usps_priority_mail_express\",\n        \"trackable\": true,\n        \"carrier_code\": \"stamps_com\",\n        \"carrier_nickname\": \"ShipEngine Test Account - Stamps.com\",\n        \"carrier_friendly_name\": \"Stamps.com\",\n        \"validation_status\": \"unknown\",\n        \"warning_messages\": [],\n        \"error_messages\": []\n    },\n    {\n        \"rate_type\": \"check\",\n        \"carrier_id\": \"se-121861\",\n        \"shipping_amount\": {\n            \"currency\": \"usd\",\n            \"amount\": 23.18\n        },\n        \"insurance_amount\": {\n            \"currency\": \"usd\",\n            \"amount\": 0\n        },\n        \"confirmation_amount\": {\n            \"currency\": \"usd\",\n            \"amount\": 0\n        },\n        \"other_amount\": {\n            \"currency\": \"usd\",\n            \"amount\": 0\n        },\n        \"zone\": 6,\n        \"package_type\": \"flat_rate_padded_envelope\",\n        \"delivery_days\": 2,\n        \"guaranteed_service\": false,\n        \"estimated_delivery_date\": \"2019-09-19T00:00:00Z\",\n        \"carrier_delivery_days\": \"1-2\",\n        \"ship_date\": \"2019-09-17T00:00:00Z\",\n        \"negotiated_rate\": false,\n        \"service_type\": \"USPS Priority Mail Express\",\n        \"service_code\": \"usps_priority_mail_express\",\n        \"trackable\": true,\n        \"carrier_code\": \"stamps_com\",\n        \"carrier_nickname\": \"ShipEngine Test Account - Stamps.com\",\n        \"carrier_friendly_name\": \"Stamps.com\",\n        \"validation_status\": \"unknown\",\n        \"warning_messages\": [],\n        \"error_messages\": []\n    },\n    {\n        \"rate_type\": \"check\",\n        \"carrier_id\": \"se-121861\",\n        \"shipping_amount\": {\n            \"currency\": \"usd\",\n            \"amount\": 22.8\n        },\n        \"insurance_amount\": {\n            \"currency\": \"usd\",\n            \"amount\": 0\n        },\n        \"confirmation_amount\": {\n            \"currency\": \"usd\",\n            \"amount\": 0\n        },\n        \"other_amount\": {\n            \"currency\": \"usd\",\n            \"amount\": 0\n        },\n        \"zone\": 6,\n        \"package_type\": \"flat_rate_legal_envelope\",\n        \"delivery_days\": 2,\n        \"guaranteed_service\": false,\n        \"estimated_delivery_date\": \"2019-09-19T00:00:00Z\",\n        \"carrier_delivery_days\": \"1-2\",\n        \"ship_date\": \"2019-09-17T00:00:00Z\",\n        \"negotiated_rate\": false,\n        \"service_type\": \"USPS Priority Mail Express\",\n        \"service_code\": \"usps_priority_mail_express\",\n        \"trackable\": true,\n        \"carrier_code\": \"stamps_com\",\n        \"carrier_nickname\": \"ShipEngine Test Account - Stamps.com\",\n        \"carrier_friendly_name\": \"Stamps.com\",\n        \"validation_status\": \"unknown\",\n        \"warning_messages\": [],\n        \"error_messages\": []\n    }\n]"
    }
  ]
}