(service_groups)
A service group is a set of service levels grouped together.
Rates at checkout uses services groups to present available shipping options to customers in their shopping basket.
- list - List all service groups
- create - Create a new service group
- update - Update an existing service group
- delete - Delete a service group
Returns a list of service group objects.
import shippo
s = shippo.Shippo(
api_key_header='<YOUR_API_KEY_HERE>',
shippo_api_version='2018-02-08',
)
res = s.service_groups.list()
if res is not None:
# handle response
pass
List[components.ServiceGroup]
Error Type |
Status Code |
Content Type |
errors.SDKError |
4XX, 5XX |
*/* |
Creates a new service group.
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.service_groups.create(request=components.ServiceGroupCreateRequest(
description='USPS shipping options',
name='USPS Shipping',
type=components.ServiceGroupTypeEnum.FLAT_RATE,
service_levels=[
components.ServiceGroupAccountAndServiceLevel(
account_object_id='80feb1633d4a43c898f0058506cfd82d',
service_level_token='ups_next_day_air_saver',
),
],
flat_rate='5',
flat_rate_currency='USD',
free_shipping_threshold_currency='USD',
free_shipping_threshold_min='5',
rate_adjustment=15,
))
if res is not None:
# handle response
pass
components.ServiceGroup
Error Type |
Status Code |
Content Type |
errors.SDKError |
4XX, 5XX |
*/* |
Updates an existing service group object.
The object_id cannot be updated as it is the unique identifier for the object.
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.service_groups.update(request=components.ServiceGroupUpdateRequest(
description='USPS shipping options',
name='USPS Shipping',
type=components.ServiceGroupTypeEnum.FLAT_RATE,
object_id='80feb1633d4a43c898f005850',
is_active=True,
service_levels=[
components.ServiceGroupAccountAndServiceLevel(
account_object_id='80feb1633d4a43c898f0058506cfd82d',
service_level_token='ups_next_day_air_saver',
),
components.ServiceGroupAccountAndServiceLevel(
account_object_id='80feb1633d4a43c898f0058506cfd82d',
service_level_token='ups_next_day_air_saver',
),
components.ServiceGroupAccountAndServiceLevel(
account_object_id='80feb1633d4a43c898f0058506cfd82d',
service_level_token='ups_next_day_air_saver',
),
],
flat_rate='5',
flat_rate_currency='USD',
free_shipping_threshold_currency='USD',
free_shipping_threshold_min='5',
rate_adjustment=15,
))
if res is not None:
# handle response
pass
components.ServiceGroup
Error Type |
Status Code |
Content Type |
errors.SDKError |
4XX, 5XX |
*/* |
Deletes an existing service group using an object ID.
import shippo
s = shippo.Shippo(
api_key_header='<YOUR_API_KEY_HERE>',
shippo_api_version='2018-02-08',
)
s.service_groups.delete(service_group_id='<value>')
# Use the SDK ...
Parameter |
Type |
Required |
Description |
service_group_id |
str |
✔️ |
Object ID of the service group |
Error Type |
Status Code |
Content Type |
errors.SDKError |
4XX, 5XX |
*/* |