(user_parcel_templates)
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.
import shippo
s = shippo.Shippo(
api_key_header='<YOUR_API_KEY_HERE>',
shippo_api_version='2018-02-08',
)
res = s.user_parcel_templates.list()
if res is not None:
# handle response
pass
components.UserParcelTemplateList
Error Type | Status Code | Content Type |
---|---|---|
errors.SDKError | 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."
import shippo
from shippo.models import components
s = shippo.Shippo(
api_key_header='<YOUR_API_KEY_HERE>',
shippo_api_version='2018-02-08',
)
res = s.user_parcel_templates.create(request=components.UserParcelTemplateWithCarrierTemplateCreateRequest(
weight='12',
weight_unit=components.WeightUnitEnum.LB,
))
if res is not None:
# handle response
pass
Parameter | Type | Required | Description |
---|---|---|---|
request |
components.UserParcelTemplateCreateRequest | ✔️ | The request object to use for the request. |
Error Type | Status Code | Content Type |
---|---|---|
errors.SDKError | 4XX, 5XX | */* |
Deletes a user parcel template using an object ID.
import shippo
s = shippo.Shippo(
api_key_header='<YOUR_API_KEY_HERE>',
shippo_api_version='2018-02-08',
)
s.user_parcel_templates.delete(user_parcel_template_object_id='<value>')
# Use the SDK ...
Parameter | Type | Required | Description |
---|---|---|---|
user_parcel_template_object_id |
str | ✔️ | Object ID of the user parcel template |
Error Type | Status Code | Content Type |
---|---|---|
errors.SDKError | 4XX, 5XX | */* |
Returns the parcel template information for a specific user parcel template, identified by the object ID.
import shippo
s = shippo.Shippo(
api_key_header='<YOUR_API_KEY_HERE>',
shippo_api_version='2018-02-08',
)
res = s.user_parcel_templates.get(user_parcel_template_object_id='<value>')
if res is not None:
# handle response
pass
Parameter | Type | Required | Description |
---|---|---|---|
user_parcel_template_object_id |
str | ✔️ | Object ID of the user parcel template |
Error Type | Status Code | Content Type |
---|---|---|
errors.SDKError | 4XX, 5XX | */* |
Updates an existing user parcel template.
import shippo
from shippo.models import components
s = shippo.Shippo(
api_key_header='<YOUR_API_KEY_HERE>',
shippo_api_version='2018-02-08',
)
res = s.user_parcel_templates.update(user_parcel_template_object_id='<value>', user_parcel_template_update_request=components.UserParcelTemplateUpdateRequest(
distance_unit=components.DistanceUnitEnum.IN,
height='6',
length='10',
name='My Custom Template',
width='8',
weight='12',
weight_unit=components.WeightUnitEnum.LB,
))
if res is not None:
# handle response
pass
Parameter | Type | Required | Description |
---|---|---|---|
user_parcel_template_object_id |
str | ✔️ | Object ID of the user parcel template |
user_parcel_template_update_request |
Optional[components.UserParcelTemplateUpdateRequest] | ➖ | N/A |
Error Type | Status Code | Content Type |
---|---|---|
errors.SDKError | 4XX, 5XX | */* |