(Parcels)
A parcel is an item you are shipping. The parcel object includes details about its physical make-up of the parcel. It includes dimensions and weight that Shippo uses to calculate rates.
- List - List all parcels
- Create - Create a new parcel
- Get - Retrieve an existing parcel
Returns a list of all parcel objects.
using Shippo;
using Shippo.Models.Requests;
using Shippo.Models.Components;
var sdk = new ShippoSDK(
apiKeyHeader: "<YOUR_API_KEY_HERE>",
shippoApiVersion: "2018-02-08"
);
var res = await sdk.Parcels.ListAsync(
page: 1,
results: 25,
shippoApiVersion: "2018-02-08"
);
// handle response
| Parameter |
Type |
Required |
Description |
Example |
Page |
long |
➖ |
The page number you want to select |
|
Results |
long |
➖ |
The number of results to return per page (max 100) |
|
ShippoApiVersion |
string |
➖ |
Optional string used to pick a non-default API version to use. See our API version guide. |
2018-02-08 |
ParcelPaginatedList
| Error Type |
Status Code |
Content Type |
| Shippo.Models.Errors.SDKException |
4XX, 5XX |
*/* |
Creates a new parcel object.
using Shippo;
using Shippo.Models.Requests;
using Shippo.Models.Components;
var sdk = new ShippoSDK(
apiKeyHeader: "<YOUR_API_KEY_HERE>",
shippoApiVersion: "2018-02-08"
);
var res = await sdk.Parcels.CreateAsync(
requestBody: CreateParcelRequestBody.CreateParcelCreateRequest(
new ParcelCreateRequest() {
Extra = new ParcelExtra() {
Cod = new Cod() {
Amount = "5.5",
Currency = "USD",
PaymentMethod = Shippo.Models.Components.PaymentMethod.Cash,
},
Insurance = new ParcelInsurance() {
Amount = "5.5",
Content = "Laptop",
Currency = "USD",
Provider = Shippo.Models.Components.ParcelInsuranceProvider.Ups,
},
},
Metadata = "Customer ID 123456",
MassUnit = Shippo.Models.Components.WeightUnitEnum.Lb,
Weight = "1",
DistanceUnit = Shippo.Models.Components.DistanceUnitEnum.In,
Height = "1",
Length = "1",
Width = "1",
}
),
shippoApiVersion: "2018-02-08"
);
// handle response
| Parameter |
Type |
Required |
Description |
Example |
RequestBody |
CreateParcelRequestBody |
✔️ |
Parcel details. |
|
ShippoApiVersion |
string |
➖ |
Optional string used to pick a non-default API version to use. See our API version guide. |
2018-02-08 |
Parcel
| Error Type |
Status Code |
Content Type |
| Shippo.Models.Errors.SDKException |
4XX, 5XX |
*/* |
Returns parcel details using an existing parcel object ID (this will not return parcel details associated with un-purchased shipment/rate parcel object IDs).
using Shippo;
using Shippo.Models.Requests;
using Shippo.Models.Components;
var sdk = new ShippoSDK(
apiKeyHeader: "<YOUR_API_KEY_HERE>",
shippoApiVersion: "2018-02-08"
);
var res = await sdk.Parcels.GetAsync(
parcelId: "<id>",
shippoApiVersion: "2018-02-08"
);
// handle response
| Parameter |
Type |
Required |
Description |
Example |
ParcelId |
string |
✔️ |
Object ID of the parcel |
|
ShippoApiVersion |
string |
➖ |
Optional string used to pick a non-default API version to use. See our API version guide. |
2018-02-08 |
Parcel
| Error Type |
Status Code |
Content Type |
| Shippo.Models.Errors.SDKException |
4XX, 5XX |
*/* |