(ServiceGroups)
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.
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.ServiceGroups.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 |
List
Error Type |
Status Code |
Content Type |
Shippo.Models.Errors.SDKException |
4XX, 5XX |
*/* |
Creates a new service group.
using Shippo;
using Shippo.Models.Requests;
using Shippo.Models.Components;
using System.Collections.Generic;
var sdk = new ShippoSDK(
apiKeyHeader: "<YOUR_API_KEY_HERE>",
shippoApiVersion: "2018-02-08"
);
var res = await sdk.ServiceGroups.CreateAsync(
serviceGroupCreateRequest: new ServiceGroupCreateRequest() {
Description = "USPS shipping options",
FlatRate = "5",
FlatRateCurrency = "USD",
FreeShippingThresholdCurrency = "USD",
FreeShippingThresholdMin = "5",
Name = "USPS Shipping",
RateAdjustment = 15,
Type = Shippo.Models.Components.ServiceGroupTypeEnum.FlatRate,
ServiceLevels = new List<ServiceGroupAccountAndServiceLevel>() {
new ServiceGroupAccountAndServiceLevel() {
AccountObjectId = "80feb1633d4a43c898f0058506cfd82d",
ServiceLevelToken = "ups_next_day_air_saver",
},
},
},
shippoApiVersion: "2018-02-08"
);
// handle response
Parameter |
Type |
Required |
Description |
Example |
ServiceGroupCreateRequest |
ServiceGroupCreateRequest |
✔️ |
N/A |
|
ShippoApiVersion |
string |
➖ |
Optional string used to pick a non-default API version to use. See our API version guide. |
2018-02-08 |
ServiceGroup
Error Type |
Status Code |
Content Type |
Shippo.Models.Errors.SDKException |
4XX, 5XX |
*/* |
Updates an existing service group object.
The object_id cannot be updated as it is the unique identifier for the object.
using Shippo;
using Shippo.Models.Requests;
using Shippo.Models.Components;
using System.Collections.Generic;
var sdk = new ShippoSDK(
apiKeyHeader: "<YOUR_API_KEY_HERE>",
shippoApiVersion: "2018-02-08"
);
var res = await sdk.ServiceGroups.UpdateAsync(
shippoApiVersion: "2018-02-08",
serviceGroupUpdateRequest: new ServiceGroupUpdateRequest() {
Description = "USPS shipping options",
FlatRate = "5",
FlatRateCurrency = "USD",
FreeShippingThresholdCurrency = "USD",
FreeShippingThresholdMin = "5",
Name = "USPS Shipping",
RateAdjustment = 15,
Type = Shippo.Models.Components.ServiceGroupTypeEnum.FlatRate,
ObjectId = "80feb1633d4a43c898f005850",
IsActive = true,
ServiceLevels = new List<ServiceGroupAccountAndServiceLevel>() {
new ServiceGroupAccountAndServiceLevel() {
AccountObjectId = "80feb1633d4a43c898f0058506cfd82d",
ServiceLevelToken = "ups_next_day_air_saver",
},
},
}
);
// 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 |
ServiceGroupUpdateRequest |
ServiceGroupUpdateRequest |
➖ |
N/A |
|
ServiceGroup
Error Type |
Status Code |
Content Type |
Shippo.Models.Errors.SDKException |
4XX, 5XX |
*/* |
Deletes an existing service group 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.ServiceGroups.DeleteAsync(
serviceGroupId: "<id>",
shippoApiVersion: "2018-02-08"
);
// handle response
Parameter |
Type |
Required |
Description |
Example |
ServiceGroupId |
string |
✔️ |
Object ID of the service group |
|
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 |
*/* |