Chilkat Online Tools

DataFlex / Selling Partner API for Easy Ship / get Scheduled Package

Back to Collection Items

Use ChilkatAx-9.5.0-win32.pkg

Procedure Test
    Handle hoHttp
    Boolean iSuccess
    Variant vQueryParams
    Handle hoQueryParams
    Variant vResp
    Handle hoResp
    Variant vSbResponseBody
    Handle hoSbResponseBody
    Handle hoJResp
    Integer iRespStatusCode
    String sOrderItemId
    Integer j
    Integer iCount_j
    String sStrVal
    String sLength
    String sWidth
    String sHeight
    String sUnit
    String sIdentifier
    String sSlotId
    String sStartTime
    String sEndTime
    String sHandoverMethod
    String sValue
    String sPackageWeightUnit
    String sAmazonOrderId
    String sPackageId
    String sPackageIdentifier
    String sInvoiceNumber
    String sInvoiceDate
    String sPackageStatus
    String sTrackingId
    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

    Get Create (RefClass(cComChilkatJsonObject)) To hoQueryParams
    If (Not(IsComObjectCreated(hoQueryParams))) Begin
        Send CreateComObject of hoQueryParams
    End
    Get ComUpdateString Of hoQueryParams "amazonOrderId" "nisi non tempor minim" To iSuccess
    Get ComUpdateString Of hoQueryParams "marketplaceId" "nisi non tempor minim" To iSuccess

    Send ComSetRequestHeader To hoHttp "Accept" "application/json"

    Get pvComObject of hoQueryParams to vQueryParams
    Get ComQuickRequestParams Of hoHttp "GET" "https://sellingpartnerapi-na.amazon.com/easyShip/2022-03-23/package" vQueryParams To vResp
    If (IsComObject(vResp)) Begin
        Get Create (RefClass(cComChilkatHttpResponse)) To hoResp
        Set pvComObject Of hoResp To vResp
    End
    Get ComLastMethodSuccess Of hoHttp To bTemp1
    If (bTemp1 = False) Begin
        Get ComLastErrorText Of hoHttp To sTemp1
        Showln sTemp1
        Procedure_Return
    End

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

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

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

    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)

    // {
    //   "packageDimensions": {
    //     "length": 92908506.38751999,
    //     "width": 69740717.24177761,
    //     "height": 55703784.11292852,
    //     "unit": "Cm",
    //     "identifier": "velit elit incididunt"
    //   },
    //   "packageTimeSlot": {
    //     "slotId": "id sit ut elit",
    //     "startTime": "2015-08-10T18:15:47.176Z",
    //     "endTime": "1974-01-15T04:04:16.651Z",
    //     "handoverMethod": "Dropoff"
    //   },
    //   "packageWeight": {
    //     "value": 22615253.265217148,
    //     "unit": "Grams"
    //   },
    //   "scheduledPackageId": {
    //     "amazonOrderId": "eu ex pariatur mollit",
    //     "packageId": "la"
    //   },
    //   "packageItems": [
    //     {
    //       "orderItemId": "irure in",
    //       "orderItemSerialNumbers": [
    //         "est qui magna dolor in",
    //         "do sint consequat"
    //       ]
    //     },
    //     {
    //       "orderItemId": "incididunt proident",
    //       "orderItemSerialNumbers": [
    //         "amet",
    //         "ex"
    //       ]
    //     }
    //   ],
    //   "packageIdentifier": "Lorem",
    //   "invoice": {
    //     "invoiceNumber": "esse non",
    //     "invoiceDate": "2020-10-09T01:25:28.191Z"
    //   },
    //   "packageStatus": "AtDestinationFC",
    //   "trackingDetails": {
    //     "trackingId": "dolor est aute"
    //   }
    // }

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

    Get ComStringOf Of hoJResp "packageDimensions.length" To sLength
    Get ComStringOf Of hoJResp "packageDimensions.width" To sWidth
    Get ComStringOf Of hoJResp "packageDimensions.height" To sHeight
    Get ComStringOf Of hoJResp "packageDimensions.unit" To sUnit
    Get ComStringOf Of hoJResp "packageDimensions.identifier" To sIdentifier
    Get ComStringOf Of hoJResp "packageTimeSlot.slotId" To sSlotId
    Get ComStringOf Of hoJResp "packageTimeSlot.startTime" To sStartTime
    Get ComStringOf Of hoJResp "packageTimeSlot.endTime" To sEndTime
    Get ComStringOf Of hoJResp "packageTimeSlot.handoverMethod" To sHandoverMethod
    Get ComStringOf Of hoJResp "packageWeight.value" To sValue
    Get ComStringOf Of hoJResp "packageWeight.unit" To sPackageWeightUnit
    Get ComStringOf Of hoJResp "scheduledPackageId.amazonOrderId" To sAmazonOrderId
    Get ComStringOf Of hoJResp "scheduledPackageId.packageId" To sPackageId
    Get ComStringOf Of hoJResp "packageIdentifier" To sPackageIdentifier
    Get ComStringOf Of hoJResp "invoice.invoiceNumber" To sInvoiceNumber
    Get ComStringOf Of hoJResp "invoice.invoiceDate" To sInvoiceDate
    Get ComStringOf Of hoJResp "packageStatus" To sPackageStatus
    Get ComStringOf Of hoJResp "trackingDetails.trackingId" To sTrackingId
    Move 0 To i
    Get ComSizeOfArray Of hoJResp "packageItems" To iCount_i
    While (i < iCount_i)
        Set ComI Of hoJResp To i
        Get ComStringOf Of hoJResp "packageItems[i].orderItemId" To sOrderItemId
        Move 0 To j
        Get ComSizeOfArray Of hoJResp "packageItems[i].orderItemSerialNumbers" To iCount_j
        While (j < iCount_j)
            Set ComJ Of hoJResp To j
            Get ComStringOf Of hoJResp "packageItems[i].orderItemSerialNumbers[j]" To sStrVal
            Move (j + 1) To j
        Loop

        Move (i + 1) To i
    Loop



End_Procedure

Curl Command

curl -G -d "amazonOrderId=nisi%20non%20tempor%20minim"
	-d "marketplaceId=nisi%20non%20tempor%20minim"
	-H "Accept: application/json"
https://sellingpartnerapi-na.amazon.com/easyShip/2022-03-23/package

Postman Collection Item JSON

{
  "name": "get Scheduled Package",
  "request": {
    "method": "GET",
    "header": [
      {
        "key": "Accept",
        "value": "application/json"
      }
    ],
    "url": {
      "raw": "{{baseUrl}}/easyShip/2022-03-23/package?amazonOrderId=nisi non tempor minim&marketplaceId=nisi non tempor minim",
      "host": [
        "{{baseUrl}}"
      ],
      "path": [
        "easyShip",
        "2022-03-23",
        "package"
      ],
      "query": [
        {
          "key": "amazonOrderId",
          "value": "nisi non tempor minim",
          "description": "(Required) An Amazon-defined order identifier. Identifies the order that the seller wants to deliver using Amazon Easy Ship."
        },
        {
          "key": "marketplaceId",
          "value": "nisi non tempor minim",
          "description": "(Required) An identifier for the marketplace in which the seller is selling."
        }
      ]
    },
    "description": "Returns information about a package, including dimensions, weight, time slot information for handover, invoice and item information, and status.\n\n**Usage Plan:**\n\n| Rate (requests per second) | Burst |\n| ---- | ---- |\n| 1 | 5 |\n\nThe `x-amzn-RateLimit-Limit` response header returns the usage plan rate limits that were applied to the requested operation, when available. The table above indicates the default rate and burst values for this operation. Selling partners whose business demands require higher throughput may see higher rate and burst values than those shown here. For more information, see [Usage Plans and Rate Limits in the Selling Partner API](doc:usage-plans-and-rate-limits-in-the-sp-api)."
  },
  "response": [
    {
      "name": "Success.",
      "originalRequest": {
        "method": "GET",
        "header": [
        ],
        "url": {
          "raw": "{{baseUrl}}/easyShip/2022-03-23/package?amazonOrderId=nisi non tempor minim&marketplaceId=nisi non tempor minim",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "easyShip",
            "2022-03-23",
            "package"
          ],
          "query": [
            {
              "key": "amazonOrderId",
              "value": "nisi non tempor minim"
            },
            {
              "key": "marketplaceId",
              "value": "nisi non tempor minim"
            }
          ]
        }
      },
      "status": "OK",
      "code": 200,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "x-amzn-RateLimit-Limit",
          "value": "do anim",
          "description": "Your rate limit (requests per second) for this operation."
        },
        {
          "key": "x-amzn-RequestId",
          "value": "do anim",
          "description": "Unique request reference identifier."
        },
        {
          "key": "Content-Type",
          "value": "application/json"
        }
      ],
      "cookie": [
      ],
      "body": "{\n  \"packageDimensions\": {\n    \"length\": 92908506.38751999,\n    \"width\": 69740717.24177761,\n    \"height\": 55703784.11292852,\n    \"unit\": \"Cm\",\n    \"identifier\": \"velit elit incididunt\"\n  },\n  \"packageTimeSlot\": {\n    \"slotId\": \"id sit ut elit\",\n    \"startTime\": \"2015-08-10T18:15:47.176Z\",\n    \"endTime\": \"1974-01-15T04:04:16.651Z\",\n    \"handoverMethod\": \"Dropoff\"\n  },\n  \"packageWeight\": {\n    \"value\": 22615253.265217148,\n    \"unit\": \"Grams\"\n  },\n  \"scheduledPackageId\": {\n    \"amazonOrderId\": \"eu ex pariatur mollit\",\n    \"packageId\": \"la\"\n  },\n  \"packageItems\": [\n    {\n      \"orderItemId\": \"irure in\",\n      \"orderItemSerialNumbers\": [\n        \"est qui magna dolor in\",\n        \"do sint consequat\"\n      ]\n    },\n    {\n      \"orderItemId\": \"incididunt proident\",\n      \"orderItemSerialNumbers\": [\n        \"amet\",\n        \"ex\"\n      ]\n    }\n  ],\n  \"packageIdentifier\": \"Lorem\",\n  \"invoice\": {\n    \"invoiceNumber\": \"esse non\",\n    \"invoiceDate\": \"2020-10-09T01:25:28.191Z\"\n  },\n  \"packageStatus\": \"AtDestinationFC\",\n  \"trackingDetails\": {\n    \"trackingId\": \"dolor est aute\"\n  }\n}"
    },
    {
      "name": "Request has missing or invalid parameters and cannot be parsed.",
      "originalRequest": {
        "method": "GET",
        "header": [
        ],
        "url": {
          "raw": "{{baseUrl}}/easyShip/2022-03-23/package?amazonOrderId=nisi non tempor minim&marketplaceId=nisi non tempor minim",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "easyShip",
            "2022-03-23",
            "package"
          ],
          "query": [
            {
              "key": "amazonOrderId",
              "value": "nisi non tempor minim"
            },
            {
              "key": "marketplaceId",
              "value": "nisi non tempor minim"
            }
          ]
        }
      },
      "status": "Bad Request",
      "code": 400,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "x-amzn-RateLimit-Limit",
          "value": "do anim",
          "description": "Your rate limit (requests per second) for this operation."
        },
        {
          "key": "x-amzn-RequestId",
          "value": "do anim",
          "description": "Unique request reference identifier."
        },
        {
          "key": "Content-Type",
          "value": "application/json"
        }
      ],
      "cookie": [
      ],
      "body": "{\n  \"errors\": [\n    {\n      \"code\": \"minim nisi sint\",\n      \"message\": \"irure sed dolor\",\n      \"details\": \"officia consectetur Excepteur\"\n    },\n    {\n      \"code\": \"Ut do\",\n      \"message\": \"non nisi ipsum\",\n      \"details\": \"Ut\"\n    }\n  ]\n}"
    },
    {
      "name": "The request's Authorization header is not formatted correctly or does not contain a valid token.",
      "originalRequest": {
        "method": "GET",
        "header": [
        ],
        "url": {
          "raw": "{{baseUrl}}/easyShip/2022-03-23/package?amazonOrderId=nisi non tempor minim&marketplaceId=nisi non tempor minim",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "easyShip",
            "2022-03-23",
            "package"
          ],
          "query": [
            {
              "key": "amazonOrderId",
              "value": "nisi non tempor minim"
            },
            {
              "key": "marketplaceId",
              "value": "nisi non tempor minim"
            }
          ]
        }
      },
      "status": "Unauthorized",
      "code": 401,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "x-amzn-RateLimit-Limit",
          "value": "do anim",
          "description": "Your rate limit (requests per second) for this operation."
        },
        {
          "key": "x-amzn-RequestId",
          "value": "do anim",
          "description": "Unique request reference identifier."
        },
        {
          "key": "Content-Type",
          "value": "application/json"
        }
      ],
      "cookie": [
      ],
      "body": "{\n  \"errors\": [\n    {\n      \"code\": \"minim nisi sint\",\n      \"message\": \"irure sed dolor\",\n      \"details\": \"officia consectetur Excepteur\"\n    },\n    {\n      \"code\": \"Ut do\",\n      \"message\": \"non nisi ipsum\",\n      \"details\": \"Ut\"\n    }\n  ]\n}"
    },
    {
      "name": "Indicates access to the resource is forbidden. Possible reasons include Access Denied, Unauthorized, Expired Token, or Invalid Signature.",
      "originalRequest": {
        "method": "GET",
        "header": [
        ],
        "url": {
          "raw": "{{baseUrl}}/easyShip/2022-03-23/package?amazonOrderId=nisi non tempor minim&marketplaceId=nisi non tempor minim",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "easyShip",
            "2022-03-23",
            "package"
          ],
          "query": [
            {
              "key": "amazonOrderId",
              "value": "nisi non tempor minim"
            },
            {
              "key": "marketplaceId",
              "value": "nisi non tempor minim"
            }
          ]
        }
      },
      "status": "Forbidden",
      "code": 403,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "x-amzn-RequestId",
          "value": "do anim",
          "description": "Unique request reference identifier."
        },
        {
          "key": "Content-Type",
          "value": "application/json"
        }
      ],
      "cookie": [
      ],
      "body": "{\n  \"errors\": [\n    {\n      \"code\": \"minim nisi sint\",\n      \"message\": \"irure sed dolor\",\n      \"details\": \"officia consectetur Excepteur\"\n    },\n    {\n      \"code\": \"Ut do\",\n      \"message\": \"non nisi ipsum\",\n      \"details\": \"Ut\"\n    }\n  ]\n}"
    },
    {
      "name": "The specified resource does not exist.",
      "originalRequest": {
        "method": "GET",
        "header": [
        ],
        "url": {
          "raw": "{{baseUrl}}/easyShip/2022-03-23/package?amazonOrderId=nisi non tempor minim&marketplaceId=nisi non tempor minim",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "easyShip",
            "2022-03-23",
            "package"
          ],
          "query": [
            {
              "key": "amazonOrderId",
              "value": "nisi non tempor minim"
            },
            {
              "key": "marketplaceId",
              "value": "nisi non tempor minim"
            }
          ]
        }
      },
      "status": "Not Found",
      "code": 404,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "x-amzn-RateLimit-Limit",
          "value": "do anim",
          "description": "Your rate limit (requests per second) for this operation."
        },
        {
          "key": "x-amzn-RequestId",
          "value": "do anim",
          "description": "Unique request reference identifier."
        },
        {
          "key": "Content-Type",
          "value": "application/json"
        }
      ],
      "cookie": [
      ],
      "body": "{\n  \"errors\": [\n    {\n      \"code\": \"minim nisi sint\",\n      \"message\": \"irure sed dolor\",\n      \"details\": \"officia consectetur Excepteur\"\n    },\n    {\n      \"code\": \"Ut do\",\n      \"message\": \"non nisi ipsum\",\n      \"details\": \"Ut\"\n    }\n  ]\n}"
    },
    {
      "name": "The request payload is in an unsupported format.",
      "originalRequest": {
        "method": "GET",
        "header": [
        ],
        "url": {
          "raw": "{{baseUrl}}/easyShip/2022-03-23/package?amazonOrderId=nisi non tempor minim&marketplaceId=nisi non tempor minim",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "easyShip",
            "2022-03-23",
            "package"
          ],
          "query": [
            {
              "key": "amazonOrderId",
              "value": "nisi non tempor minim"
            },
            {
              "key": "marketplaceId",
              "value": "nisi non tempor minim"
            }
          ]
        }
      },
      "status": "Unsupported Media Type",
      "code": 415,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "x-amzn-RequestId",
          "value": "do anim",
          "description": "Unique request reference identifier."
        },
        {
          "key": "Content-Type",
          "value": "application/json"
        }
      ],
      "cookie": [
      ],
      "body": "{\n  \"errors\": [\n    {\n      \"code\": \"minim nisi sint\",\n      \"message\": \"irure sed dolor\",\n      \"details\": \"officia consectetur Excepteur\"\n    },\n    {\n      \"code\": \"Ut do\",\n      \"message\": \"non nisi ipsum\",\n      \"details\": \"Ut\"\n    }\n  ]\n}"
    },
    {
      "name": "The frequency of requests was greater than allowed.",
      "originalRequest": {
        "method": "GET",
        "header": [
        ],
        "url": {
          "raw": "{{baseUrl}}/easyShip/2022-03-23/package?amazonOrderId=nisi non tempor minim&marketplaceId=nisi non tempor minim",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "easyShip",
            "2022-03-23",
            "package"
          ],
          "query": [
            {
              "key": "amazonOrderId",
              "value": "nisi non tempor minim"
            },
            {
              "key": "marketplaceId",
              "value": "nisi non tempor minim"
            }
          ]
        }
      },
      "status": "Too Many Requests",
      "code": 429,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "x-amzn-RequestId",
          "value": "do anim",
          "description": "Unique request reference identifier."
        },
        {
          "key": "Content-Type",
          "value": "application/json"
        }
      ],
      "cookie": [
      ],
      "body": "{\n  \"errors\": [\n    {\n      \"code\": \"minim nisi sint\",\n      \"message\": \"irure sed dolor\",\n      \"details\": \"officia consectetur Excepteur\"\n    },\n    {\n      \"code\": \"Ut do\",\n      \"message\": \"non nisi ipsum\",\n      \"details\": \"Ut\"\n    }\n  ]\n}"
    },
    {
      "name": "An unexpected condition occurred that prevented the server from fulfilling the request.",
      "originalRequest": {
        "method": "GET",
        "header": [
        ],
        "url": {
          "raw": "{{baseUrl}}/easyShip/2022-03-23/package?amazonOrderId=nisi non tempor minim&marketplaceId=nisi non tempor minim",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "easyShip",
            "2022-03-23",
            "package"
          ],
          "query": [
            {
              "key": "amazonOrderId",
              "value": "nisi non tempor minim"
            },
            {
              "key": "marketplaceId",
              "value": "nisi non tempor minim"
            }
          ]
        }
      },
      "status": "Internal Server Error",
      "code": 500,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "x-amzn-RequestId",
          "value": "do anim",
          "description": "Unique request reference identifier."
        },
        {
          "key": "Content-Type",
          "value": "application/json"
        }
      ],
      "cookie": [
      ],
      "body": "{\n  \"errors\": [\n    {\n      \"code\": \"minim nisi sint\",\n      \"message\": \"irure sed dolor\",\n      \"details\": \"officia consectetur Excepteur\"\n    },\n    {\n      \"code\": \"Ut do\",\n      \"message\": \"non nisi ipsum\",\n      \"details\": \"Ut\"\n    }\n  ]\n}"
    },
    {
      "name": "Temporary overloading or maintenance of the server.",
      "originalRequest": {
        "method": "GET",
        "header": [
        ],
        "url": {
          "raw": "{{baseUrl}}/easyShip/2022-03-23/package?amazonOrderId=nisi non tempor minim&marketplaceId=nisi non tempor minim",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "easyShip",
            "2022-03-23",
            "package"
          ],
          "query": [
            {
              "key": "amazonOrderId",
              "value": "nisi non tempor minim"
            },
            {
              "key": "marketplaceId",
              "value": "nisi non tempor minim"
            }
          ]
        }
      },
      "status": "Service Unavailable",
      "code": 503,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "x-amzn-RequestId",
          "value": "do anim",
          "description": "Unique request reference identifier."
        },
        {
          "key": "Content-Type",
          "value": "application/json"
        }
      ],
      "cookie": [
      ],
      "body": "{\n  \"errors\": [\n    {\n      \"code\": \"minim nisi sint\",\n      \"message\": \"irure sed dolor\",\n      \"details\": \"officia consectetur Excepteur\"\n    },\n    {\n      \"code\": \"Ut do\",\n      \"message\": \"non nisi ipsum\",\n      \"details\": \"Ut\"\n    }\n  ]\n}"
    }
  ]
}