Get All Shipping Zones
Endpoint
- URL:
/shippingZone/all - Method:
GET - Headers:
accessToken: Required. This is your access token for authenticating the request.
Description
This API endpoint retrieves all shipping zones available in the system, including details about their status, associated countries, and shipping methods.
Sample Request
curl --location '<BASE-URL>/shippingZone/all' \
--header 'accessToken: <ACCESS-TOKEN>'
Successful Response
The API returns a JSON object containing the success status, data about shipping zones, and pagination details.
Response Fields
| Key | Type | Description |
|---|---|---|
success | Boolean | Indicates if the request was successful. |
data | Array of Objects | A list of shipping zones. |
pagination | Array of Objects | Contains details about the paginated response. |
Shipping Zone Object
Each object in the data array represents a shipping zone with the following fields:
| Field | Type | Description |
|---|---|---|
id | string | Unique identifier of the shipping zone. |
name | string | Name of the shipping zone. |
active | boolean | Indicates if the shipping zone is active. |
type | string | Type of the zone (e.g., country). |
country | object | Contains name and countryCode of the country. |
states | array | List of associated states. |
zipcodes | array | List of associated zip codes. |
shippingMethods | array | Details of shipping methods available within the zone. |
createdAt | string | Date and time when the zone was created. |
updatedAt | string | Date and time when the zone was last updated. |
Shipping Method Object
Each object in the shippingMethods array contains:
| Field | Type | Description |
|---|---|---|
shippingMethod | string | Unique identifier of the shipping method. |
name | string | Name of the shipping method. |
label | string | Display label for the shipping method. |
active | boolean | Indicates if the shipping method is active. |
connected | boolean | Indicates if the shipping method is connected. |
setup | object | Configuration details, varies by method type. |
_id | string | Unique identifier for the setup of shipping method. |
Pagination
- pagination:
object- Contains details about the paginated response.
| Field | Type | Description |
|---|---|---|
page | number | Current page number. |
total | number | Total number of shipping zones returned. |
count | number | Number of shipping zones on the current page. |
Example Response
{
"success": true,
"data": [
{
"_id": "66d2eafaf57178681728366a",
"name": "India",
"active": true,
"type": "country",
"country": {
"name": "India",
"countryCode": "IN"
},
"states": [],
"zipcodes": [],
"shippingMethods": [
{
"shippingMethod": "663a0afe4587085935a4fa0f",
"name": "ups",
"label": "UPS",
"active": true,
"connected": false,
"setup": {
"clientId": "233323",
"clientSecret": "kfjfjjf",
"accountNumber": "3"
},
"_id": "66d42cc091bfe4160114d152"
}
// Additional shipping methods
],
"createdAt": "2024-08-31T10:05:46.132Z",
"updatedAt": "2024-09-01T08:58:40.202Z",
"id": "66d2eafaf57178681728366a"
}
// Additional shipping zones
],
"pagination": {
"page": 1,
"total": 2,
"count": 2
}
}
Notes
- Ensure proper handling of the access token as it authorizes the request to access the API.
- The response might include multiple shipping zones and shipping methods based on the data available in the system.