Update Shopping List
Updates an existing shopping list, including its products and their quantities.
HTTP Request
- URL:
/shoppingList/update/{id} - Method:
PUT - Headers:
accessToken: Required. Your API access token.Content-Type:application/json
- Required scope:
READ_WRITE_SHOPPINGLIST
Path Parameters
| Parameter | Type | Description |
|---|---|---|
id | String | Required. The ID of the shopping list to update. |
Request Body
The request body must be JSON and contain the following fields. Send either company or corporateCompany.
| Field | Type | Required | Description |
|---|---|---|---|
name | String | Yes | Name of the shopping list. |
products | Array | Yes | The full list of products. See below. |
company | String | Conditional | ID of the company. Required if corporateCompany is not sent. |
corporateCompany | String | Conditional | ID of the corporate company. Required if company is not sent. |
customer | String | No | ID of the customer who owns the list. |
isLocked | Boolean | No | Whether the list is locked against changes. |
status | String | No | pending, approved or rejected. |
Product Object
| Field | Type | Required | Description |
|---|---|---|---|
productId | String | Yes | ID of the product. |
variantId | String | No | ID of the product variant. |
quantity | Number | No | Quantity of the product. |
cURL Example
curl --location --request PUT '<BASE_URL>/shoppingList/update/6722d1a4b7c3e85f2a9d0b10' \
--header 'accessToken: <ACCESS_TOKEN>' \
--header 'Content-Type: application/json' \
--data '{
"name": "Monthly Site Supplies",
"company": "65ba028af764f931f1c7c18b",
"customer": "66d07121db294e0b70180bf6",
"isLocked": true,
"products": [
{
"productId": "65b88ef5045a7d009e79974b",
"quantity": 6
}
]
}'
Response
- 200 OK: The request was processed. Check
successto confirm the shopping list was updated. - 400 Bad Request: The access token is missing or invalid, does not have the required scope, or the request body is not valid.
Sample JSON Response
{
"success": true,
"message": "ShoppingList updated Successfully",
"data": {
"_id": "6722d1a4b7c3e85f2a9d0b10",
"id": "6722d1a4b7c3e85f2a9d0b10",
"name": "Monthly Site Supplies",
"company": "65ba028af764f931f1c7c18b",
"customer": "66d07121db294e0b70180bf6",
"corporateCompany": null,
"isLocked": true,
"status": "pending",
"products": [
{
"_id": "6723a8c5d1e4f92b3c6a7d20",
"productId": "65b88ef5045a7d009e79974b",
"quantity": 6
}
],
"metaFields": [],
"createdBy": {
"id": "6650c2e9f1a3b84d2e7a9c01",
"name": "ERP Integration",
"type": "api"
},
"order": 0,
"createdAt": "2024-10-31T08:20:52.417Z",
"updatedAt": "2024-11-01T10:04:17.902Z"
}
}
Response Details
| Field | Type | Description |
|---|---|---|
success | Boolean | Whether the shopping list was updated. |
message | String | Result message. |
data | Object | The updated shopping list. |
Shopping List Data
The shopping list fields are described in Get Single Shopping List.
Notes
productsreplaces the full product list, so include every product you want to keep.- If no shopping list matches the ID,
successisfalseandmessageisShoppingList not found.