packageTracker

📘

Important

The Buy with Prime API is offered as a preview and might change as we receive feedback and iterate on the interfaces. We are sharing this early documentation to help you learn about the Buy with Prime API as we write and iterate on the content.

Overview

Returns a package tracker.

ℹī¸

Required scope(s)

View Package Tracking Milestone Changes

Response

Return type PackageTracker

Arguments

ArgumentDescription
packageTrackerInput (PackageTrackerInput required)

Represents the request information for package tracker.

Examples


Query Package Tracker With Valid Input

Request

query packageTracker {
  packageTracker(packageTrackerInput: {
        packageTrackerIdentifier: {
          trackingNumber: "SampleTrackingNumber1",
          carrierCode: "ups"
        }
   }) {
    packageTrackerIdentifier {
      trackingNumber
      carrierCode
    }
    estimatedDeliveryDate {
      earliest
      latest
    }
    latestMilestone {
      status {
        code
        message {
          locale
          value
        }
      }
      address {
        locality
        region
        country
      }
      occurredAt
    }
    milestones {
      status {
        code
        message {
          locale
          value
        }
      }
      address {
        locality
        region
        country
      }
      occurredAt
    }
    trackingUrl
  }
}

Response

{
  "data": {
    "packageTracker": {
      "packageTrackerIdentifier": {
        "trackingNumber": "SampleTrackingNumber1",
        "carrierCode": "ups"
      },
      "estimatedDeliveryDate": {
        "earliest": "2024-07-02T05:54:53Z",
        "latest": "2024-07-04T05:54:53Z"
      },
      "latestMilestone": {
        "status": {
          "code": "DELIVERED",
          "message": {
            "locale": "en-US",
            "value": "Package delivered."
          }
        },
        "address": {
          "locality": "sample locality",
          "region": "sample region",
          "country": "US"
        },
        "occurredAt": "2024-07-02T05:54:53Z"
      },
      "milestones": [
        {
          "status": {
            "code": "DELIVERED",
            "message": {
              "locale": "en-US",
              "value": "Package delivered."
            }
          },
          "address": {
            "locality": "sample locality",
            "region": "sample region",
            "country": "US"
          },
          "occurredAt": "2024-07-02T05:54:53Z"
        },
        {
          "status": {
            "code": "IN_TRANSIT",
            "message": {
              "locale": "en-US",
              "value": "Package on the way."
            }
          },
          "address": {
            "locality": "sample locality",
            "region": "sample region",
            "country": "US"
          },
          "occurredAt": "2024-07-01T05:54:53Z"
        }
      ],
      "trackingUrl": null
    }
  }
}

Query Package Tracker With Invalid Input

Request

query packageTracker {
  packageTracker(packageTrackerInput: {
        packageTrackerIdentifier: {
          trackingNumber: "DoesNotExistTrackingNumber1",
          carrierCode: "ups"
        }
   }) {
    packageTrackerIdentifier {
      trackingNumber
      carrierCode
    }
    estimatedDeliveryDate {
      earliest
      latest
    }
    latestMilestone {
      status {
        code
        message {
          locale
          value
        }
      }
      address {
        locality
        region
        country
      }
      occurredAt
    }
    milestones {
      status {
        code
        message {
          locale
          value
        }
      }
      address {
        locality
        region
        country
      }
      occurredAt
    }
    trackingUrl
  }
}

Response

{
  "errors": [
    {
      "message": "Request references a resource which does not exist.",
      "locations": [
        {
          "line": 2,
          "column": 3
        }
      ],
      "path": [
        "packageTracker"
      ],
      "extensions": {
        "classification": {
          "type": "ResourceNotFoundError",
          "errorType": "ResourceNotFoundException",
          "errorCode": 404
        }
      }
    }
  ]
}