Ziwako Docs
ZiwakoRéférence APICollections

Add Collection Item

POST
/collections/{id}/items

This endpoint populates a collection with a specific item. Because Ziwako collections are versatile, you must specify the itemType so the system knows how to reference the target object correctly.

You can also attach metadata during the addition, such as setting the priority (useful for wishlists) or a quantity (essential for shopping carts).

Authorization

X-API-Key<token>

In: header

Path Parameters

id*string

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

curl -X POST "https://example.com/collections/string/items" \  -H "Content-Type: application/json" \  -d '{    "itemId": "string",    "itemType": "Product"  }'
{  "type": "string",  "code": "string",  "message": "string",  "data": {    "_id": "64f1a2b3c4d5e6f7g8h9i0j1",    "item": {      "_id": "64f1a2b3c4d5e6f7g8h9i0j2",      "name": "Smartphone XYZ",      "description": "Latest smartphone model",      "productType": "electronics"    },    "itemType": "Product",    "itemId": "64f1a2b3c4d5e6f7g8h9i0j2",    "collectionParent": {      "_id": "64f1a2b3c4d5e6f7g8h9i0j3",      "title": "My Wishlist",      "type": "wishlist",      "privacy": "private"    },    "collectionId": "64f1a2b3c4d5e6f7g8h9i0j3",    "owner": {      "_id": "64f1a2b3c4d5e6f7g8h9i0j4",      "firstName": "John",      "lastName": "Doe",      "email": "john.doe@example.com"    },    "ownerModel": "Profil",    "metadata": {      "position": 1,      "priority": "high",      "rating": 5,      "quantity": 1,      "addedBy": {        "_id": "64f1a2b3c4d5e6f7g8h9i0j4",        "firstName": "John",        "lastName": "Doe",        "email": "john.doe@example.com"      },      "addedByType": "Profil",      "addedAt": "2024-01-15T10:30:00Z",      "tags": [        "electronics",        "wishlist"      ],      "notes": "Really want this phone!"    },    "status": "active",    "payload": {},    "createdAt": "2024-01-15T10:30:00Z",    "updatedAt": "2024-01-15T10:30:00Z"  },  "status": 0}