My Shopping Lists
The My Shopping Lists endpoint creates and provides access to shopping lists scoped to a specific user. The endpoint requires an access token from the password flow or anonymous session flow.
The My Shopping Lists endpoint intentionally provides access to a limited subset of the fields on a Shopping List. This provides extra security in scenarios when the client application must communicate directly with the commercetools API on behalf of a customer, such as commerce in a mobile application. If you need to modify a field available on the full Shopping List resource, pass the response from the My Shopping List endpoint to an internal service in your client application which accesses the Shopping List resource.
Representations
All representations are JSON objects submitted or received as payload to API requests or responses. Responses are equal to the responses on the shopping list endpoint, but requests may differ.
MyShoppingListDraft
A MyShoppingListDraft is the object submitted as payload to the
Create MyShoppingList method.
The customer
field of ShoppingList is automatically set with
a password flow token.
The anonymousId
is automatically set with a token for an anonymous session.
The key
and slug
fields can not be set.
name
- LocalizedString - Requireddescription
- LocalizedString - OptionallineItems
- Array of LineItemDraft - OptionaltextLineItems
- Array of TextLineItemDraft - Optionalcustom
- CustomFieldsDraft - Optional
The custom fields.deleteDaysAfterLastModification
- Number - Optional
The shopping list will be deleted automatically if it hasn't been modified for the specified amount of days. If not set, the default value configured in the Project is used.
Get ShoppingList by ID
Endpoint: /{projectKey}/me/shopping-lists/{id}
Method: GET
OAuth 2.0 Scopes: manage_my_shopping_lists:{projectKey}
Response Representation: ShoppingList
Get ShoppingList by Key
Endpoint: /{projectKey}/me/shopping-lists/key={key}
Method: GET
OAuth 2.0 Scopes: manage_my_shopping_lists:{projectKey}
Response Representation: ShoppingList
Query ShoppingLists
Endpoint: /{projectKey}/me/shopping-lists
Method: GET
OAuth 2.0 Scopes: manage_my_shopping_lists:{projectKey}
Response Representation: PagedQueryResult
with the results
array of ShoppingList
Query Parameters:
where
- Query Predicate - Optionalsort
- Sort - Optionalexpand
- Expansion - Optionallimit
- Number - Optionaloffset
- Number - Optional
Create a ShoppingList
Endpoint: /{projectKey}/me/shopping-lists
Method: POST
OAuth 2.0 Scopes: manage_my_shopping_lists:{projectKey}
Request Representation: MyShoppingListDraft
Response Representation: ShoppingList
Update ShoppingList
Endpoint: /{projectKey}/me/shopping-lists/{id}
Method: POST
OAuth 2.0 Scopes: manage_my_shopping_lists:{projectKey}
Response Representation: ShoppingList
Fields:
version
- Number - Required
The expected version of the shopping list on which the changes should be applied. If the expected version does not match the actual version, a 409 Conflict will be returned.actions
- Array of UpdateAction - Required
The list of update actions to be performed on the shopping list.
Update Actions
Update ShoppingList by Key
Endpoint: /{projectKey}/me/shopping-lists/key={key}
Method: POST
OAuth 2.0 Scopes: manage_my_shopping_lists:{projectKey}
Response Representation: ShoppingList
Fields:
version
- Number - Required
The expected version of the shopping list on which the changes should be applied. If the expected version does not match the actual version, a 409 Conflict will be returned.actions
- Array of UpdateAction - Required
The list of update actions to be performed on the shopping list.
Update Actions
Change Name
As described here.
Set Description
As described here.
Set Custom Type
As described here.
Set CustomField
As described here.
UpdateAction on line item
Add LineItem
As described here.
Remove LineItem
As described here.
Change LineItem Quantity
As described here.
Change LineItems Order
As described here.
Set LineItem Custom Type
As described here.
Set LineItem CustomField
As described here.
UpdateAction on TextLineItem
Add TextLineItem
As described here.
Remove TextLineItem
As described here.
Change TextLineItem Quantity
As described here.
Change TextLineItem Name
As described here.
Set TextLineItem Description
As described here.
Change TextLineItems Order
As described here.
Set TextLineItems Custom Type
As described here.
Set TextLineItems CustomField
As described here.
Set DeleteDaysAfterLastModification
As described here.
Delete ShoppingList
Removes a ShoppingList.
Endpoint: /{projectKey}/me/shopping-lists/{id}
Method: DELETE
OAuth 2.0 Scopes: manage_my_shopping_lists:{projectKey}
Response Representation: ShoppingList
Query parameters:
version
- Number - Required
Delete ShoppingList by Key
Removes a ShoppingList found by its key.
Endpoint: /{projectKey}/me/shopping-lists/key={key}
Method: DELETE
OAuth 2.0 Scopes: manage_my_shopping_lists:{projectKey}
Response Representation: ShoppingList
Query parameters:
version
- Number - Required