Associate Shopping Lists
This feature is part of Composable Commerce for B2B and will be subject to additional terms and pricing.
Associate Shopping Lists allow Associates to interact with Shopping Lists on behalf of a Business Unit.
Associates can view, create, update, and delete Shopping Lists on behalf of a Business Unit. The actions a given Associate is allowed to perform depends on the specific roles and permissions they hold within the Business Unit.
Get ShoppingList in BusinessUnit
The Associate must have the ViewMyShoppingLists or ViewOthersShoppingLists Permission. If the required Permission is missing, an AssociateMissingPermission error is returned.
Get ShoppingList in BusinessUnit by ID
If the ShoppingList exists in the Project but does not reference the requested BusinessUnit, this method returns an InvalidOperation error.
view_shopping_lists:{projectKey}regionString | Region in which the Project is hosted. |
projectKeyString |
|
associateIdString |
|
businessUnitKeyString |
|
idString |
|
expand | When expanding The parameter can be passed multiple times. |
application/jsoncurl --get https://api.{region}.commercetools.com/{projectKey}/as-associate/{associateId}/in-business-unit/key={businessUnitKey}/shopping-lists/{id} -i \--header "Authorization: Bearer ${BEARER_TOKEN}"
{"id": "acb58513-ccfd-4ee8-8f28-9b7238fb91cd","version": 1,"name": {"en": "My shopping list"},"key": "my-shopping-list","customer": {"typeId": "customer","id": "e73cd97f-846e-44a0-b418-3ed044a8e398"},"slug": {"en": "my-shopping-list"},"lineItems": [{"id": "ade85d60-736b-4ca8-87ed-01fde78f92c5","productId": "077bb11b-0d00-4e00-aced-48f493a79da0","name": {"en": "Product name"},"productType": {"typeId": "product-type","id": "a941b0b1-5c8f-41de-99e4-de965714d89f"},"variantId": 2,"quantity": 1,"addedAt": "2022-08-22T14:11:03.572Z"}],"textLineItems": [{"id": "c25aaca9-bb25-4a9f-bb1f-be0a78e98dcb","name": {"en": "My shopping list item"},"description": {"en": "This is a good gift idea"},"quantity": 5,"addedAt": "2022-08-22T14:11:03.572Z"}],"businessUnit": {"key": "bu-345-france","typeId": "business-unit"},"deleteDaysAfterLastModification": 100,"createdAt": "2022-08-22T14:11:03.587Z","lastModifiedAt": "2022-08-22T14:11:03.587Z"}
Get ShoppingList in a BusinessUnit by Key
If the ShoppingList exists in the Project but does not reference the requested BusinessUnit, this method returns an InvalidOperation error.
view_shopping_lists:{projectKey}regionString | Region in which the Project is hosted. |
projectKeyString |
|
associateIdString |
|
businessUnitKeyString |
|
keyString |
|
expand | When expanding The parameter can be passed multiple times. |
application/jsoncurl --get https://api.{region}.commercetools.com/{projectKey}/as-associate/{associateId}/in-business-unit/key={businessUnitKey}/shopping-lists/key={key} -i \--header "Authorization: Bearer ${BEARER_TOKEN}"
{"id": "acb58513-ccfd-4ee8-8f28-9b7238fb91cd","version": 1,"name": {"en": "My shopping list"},"key": "my-shopping-list","customer": {"typeId": "customer","id": "e73cd97f-846e-44a0-b418-3ed044a8e398"},"slug": {"en": "my-shopping-list"},"lineItems": [{"id": "ade85d60-736b-4ca8-87ed-01fde78f92c5","productId": "077bb11b-0d00-4e00-aced-48f493a79da0","name": {"en": "Product name"},"productType": {"typeId": "product-type","id": "a941b0b1-5c8f-41de-99e4-de965714d89f"},"variantId": 2,"quantity": 1,"addedAt": "2022-08-22T14:11:03.572Z"}],"textLineItems": [{"id": "c25aaca9-bb25-4a9f-bb1f-be0a78e98dcb","name": {"en": "My shopping list item"},"description": {"en": "This is a good gift idea"},"quantity": 5,"addedAt": "2022-08-22T14:11:03.572Z"}],"businessUnit": {"key": "bu-345-france","typeId": "business-unit"},"deleteDaysAfterLastModification": 100,"createdAt": "2022-08-22T14:11:03.587Z","lastModifiedAt": "2022-08-22T14:11:03.587Z"}
Query ShoppingLists in BusinessUnit
view_shopping_lists:{projectKey}regionString | Region in which the Project is hosted. |
projectKeyString |
|
associateIdString |
|
businessUnitKeyString |
|
where | The parameter can be passed multiple times. |
sort | The parameter can be passed multiple times. |
expand | When expanding The parameter can be passed multiple times. |
limitInt | Number of results requested. Default: 20 |
offsetInt | Number of elements skipped. Default: 0 |
withTotalBoolean | Controls the calculation of the total number of query results. Set to Default: true |
var.<varName>String | Predicate parameter values. The parameter can be passed multiple times. |
application/jsoncurl --get https://api.{region}.commercetools.com/{projectKey}/as-associate/{associateId}/in-business-unit/key={businessUnitKey}/shopping-lists -i \--header "Authorization: Bearer ${BEARER_TOKEN}"
{"limit": 20,"offset": 0,"count": 1,"total": 1,"results": [{"id": "9693f04b-5aec-467f-baa1-fc74da7d0c3d","version": 1,"name": {"en": "test"},"key": "test","lineItems": [],"textLineItems": [],"businessUnit": {"key": "bu-345-france","typeId": "business-unit"},"createdAt": "2017-03-30T11:49:40.904Z","lastModifiedAt": "2017-03-30T11:49:40.904Z"}]}
Check if ShoppingList exists in BusinessUnit
Whether a Shopping List is visible to the Associate depends on their role and the associated Permissions.
Check if ShoppingList exists in BusinessUnit by ID
Checks if a ShoppingList exists for a given id. Returns a 200 OK if the ShoppingList exists; otherwise, returns a ResourceNotFound error.
view_shopping_lists:{projectKey}regionString | Region in which the Project is hosted. |
projectKeyString |
|
associateIdString |
|
businessUnitKeyString |
|
idString |
|
curl --head https://api.{region}.commercetools.com/{projectKey}/as-associate/{associateId}/in-business-unit/key={businessUnitKey}/shopping-lists/{id} -i \--header "Authorization: Bearer ${BEARER_TOKEN}"
Check if ShoppingList exists in BusinessUnit by Key
Checks if a ShoppingList exists for a given key. Returns a 200 OK if the ShoppingList exists; otherwise, returns a ResourceNotFound error.
view_shopping_lists:{projectKey}regionString | Region in which the Project is hosted. |
projectKeyString |
|
associateIdString |
|
businessUnitKeyString |
|
keyString |
|
curl --head https://api.{region}.commercetools.com/{projectKey}/as-associate/{associateId}/in-business-unit/key={businessUnitKey}/shopping-lists/key={key} -i \--header "Authorization: Bearer ${BEARER_TOKEN}"
Check if ShoppingList exists in BusinessUnit by Query Predicate
Checks if a ShoppingList exists for a given Query Predicate. Returns a 200 OK if any ShoppingLists match the Query Predicate; otherwise, returns a ResourceNotFound error.
view_shopping_lists:{projectKey}regionString | Region in which the Project is hosted. |
projectKeyString |
|
associateIdString |
|
businessUnitKeyString |
|
where | The parameter can be passed multiple times. |
curl --head https://api.{region}.commercetools.com/{projectKey}/as-associate/{associateId}/in-business-unit/key={businessUnitKey}/shopping-lists -i \--header "Authorization: Bearer ${BEARER_TOKEN}"
Create ShoppingList in BusinessUnit
The Associate must have the CreateMyShoppingLists or CreateOthersShoppingLists Permission. If the required Permission is missing, an AssociateMissingPermission error is returned.
Creates a ShoppingList in the BusinessUnit referenced by businessUnitKey. As such, the businessUnit field on ShoppingListDraft is ignored for this request.
manage_shopping_lists:{projectKey}regionString | Region in which the Project is hosted. |
projectKeyString |
|
associateIdString |
|
businessUnitKeyString |
|
expand | When expanding The parameter can be passed multiple times. |
application/jsonapplication/jsoncurl https://api.{region}.commercetools.com/{projectKey}/as-associate/{associateId}/in-business-unit/key={businessUnitKey}/shopping-lists -i \--header "Authorization: Bearer ${BEARER_TOKEN}" \--header 'Content-Type: application/json' \--data-binary @- << DATA{"name" : {"en" : "My shopping list"},"slug" : {"en" : "my-shopping-list"},"customer" : {"typeId" : "customer","id" : "e73cd97f-846e-44a0-b418-3ed044a8e398"},"key" : "my-shopping-list","deleteDaysAfterLastModification" : 100,"lineItems" : [ {"sku" : "product-variant-sku","quantity" : 5}, {"productId" : "0e131f46-8d1a-4761-9c83-b45ab5d3501e","variantId" : 2} ],"textLineItems" : [ {"name" : {"en" : "My shopping list item"},"description" : {"en" : "This is a good gift idea"},"quantity" : 5} ],"businessUnit" : {"key" : "bu-345-france","typeId" : "business-unit"}}DATA
{"id": "acb58513-ccfd-4ee8-8f28-9b7238fb91cd","version": 1,"name": {"en": "My shopping list"},"key": "my-shopping-list","customer": {"typeId": "customer","id": "e73cd97f-846e-44a0-b418-3ed044a8e398"},"slug": {"en": "my-shopping-list"},"lineItems": [{"id": "ade85d60-736b-4ca8-87ed-01fde78f92c5","productId": "077bb11b-0d00-4e00-aced-48f493a79da0","name": {"en": "Product name"},"productType": {"typeId": "product-type","id": "a941b0b1-5c8f-41de-99e4-de965714d89f"},"variantId": 2,"quantity": 1,"addedAt": "2022-08-22T14:11:03.572Z"}],"textLineItems": [{"id": "c25aaca9-bb25-4a9f-bb1f-be0a78e98dcb","name": {"en": "My shopping list item"},"description": {"en": "This is a good gift idea"},"quantity": 5,"addedAt": "2022-08-22T14:11:03.572Z"}],"businessUnit": {"key": "bu-345-france","typeId": "business-unit"},"deleteDaysAfterLastModification": 100,"createdAt": "2022-08-22T14:11:03.587Z","lastModifiedAt": "2022-08-22T14:11:03.587Z"}
Update ShoppingList in BusinessUnit
The Associate must have the UpdateMyShoppingLists or UpdateOthersShoppingLists Permission. If the required Permission is missing, an AssociateMissingPermission error is returned.
Update ShoppingList in BusinessUnit by ID
If the ShoppingList exists in the Project but does not reference the requested BusinessUnit, this method returns an InvalidOperation error.
manage_shopping_lists:{projectKey}regionString | Region in which the Project is hosted. |
projectKeyString |
|
associateIdString |
|
businessUnitKeyString |
|
idString |
|
expand | When expanding The parameter can be passed multiple times. |
application/jsonversionInt | Expected version of the ShoppingList on which the changes should be applied. If the expected version does not match the actual version, a ConcurrentModification error will be returned. |
actionsArray of ShoppingListUpdateAction | List of update actions to be performed on the ShoppingList. |
application/jsoncurl https://api.{region}.commercetools.com/{projectKey}/as-associate/{associateId}/in-business-unit/key={businessUnitKey}/shopping-lists/{id} -i \--header "Authorization: Bearer ${BEARER_TOKEN}" \--header 'Content-Type: application/json' \--data-binary @- << DATA{"version" : 1,"actions" : [ {"action" : "changeName","name" : {"en" : "New Name"}} ]}DATA
{"id": "acb58513-ccfd-4ee8-8f28-9b7238fb91cd","version": 1,"name": {"en": "My shopping list"},"key": "my-shopping-list","customer": {"typeId": "customer","id": "e73cd97f-846e-44a0-b418-3ed044a8e398"},"slug": {"en": "my-shopping-list"},"lineItems": [{"id": "ade85d60-736b-4ca8-87ed-01fde78f92c5","productId": "077bb11b-0d00-4e00-aced-48f493a79da0","name": {"en": "Product name"},"productType": {"typeId": "product-type","id": "a941b0b1-5c8f-41de-99e4-de965714d89f"},"variantId": 2,"quantity": 1,"addedAt": "2022-08-22T14:11:03.572Z"}],"textLineItems": [{"id": "c25aaca9-bb25-4a9f-bb1f-be0a78e98dcb","name": {"en": "My shopping list item"},"description": {"en": "This is a good gift idea"},"quantity": 5,"addedAt": "2022-08-22T14:11:03.572Z"}],"businessUnit": {"key": "bu-345-france","typeId": "business-unit"},"deleteDaysAfterLastModification": 100,"createdAt": "2022-08-22T14:11:03.587Z","lastModifiedAt": "2022-08-22T14:11:03.587Z"}
Update ShoppingList in BusinessUnit by Key
If the Shopping List exists in the Project but does not reference the requested BusinessUnit, this method returns an InvalidOperation error.
manage_shopping_lists:{projectKey}regionString | Region in which the Project is hosted. |
projectKeyString |
|
associateIdString |
|
businessUnitKeyString |
|
keyString |
|
expand | When expanding The parameter can be passed multiple times. |
application/jsonversionInt | Expected version of the ShoppingList on which the changes should be applied. If the expected version does not match the actual version, a ConcurrentModification error will be returned. |
actionsArray of ShoppingListUpdateAction | List of update actions to be performed on the ShoppingList. |
application/jsoncurl https://api.{region}.commercetools.com/{projectKey}/as-associate/{associateId}/in-business-unit/key={businessUnitKey}/shopping-lists/key={key} -i \--header "Authorization: Bearer ${BEARER_TOKEN}" \--header 'Content-Type: application/json' \--data-binary @- << DATA{"version" : 1,"actions" : [ {"action" : "changeName","name" : {"en" : "New Name"}} ]}DATA
{"id": "acb58513-ccfd-4ee8-8f28-9b7238fb91cd","version": 1,"name": {"en": "My shopping list"},"key": "my-shopping-list","customer": {"typeId": "customer","id": "e73cd97f-846e-44a0-b418-3ed044a8e398"},"slug": {"en": "my-shopping-list"},"lineItems": [{"id": "ade85d60-736b-4ca8-87ed-01fde78f92c5","productId": "077bb11b-0d00-4e00-aced-48f493a79da0","name": {"en": "Product name"},"productType": {"typeId": "product-type","id": "a941b0b1-5c8f-41de-99e4-de965714d89f"},"variantId": 2,"quantity": 1,"addedAt": "2022-08-22T14:11:03.572Z"}],"textLineItems": [{"id": "c25aaca9-bb25-4a9f-bb1f-be0a78e98dcb","name": {"en": "My shopping list item"},"description": {"en": "This is a good gift idea"},"quantity": 5,"addedAt": "2022-08-22T14:11:03.572Z"}],"businessUnit": {"key": "bu-345-france","typeId": "business-unit"},"deleteDaysAfterLastModification": 100,"createdAt": "2022-08-22T14:11:03.587Z","lastModifiedAt": "2022-08-22T14:11:03.587Z"}
Delete ShoppingList in BusinessUnit
The Associate must have the DeleteMyShoppingLists or DeleteOthersShoppingLists Permission. If the required Permission is missing, an AssociateMissingPermission error is returned.
Delete ShoppingList in BusinessUnit by ID
If the ShoppingList exists in the Project but does not reference the requested BusinessUnit, this method returns an InvalidOperation error.
manage_shopping_lists:{projectKey}regionString | Region in which the Project is hosted. |
projectKeyString |
|
associateIdString |
|
businessUnitKeyString |
|
idString |
|
versionInt | Last seen version of the resource. |
expand | When expanding The parameter can be passed multiple times. |
dataErasureBoolean | To erase all related personal data in compliance with GDPR, set to Default: false |
application/jsoncurl -X DELETE https://api.{region}.commercetools.com/{projectKey}/as-associate/{associateId}/in-business-unit/key={businessUnitKey}/shopping-lists/{id}?version={version} -i \--header "Authorization: Bearer ${BEARER_TOKEN}"
{"id": "acb58513-ccfd-4ee8-8f28-9b7238fb91cd","version": 1,"name": {"en": "My shopping list"},"key": "my-shopping-list","customer": {"typeId": "customer","id": "e73cd97f-846e-44a0-b418-3ed044a8e398"},"slug": {"en": "my-shopping-list"},"lineItems": [{"id": "ade85d60-736b-4ca8-87ed-01fde78f92c5","productId": "077bb11b-0d00-4e00-aced-48f493a79da0","name": {"en": "Product name"},"productType": {"typeId": "product-type","id": "a941b0b1-5c8f-41de-99e4-de965714d89f"},"variantId": 2,"quantity": 1,"addedAt": "2022-08-22T14:11:03.572Z"}],"textLineItems": [{"id": "c25aaca9-bb25-4a9f-bb1f-be0a78e98dcb","name": {"en": "My shopping list item"},"description": {"en": "This is a good gift idea"},"quantity": 5,"addedAt": "2022-08-22T14:11:03.572Z"}],"businessUnit": {"key": "bu-345-france","typeId": "business-unit"},"deleteDaysAfterLastModification": 100,"createdAt": "2022-08-22T14:11:03.587Z","lastModifiedAt": "2022-08-22T14:11:03.587Z"}
Delete ShoppingList in BusinessUnit by Key
If the ShoppingList exists in the Project but does not reference the requested BusinessUnit, this method returns an InvalidOperation error.
manage_shopping_lists:{projectKey}regionString | Region in which the Project is hosted. |
projectKeyString |
|
associateIdString |
|
businessUnitKeyString |
|
keyString |
|
versionInt | Last seen version of the resource. |
expand | When expanding The parameter can be passed multiple times. |
dataErasureBoolean | To erase all related personal data in compliance with GDPR, set to Default: false |
application/jsoncurl -X DELETE https://api.{region}.commercetools.com/{projectKey}/as-associate/{associateId}/in-business-unit/key={businessUnitKey}/shopping-lists/key={key}?version={version} -i \--header "Authorization: Bearer ${BEARER_TOKEN}"
{"id": "acb58513-ccfd-4ee8-8f28-9b7238fb91cd","version": 1,"name": {"en": "My shopping list"},"key": "my-shopping-list","customer": {"typeId": "customer","id": "e73cd97f-846e-44a0-b418-3ed044a8e398"},"slug": {"en": "my-shopping-list"},"lineItems": [{"id": "ade85d60-736b-4ca8-87ed-01fde78f92c5","productId": "077bb11b-0d00-4e00-aced-48f493a79da0","name": {"en": "Product name"},"productType": {"typeId": "product-type","id": "a941b0b1-5c8f-41de-99e4-de965714d89f"},"variantId": 2,"quantity": 1,"addedAt": "2022-08-22T14:11:03.572Z"}],"textLineItems": [{"id": "c25aaca9-bb25-4a9f-bb1f-be0a78e98dcb","name": {"en": "My shopping list item"},"description": {"en": "This is a good gift idea"},"quantity": 5,"addedAt": "2022-08-22T14:11:03.572Z"}],"businessUnit": {"key": "bu-345-france","typeId": "business-unit"},"deleteDaysAfterLastModification": 100,"createdAt": "2022-08-22T14:11:03.587Z","lastModifiedAt": "2022-08-22T14:11:03.587Z"}