Skip to content

Latest commit

 

History

History
130 lines (93 loc) · 11.1 KB

File metadata and controls

130 lines (93 loc) · 11.1 KB

TrackingStatus

(trackingStatus())

Overview


If you purchased your shipping label through Shippo, you can also get all the tracking details of your Shipment from the Transaction object.

A tracking status of a package is an indication of current location of a package in the supply chain. For example, sorting, warehousing, or out for delivery. Use the tracking status object to track the location of your shipments.

When using your Test token for tracking, you need to use Shippo's predefined tokens for testing different tracking statuses. You can find more information in our Tracking tutorial on how to do this, and what the payloads look like.

Available Operations

  • create - Register a tracking webhook
  • get - Get a tracking status

create

Registers a webhook that will send HTTP notifications to you when the status of your tracked package changes. For more details on creating a webhook, see our guides on Webhooks and Tracking.

Example Usage

package hello.world;

import com.goshippo.shippo_sdk.Shippo;
import com.goshippo.shippo_sdk.models.components.TracksRequest;
import com.goshippo.shippo_sdk.models.operations.CreateTrackResponse;
import java.lang.Exception;

public class Application {

    public static void main(String[] args) throws Exception {

        Shippo sdk = Shippo.builder()
                .apiKeyHeader("<YOUR_API_KEY_HERE>")
                .shippoApiVersion("2018-02-08")
            .build();

        CreateTrackResponse res = sdk.trackingStatus().create()
                .shippoApiVersion("2018-02-08")
                .tracksRequest(TracksRequest.builder()
                    .carrier("usps")
                    .trackingNumber("9205590164917312751089")
                    .metadata("Order 000123")
                    .build())
                .call();

        if (res.track().isPresent()) {
            // handle response
        }
    }
}

Parameters

Parameter Type Required Description Example
shippoApiVersion Optional<String> Optional string used to pick a non-default API version to use. See our API version guide. 2018-02-08
tracksRequest TracksRequest ✔️ N/A

Response

CreateTrackResponse

Errors

Error Type Status Code Content Type
models/errors/SDKError 4XX, 5XX */*

get

Returns the tracking status of a shipment using a carrier name and a tracking number.

Example Usage

package hello.world;

import com.goshippo.shippo_sdk.Shippo;
import com.goshippo.shippo_sdk.models.operations.GetTrackResponse;
import java.lang.Exception;

public class Application {

    public static void main(String[] args) throws Exception {

        Shippo sdk = Shippo.builder()
                .apiKeyHeader("<YOUR_API_KEY_HERE>")
                .shippoApiVersion("2018-02-08")
            .build();

        GetTrackResponse res = sdk.trackingStatus().get()
                .trackingNumber("<value>")
                .carrier("<value>")
                .shippoApiVersion("2018-02-08")
                .call();

        if (res.track().isPresent()) {
            // handle response
        }
    }
}

Parameters

Parameter Type Required Description Example
trackingNumber String ✔️ Tracking number
carrier String ✔️ Name of the carrier
shippoApiVersion Optional<String> Optional string used to pick a non-default API version to use. See our API version guide. 2018-02-08

Response

GetTrackResponse

Errors

Error Type Status Code Content Type
models/errors/SDKError 4XX, 5XX */*