import Switchyard from "@switchyard/js-sdk"
export const sdk = new Medusa({
baseUrl: import.meta.env.VITE_BACKEND_URL || "/",
debug: import.meta.env.DEV,
auth: {
type: "session",
},
})
sdk.admin.fulfillmentSet.updateServiceZone(
"fset_123",
"serzo_123",
{
name: "Europe Service Zone",
}
)
.then(({ fulfillment_set }) => {
console.log(fulfillment_set)
}){
"fulfillment_set": {
"id": "<string>",
"name": "<string>",
"type": "<string>",
"location": {
"id": "<string>",
"name": "<string>",
"address_id": "<string>",
"address": {
"id": "<string>",
"address_1": "<string>",
"address_2": "<string>",
"company": "<string>",
"country_code": "us",
"city": "<string>",
"phone": "<string>",
"postal_code": "<string>",
"province": "us-ca"
},
"sales_channels": [
{
"id": "<string>",
"name": "<string>",
"description": "<string>",
"is_disabled": true,
"metadata": {},
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"deleted_at": "2023-11-07T05:31:56Z"
}
],
"fulfillment_providers": [
{
"id": "<string>",
"is_enabled": true
}
],
"fulfillment_sets": [
{}
]
},
"service_zones": [
{
"id": "<string>",
"name": "<string>",
"fulfillment_set_id": "<string>",
"fulfillment_set": {},
"geo_zones": [
{
"id": "<string>",
"type": "country",
"country_code": "<string>",
"province_code": "us-ca",
"city": "<string>",
"postal_expression": {},
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"deleted_at": "2023-11-07T05:31:56Z"
}
],
"shipping_options": [
{
"id": "<string>",
"name": "<string>",
"price_type": "calculated",
"service_zone_id": "<string>",
"service_zone": {},
"provider_id": "<string>",
"provider": {
"id": "<string>",
"is_enabled": true
},
"shipping_option_type_id": "<string>",
"type": {
"id": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"deleted_at": "2023-11-07T05:31:56Z",
"label": "<string>",
"description": "<string>",
"code": "<string>",
"shipping_option_id": "<string>"
},
"shipping_profile_id": "<string>",
"shipping_profile": {
"id": "<string>",
"name": "<string>",
"type": "<string>",
"metadata": {},
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"deleted_at": "2023-11-07T05:31:56Z"
},
"rules": [
{
"id": "<string>",
"attribute": "is_return",
"operator": "gt",
"value": "true",
"shipping_option_id": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"deleted_at": "2023-11-07T05:31:56Z"
}
],
"prices": [
{
"price_rules": [
{
"id": "<string>",
"value": "<string>",
"operator": "gt",
"attribute": "<string>",
"price_id": "<string>",
"priority": 123,
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"deleted_at": "2023-11-07T05:31:56Z"
}
],
"rules_count": 123,
"id": "<string>",
"title": "<string>",
"currency_code": "usd",
"amount": 123,
"raw_amount": {},
"min_quantity": 123,
"max_quantity": 123,
"price_set_id": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"deleted_at": "2023-11-07T05:31:56Z"
}
],
"data": {},
"metadata": {},
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"deleted_at": "2023-11-07T05:31:56Z"
}
],
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"deleted_at": "2023-11-07T05:31:56Z"
}
],
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"deleted_at": "2023-11-07T05:31:56Z"
}
}Update the details of a service zone in a fulfillment set.
import Switchyard from "@switchyard/js-sdk"
export const sdk = new Medusa({
baseUrl: import.meta.env.VITE_BACKEND_URL || "/",
debug: import.meta.env.DEV,
auth: {
type: "session",
},
})
sdk.admin.fulfillmentSet.updateServiceZone(
"fset_123",
"serzo_123",
{
name: "Europe Service Zone",
}
)
.then(({ fulfillment_set }) => {
console.log(fulfillment_set)
}){
"fulfillment_set": {
"id": "<string>",
"name": "<string>",
"type": "<string>",
"location": {
"id": "<string>",
"name": "<string>",
"address_id": "<string>",
"address": {
"id": "<string>",
"address_1": "<string>",
"address_2": "<string>",
"company": "<string>",
"country_code": "us",
"city": "<string>",
"phone": "<string>",
"postal_code": "<string>",
"province": "us-ca"
},
"sales_channels": [
{
"id": "<string>",
"name": "<string>",
"description": "<string>",
"is_disabled": true,
"metadata": {},
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"deleted_at": "2023-11-07T05:31:56Z"
}
],
"fulfillment_providers": [
{
"id": "<string>",
"is_enabled": true
}
],
"fulfillment_sets": [
{}
]
},
"service_zones": [
{
"id": "<string>",
"name": "<string>",
"fulfillment_set_id": "<string>",
"fulfillment_set": {},
"geo_zones": [
{
"id": "<string>",
"type": "country",
"country_code": "<string>",
"province_code": "us-ca",
"city": "<string>",
"postal_expression": {},
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"deleted_at": "2023-11-07T05:31:56Z"
}
],
"shipping_options": [
{
"id": "<string>",
"name": "<string>",
"price_type": "calculated",
"service_zone_id": "<string>",
"service_zone": {},
"provider_id": "<string>",
"provider": {
"id": "<string>",
"is_enabled": true
},
"shipping_option_type_id": "<string>",
"type": {
"id": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"deleted_at": "2023-11-07T05:31:56Z",
"label": "<string>",
"description": "<string>",
"code": "<string>",
"shipping_option_id": "<string>"
},
"shipping_profile_id": "<string>",
"shipping_profile": {
"id": "<string>",
"name": "<string>",
"type": "<string>",
"metadata": {},
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"deleted_at": "2023-11-07T05:31:56Z"
},
"rules": [
{
"id": "<string>",
"attribute": "is_return",
"operator": "gt",
"value": "true",
"shipping_option_id": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"deleted_at": "2023-11-07T05:31:56Z"
}
],
"prices": [
{
"price_rules": [
{
"id": "<string>",
"value": "<string>",
"operator": "gt",
"attribute": "<string>",
"price_id": "<string>",
"priority": 123,
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"deleted_at": "2023-11-07T05:31:56Z"
}
],
"rules_count": 123,
"id": "<string>",
"title": "<string>",
"currency_code": "usd",
"amount": 123,
"raw_amount": {},
"min_quantity": 123,
"max_quantity": 123,
"price_set_id": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"deleted_at": "2023-11-07T05:31:56Z"
}
],
"data": {},
"metadata": {},
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"deleted_at": "2023-11-07T05:31:56Z"
}
],
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"deleted_at": "2023-11-07T05:31:56Z"
}
],
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"deleted_at": "2023-11-07T05:31:56Z"
}
}Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
The fulfillment set's ID.
The service zone's ID.
Comma-separated fields that should be included in the returned data. if a field is prefixed with + it will be added to the default fields, using - will remove it from the default fields. without prefix it will replace the entire default fields.
The service zone's details.
The service zone's name.
The service zone's associated geo zones.
A country geo zone.
OK
The fulfillment set's details.
The service zone's fulfillment set.
Show child attributes
The fulfillment set's ID.
The fulfillment set's name.
The fulfillment set's type.
The stock location's details.
Show child attributes
The location's ID.
The location's name.
The ID of the associated address.
The details of the stock location address.
Show child attributes
The address's ID.
The address's first line.
The address's second line.
The address's company.
The address's country code.
"us"
The address's city.
The address's phone.
The address's postal code.
The address's lower-case ISO 3166-2 province code.
"us-ca"
The sales channels associated with the location.
Show child attributes
The sales channel's ID.
The sales channel's name.
The sales channel's description.
Whether the sales channel is disabled.
The sales channel's metadata, can hold custom key-value pairs.
The date the sales channel was created.
The date the sales channel was updated.
The date the sales channel was deleted.
The fulfillment sets associated with the location.
The fulfillment set's service zones.
Show child attributes
The service zone's ID.
The service zone's name.
The service zone's fulfillment set id.
The service zone's geo zones.
Show child attributes
The geo zone's ID.
The geo zone's type.
country, province, city, zip The geo zone's country code.
The geo zone's lower-case ISO 3166-2 province code.
"us-ca"
The geo zone's city.
The geo zone's postal expression.
The geo zone's created at.
The geo zone's updated at.
The geo zone's deleted at.
The service zone's shipping options.
Show child attributes
The shipping option's ID.
The shipping option's name.
The shipping option's price type. If it's flat, the price is fixed and is set in the prices property. If it's calculated, the price is calculated on checkout by the associated fulfillment provider.
calculated, flat The ID of the service zone this option belongs to.
The ID of the provider handling fulfillments created from this shipping option.
The ID of the associated shipping option type.
The shipping option's details.
Show child attributes
The shipping option's ID.
The date the shipping option was created.
The date the shipping option was updated.
The date the shipping option was deleted.
The type's label.
The type's description.
The type's code.
The type's shipping option id.
The ID of the associated shipping profile.
The shipping profile's details..
Show child attributes
The shipping profile's ID.
The shipping profile's name.
The shipping profile's type.
The shipping profile's metadata, holds custom key-value pairs.
The date the shipping profile was created.
The date the shipping profile was updated.
The date the shipping profile was deleted.
The shipping option's rules.
Show child attributes
The shipping option rule's ID.
The shipping option rule's attribute.
"is_return"
The rule's operator.
gt, lt, eq, ne, in, lte, gte, nin The shipping option rule's value.
"true"
The ID of the shipping option this rule is for.
The date the shipping option rule was created.
The date the shipping option rule was updated.
The date the shipping option rule was deleted.
The shipping option's prices. If the price_type is calculated, this array will be empty since the price is calculated by the fulfillment provider during checkout.
Show child attributes
The price's rules.
Show child attributes
The price rule's ID.
The price rule's value.
The price rule's operator.
gt, lt, eq, ne, in, lte, gte, nin The price rule's attribute.
The ID of the price this rule applies to.
The price rule's priority.
The date the price rule was created.
The date the price rule was updated.
The date the price rule was deleted.
The number of rules the price has.
The price's ID.
The price's title.
The price's currency code.
"usd"
The price's amount.
The price's raw amount.
The minimum quantity required in the cart for this price to apply.
The maximum quantity that the cart's items must not surpass for this price to apply.
The ID of the price set this price belongs to.
The date the price was created.
The date the price was updated.
The date the price was deleted.
The shipping option's data, useful for the fulfillment provider handling fulfillments created from this option.
The shipping option's metadata, can hold custom key-value pairs.
The date the shipping option was created.
The date the shipping option was updated.
The date the shipping option was deleted.
The service zone's created at.
The service zone's updated at.
The service zone's deleted at.
The fulfillment set's created at.
The fulfillment set's updated at.
The fulfillment set's deleted at.