(UserParcelTemplates)
A user parcel template represents a package used for shipping that has preset dimensions and attributes defined
by you. They are useful for capturing attributes of parcel-types you frequently use for shipping, allowing
them to be defined once and then used for many shipments. These parcel templates can also be used for live rates.
User parcel templates can also be created using a carrier parcel template, where the dimensions will be copied from
the carrier presets, but the weight can be configured by you.
- List - List all user parcel templates
- Create - Create a new user parcel template
- Delete - Delete a user parcel template
- Get - Retrieves a user parcel template
- Update - Update an existing user parcel template
Returns a list all of all user parcel template 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.UserParcelTemplates.ListAsync(shippoApiVersion: "2018-02-08");
// handle response
Parameter |
Type |
Required |
Description |
Example |
ShippoApiVersion |
string |
➖ |
Optional string used to pick a non-default API version to use. See our API version guide. |
2018-02-08 |
UserParcelTemplateList
Error Type |
Status Code |
Content Type |
Shippo.Models.Errors.SDKException |
4XX, 5XX |
*/* |
Creates a new user parcel template.
You can choose to create a
parcel template using a preset carrier template as a starting point, or
you can create an entirely custom one. To use a preset carrier template,
pass in a unique template token from this list
plus the weight fields (weight and weight_unit). Otherwise, omit
the template field and pass the other fields, for the weight, length, height,
and depth, as well as their units."
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.UserParcelTemplates.CreateAsync(
userParcelTemplateCreateRequest: UserParcelTemplateCreateRequest.CreateUserParcelTemplateWithCarrierTemplateCreateRequest(
new UserParcelTemplateWithCarrierTemplateCreateRequest() {
Weight = "12",
WeightUnit = Shippo.Models.Components.WeightUnitEnum.Lb,
}
),
shippoApiVersion: "2018-02-08"
);
// handle response
Parameter |
Type |
Required |
Description |
Example |
UserParcelTemplateCreateRequest |
UserParcelTemplateCreateRequest |
✔️ |
N/A |
|
ShippoApiVersion |
string |
➖ |
Optional string used to pick a non-default API version to use. See our API version guide. |
2018-02-08 |
UserParcelTemplate
Error Type |
Status Code |
Content Type |
Shippo.Models.Errors.SDKException |
4XX, 5XX |
*/* |
Deletes a user parcel template using an object ID.
using Shippo;
using Shippo.Models.Requests;
using Shippo.Models.Components;
var sdk = new ShippoSDK(
apiKeyHeader: "<YOUR_API_KEY_HERE>",
shippoApiVersion: "2018-02-08"
);
await sdk.UserParcelTemplates.DeleteAsync(
userParcelTemplateObjectId: "<id>",
shippoApiVersion: "2018-02-08"
);
// handle response
Parameter |
Type |
Required |
Description |
Example |
UserParcelTemplateObjectId |
string |
✔️ |
Object ID of the user parcel template |
|
ShippoApiVersion |
string |
➖ |
Optional string used to pick a non-default API version to use. See our API version guide. |
2018-02-08 |
Error Type |
Status Code |
Content Type |
Shippo.Models.Errors.SDKException |
4XX, 5XX |
*/* |
Returns the parcel template information for a specific user parcel
template, identified by the object ID.
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.UserParcelTemplates.GetAsync(
userParcelTemplateObjectId: "<id>",
shippoApiVersion: "2018-02-08"
);
// handle response
Parameter |
Type |
Required |
Description |
Example |
UserParcelTemplateObjectId |
string |
✔️ |
Object ID of the user parcel template |
|
ShippoApiVersion |
string |
➖ |
Optional string used to pick a non-default API version to use. See our API version guide. |
2018-02-08 |
UserParcelTemplate
Error Type |
Status Code |
Content Type |
Shippo.Models.Errors.SDKException |
4XX, 5XX |
*/* |
Updates an existing user parcel template.
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.UserParcelTemplates.UpdateAsync(
userParcelTemplateObjectId: "<id>",
shippoApiVersion: "2018-02-08",
userParcelTemplateUpdateRequest: new UserParcelTemplateUpdateRequest() {
DistanceUnit = Shippo.Models.Components.DistanceUnitEnum.In,
Height = "6",
Length = "10",
Name = "My Custom Template",
Weight = "12",
WeightUnit = Shippo.Models.Components.WeightUnitEnum.Lb,
Width = "8",
}
);
// handle response
Parameter |
Type |
Required |
Description |
Example |
UserParcelTemplateObjectId |
string |
✔️ |
Object ID of the user parcel template |
|
ShippoApiVersion |
string |
➖ |
Optional string used to pick a non-default API version to use. See our API version guide. |
2018-02-08 |
UserParcelTemplateUpdateRequest |
UserParcelTemplateUpdateRequest |
➖ |
N/A |
|
UserParcelTemplate
Error Type |
Status Code |
Content Type |
Shippo.Models.Errors.SDKException |
4XX, 5XX |
*/* |