User Collections
This feature allows storefront users to create their own user collections. Users can mark these collections as public or private. default: private
Public collections are accessible by everyone (including anonymous users) with a specific url. Private collections are only accessible by collection owners. Users can create, update (rename or mark as public) or destroy collections, they allowed to add or remove products their own collections.
It works under omnishop.wishlists.
POST
Create a Collection
Allows user to create a new user collection.
Path : /wishlists/user-collections/
Request
{
"name": "Test Collection"
}
Response
{
"pk": 1,
"status": "private",
"name": "Test Collection",
"slug": "test-collection",
"items": [],
"public_url": null
}
GET
List Collections
Allows user to get list of created collections. search parameter can filter collections by name , product_id parameter shows user collections which contains a specific product.
Path : https://{storefront_url}/wishlists/user-collections/
Parameters
Parameter | Data Type | Explanation |
---|---|---|
search | string | Search by name of user collection. |
product_id | integer | Search user collections which contains specific product ID. |
Response
{
"count": 1,
"next": null,
"previous": null,
"results": [
{
"pk": 1,
"status": "private",
"name": "Test Collection",
"slug": "test-collection",
"items": [],
"public_url": null
}
]
}
PATCH
Update a Collection
Allows user to rename or change visibility of specific collection. status(enum) field can be private or public.
Path : https://{storefront_url}/wishlists/user-collections/
Request
{
"name": "Public Collection",
"status": "public"
}
Response
{
"pk": 1,
"status": "public",
"name": "Public Collection",
"slug": "test-collection-2",
"items": [],
"public_url": "/wishlists/user-collection/test-collection-2/"
}
GET
Retrieve a Collection
Allows user to get detail of specific collection.
Path : https://{storefront_url}/wishlists/user-collections/<pk>/
Response
{
"pk": 1,
"status": "public",
"name": "Public Collection",
"slug": "test-collection-2",
"items": [],
"public_url": "/wishlists/user-collection/test-collection-2/"
}
DELETE
a Collection
Allows user to remove specific collection completely. It returns "204 No Content"
Path : https://{storefront_url}/wishlists/user-collections/<pk>/
POST
Add a Product to Collection
Allows user to add a new product to specific collection.
Path : https://{storefront_url}/wishlists/user-collection-items/
Request
{
"product_id": 3239,
"usercollection_id": 1
}'
Response
{
"pk": 1,
"product": {
"pk": 3239,
"name": "2-Li Aile Çerçevesi 13x18cm",
"base_code": "1KCERX0784",
"sku": "26728XX078584",
"product_type": "0",
"is_active": true,
"parent": null,
"attributes": {
"integration_ProductAtt13Desc": "Dekoratif - %50+%50",
"integration_ProductAtt12Desc": "%50 + %20 PROMOSYON",
"integration_ProductAtt07Desc": "50+50 promosyon",
"boyut": "13x18 CM",
"uretim_yeri": "ÇİN",
"renk": "STD",
"integration_ProductAtt03Desc": "2011/2012 KIŞ",
"integration_ProductCode": "1KCERV0784139",
"integration_ProductAtt01Desc": "DIŞ ALIM",
"integration_ProductAtt05Desc": "%50+%20 OUTLET PROMOSYONU",
"integration_ProductAtt09Desc": "POLYRESİN",
"integration_ProductAtt15Desc": "%50+%20 PROMOSYON",
"integration_ProductHierarchyLevel01": "TEKSTİL DIŞI",
"integration_ProductHierarchyLevel02": "Dekoratif",
"integration_ProductAtt02Desc": "Dekoratif - Çerçeve",
"integration_ProductAtt14Desc": "POLİREZİN ÇERÇEVE"
},
"attributes_kwargs": {
"integration_ProductHierarchyLevel01": {
"value": "TEKSTİL DIŞI",
"label": "TEKSTİL DIŞI"
},
"renk": {
"value": "STD",
"label": "STD"
},
"integration_ProductHierarchyLevel02": {
"value": "Dekoratif",
"label": "Dekoratif"
}
},
"extra_attributes": {},
"group_products": [],
"productimage_set": [
{
"pk": 978,
"status": "active",
"image": "https://cdn-mgsm.akinon.net/products/2017/01/23/2022/ce59ad7a-15f8-44d6-9c0d-XXf0fe5405ba.jpg",
"order": 0,
"created_date": "2017-01-24T10:38:10.663088Z",
"specialimage_set": []
},
{
"pk": 2434,
"status": "active",
"image": "https://cdn-mgsm.akinon.net/products/2017/01/23/2022/93e48ca3-3bac-4bec-940c-XXa9de3c4040.jpg",
"order": 1,
"created_date": "2017-01-24T10:39:44.865219Z",
"specialimage_set": []
},
{
"pk": 3928,
"status": "active",
"image": "https://cdn-mgsm.akinon.net/products/2017/01/23/2022/66d2b6b9-3d27-482f-93d5-e48abf231122.jpg",
"order": 2,
"created_date": "2017-01-24T10:41:16.058763Z",
"specialimage_set": []
}
],
"attribute_set": 62,
"custom_attribute_set": null,
"is_listable": true,
"listing_code": null,
"data_source": null
},
"created_date": "2021-09-21T08:15:50.875425Z"
}
DELETE
Remove a Product from Collection
Allows user to remove product from a specific collection. It returns "204 No Content".
Path : https://{storefront_url}/wishlists/user-collection-items/<pk>/
GET
Retrieve Public User Collection
Allows anyone to get details of specific collection.
Path: https://{storefront_url}/wishlists/user-collection/<slug>/
Response
{
"pk": 2,
"status": "public",
"name": "Public Collection",
"slug": "public-collection",
"items": [],
"public_url": "/wishlists/user-collection/public-collection/"
}