Skip to main content

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​

ParameterTypeDescription
idStringRequired. 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.

FieldTypeRequiredDescription
nameStringYesName of the shopping list.
productsArrayYesThe full list of products. See below.
companyStringConditionalID of the company. Required if corporateCompany is not sent.
corporateCompanyStringConditionalID of the corporate company. Required if company is not sent.
customerStringNoID of the customer who owns the list.
isLockedBooleanNoWhether the list is locked against changes.
statusStringNopending, approved or rejected.

Product Object​

FieldTypeRequiredDescription
productIdStringYesID of the product.
variantIdStringNoID of the product variant.
quantityNumberNoQuantity 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 success to 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​

FieldTypeDescription
successBooleanWhether the shopping list was updated.
messageStringResult message.
dataObjectThe updated shopping list.

Shopping List Data​

The shopping list fields are described in Get Single Shopping List.

Notes​

  • products replaces the full product list, so include every product you want to keep.
  • If no shopping list matches the ID, success is false and message is ShoppingList not found.