Get All Shopping Lists
This API endpoint retrieves a list of shopping lists from the server, allowing you to filter results by various criteria such as company, customer, corporate company, and pagination parameters.
HTTP Request
- URL:
/shoppingList/all - Method:
GET - Headers:
accessToken: Required. This is your access token for authenticating the request.
Query Parameters
To effectively retrieve and manage shopping lists, 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. |
company | String | The unique identifier of the company whose shopping lists you want to retrieve. |
customer | String | The unique identifier of the customer whose shopping lists you want to retrieve. |
corporateCompany | String | The unique identifier of the corporate company for filtering shopping lists. |
cURL Example
Below is a sample cURL command that demonstrates how to make a request to the API endpoint:
curl --location '<BASE_URL>/shoppingList/all?page=1&limit=10&company=<COMPANY_ID>&customer=<CUSTOMER_ID>&corporateCompany=<CORPORATE_COMPANY_ID>' \
--header 'accessToken: <ACCESS_TOKEN>'
Response
- 200 OK: The request was successful, and the server returned a list of shopping lists.
- 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": "7312abc1648b4f3a8dfd7e89",
"name": "Weekly Grocery List",
"company": "65ba028af764f931f1c7c18b",
"customer": "66d07121db294e0b70180bf6",
"corporateCompany": "71fc71e33e1c4b1576e1a659",
"isLocked": false,
"status": "pending",
"products": [
{
"productId": "65b88ef6045a7d009e79c829",
"quantity": 3
},
{
"productId": "65b88ef6045a7d009e79c829",
"variantId": "66d5a286fcb786834cebb168",
"quantity": 2
}
],
"createdAt": "2024-01-07T10:00:00Z",
"updatedAt": "2024-01-08T12:00:00Z"
}
// Additional shopping lists omitted for brevity...
],
"pagination": {
"page": 1,
"total": 100,
"count": 10
}
}
Response Details
| Key | Type | Description |
|---|---|---|
success | Boolean | Indicates if the request was successful. |
data | Array of Objects | List of shopping lists. |
pagination | Object | Provides pagination details. |
Shopping List Data
| Field | Type | Description |
|---|---|---|
id | String | The unique identifier of the shopping list. |
name | String | Name of the shopping list. |
company | String | The unique identifier of the associated company. |
customer | String | The unique identifier of the associated customer. |
corporateCompany | String | The unique identifier of the corporate company. |
isLocked | Boolean | Indicates if the list is locked from changes. |
status | String | Current status of the shopping list. |
products | Array of Objects | List of products in the shopping list. |
createdAt | String | Date and time the list was created (ISO 8601 format). |
updatedAt | String | Date and time the list was last updated (ISO 8601 format). |
Products Data
| Field | Type | Description |
|---|---|---|
productId | String | Unique identifier for the product. |
variantId | String | Unique identifier for the product variant. |
quantity | Number | Quantity of the product or variant in the list. |
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 filter and paginate the list of shopping lists effectively.