Get All Warehouses
This API endpoint retrieves a list of warehouses from the server. The results can be paginated using query parameters.
HTTP Request
- URL:
/wareHouse/all - Method:
GET - Headers:
accessToken: Required. This is your access token for authenticating the request.
Query Parameters
To effectively navigate through the warehouses data, you can include the following query parameters:
| Parameter | Type | Description |
|---|---|---|
page | Integer | The page number to retrieve; defaults to 1 if not specified. |
limit | Integer | The number of items to retrieve per page; defaults to 10. |
cURL Example
Below is a sample cURL command that demonstrates how to make a request to the API endpoint:
curl --location '<BASE_URL>/wareHouse/all?page=1&limit=10' \
--header 'accessToken: <ACCESS_TOKEN>'
Response
- 200 OK: The request was successful, and the server returned a list of warehouses.
- 4XX: Client errors indicating issues such as an invalid access token or missing parameters.
- 5XX: Server errors indicating that something went wrong on the server's end.
Sample JSON Response
Below is an example of the JSON response you might receive from making a request to this endpoint:
{
"success": true,
"data": [
{
"_id": "663a0aff4587085935a4fb8e",
"name": "Main Warehouse",
"country": {
"code": "US",
"name": "United States"
},
"active": true,
"default": false,
"shippingZones": ["663a0afe4587085935a4fb84", "66a6df8bf4200635117ec817"],
"inventory": [
{
"productId": "6661781b047d8a81d984d938",
"stock": 100,
"minStock": 10,
"variants": [],
"_id": "66a66e3d7d6c18df2d9eb19b"
}
// Additional inventory omitted for brevity...
],
"metaFields": [],
"createdAt": "2024-05-07T11:05:35.114Z",
"updatedAt": "2024-08-30T09:01:16.534Z",
"__v": 0,
"address": {
"firstName": "Main",
"lastName": "Warehouse",
"address1": "188 W Museum Dr",
"address2": null,
"city": "Dickinson",
"state": {
"code": "NV",
"name": "Nevada"
},
"country": {
"code": "US",
"name": "United States"
},
"zipcode": "33155"
},
"id": "663a0aff4587085935a4fb8e"
},
{
"_id": "66c7847bc9dfe3bd5e222a37",
"name": "Ohio Warehouse",
"country": {
"code": "US",
"name": "United States"
},
"active": true,
"default": false,
"address": {
"firstName": "Marlee",
"lastName": "Mitchell",
"address1": "224 E Main St",
"address2": "",
"city": "Fairborn",
"state": {
"code": "OH",
"name": "Ohio"
},
"country": {
"code": "US",
"name": "United States"
},
"zipcode": "45324"
},
"shippingZones": [],
"inventory": [],
"metaFields": [],
"createdAt": "2024-08-22T18:33:31.682Z",
"updatedAt": "2024-08-31T18:50:05.325Z",
"__v": 0,
"id": "66c7847bc9dfe3bd5e222a37"
}
],
"pagination": {
"page": 1,
"total": 6,
"count": 2
}
}
Response Details
| Key | Type | Description |
|---|---|---|
success | Boolean | Indicates if the request was successful. |
data | Array of Objects | List of warehouses. |
pagination | Object | Provides pagination details. |
Warehouse Data
| Field | Type | Description |
|---|---|---|
_id | String | Unique identifier for the warehouse. |
name | String | Name of the warehouse. |
country | Object | Country information including code and name. |
active | Boolean | Indicates if the warehouse is active. |
default | Boolean | Indicates if this is the default warehouse. |
shippingZones | Array of Strings | List of shipping zone IDs associated with the warehouse. |
inventory | Array of Objects | List of inventory details for each product. |
metaFields | Array of Objects | Additional metadata fields related to the warehouse. |
createdAt | String | Date and time the warehouse was created (ISO 8601 format). |
updatedAt | String | Date and time the warehouse was last updated (ISO 8601 format). |
address | Object | Address information including city, state, and zipcode. |
id | String | Alias for unique identifier of the warehouse. |
Pagination Details
| Key | Type | Description |
|---|---|---|
page | Integer | Current page number. |
total | Integer | Total number of items available. |
count | Integer | Number of items returned in this response. |
Notes
- Ensure that the
accessTokenprovided is valid and has not expired. - The query parameters can help paginate the list of warehouses effectively.