Skip to main content

Create Shopping List

Creates a new shopping list for a company (optionally for a specific customer) or for a corporate company.

HTTP Request​

  • URL: /shoppingList/create
  • Method: POST
  • Headers:
    • accessToken: Required. Your API access token.
    • Content-Type: application/json
  • Required scope: READ_WRITE_SHOPPINGLIST

Request Body​

The request body must be JSON and contain the following fields. Send either company or corporateCompany.

FieldTypeRequiredDescription
nameStringYesName of the shopping list.
productsArrayYesProducts to add to the list. 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. Default is false.
statusStringNopending, approved or rejected. Default is pending.

Product Object​

FieldTypeRequiredDescription
productIdStringYesID of the product.
variantIdStringNoID of the product variant.
quantityNumberNoQuantity of the product.

cURL Example​

curl --location '<BASE_URL>/shoppingList/create' \
--header 'accessToken: <ACCESS_TOKEN>' \
--header 'Content-Type: application/json' \
--data '{
"name": "Monthly Site Supplies",
"company": "65ba028af764f931f1c7c18b",
"customer": "66d07121db294e0b70180bf6",
"products": [
{
"productId": "65b88ef5045a7d009e79974b",
"quantity": 4
},
{
"productId": "66b4a01249e6ce3d41c428fa",
"variantId": "66d5a286fcb786834cebb16a",
"quantity": 20
}
]
}'

Response​

  • 200 OK: The shopping list was created successfully.
  • 400 Bad Request: The access token is missing or invalid, does not have the required scope, or the request body is not valid (for example, the company was not found).

Sample JSON Response​

{
"success": true,
"message": "ShoppingList created Successfully",
"data": {
"_id": "6722d1a4b7c3e85f2a9d0b10",
"name": "Monthly Site Supplies",
"company": "65ba028af764f931f1c7c18b",
"customer": "66d07121db294e0b70180bf6",
"corporateCompany": null,
"isLocked": false,
"status": "pending",
"products": [
{
"_id": "6722d1a4b7c3e85f2a9d0b11",
"productId": "65b88ef5045a7d009e79974b",
"quantity": 4
},
{
"_id": "6722d1a4b7c3e85f2a9d0b12",
"productId": "66b4a01249e6ce3d41c428fa",
"variantId": "66d5a286fcb786834cebb16a",
"quantity": 20
}
],
"metaFields": [],
"createdBy": {
"id": "6650c2e9f1a3b84d2e7a9c01",
"name": "ERP Integration",
"type": "api"
},
"order": 0,
"createdAt": "2024-10-31T08:20:52.417Z",
"updatedAt": "2024-10-31T08:20:52.417Z"
}
}

Response Details​

FieldTypeDescription
successBooleanWhether the request was successful.
messageStringResult message.
dataObjectThe new shopping list. _id is the shopping list ID.

Shopping List Data​

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

Notes​

  • Products or variants that are not found in your catalog are skipped.