@wix/agent-skills 1.23.0 → 1.25.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. package/README.md +1 -0
  2. package/package.json +2 -1
  3. package/skills/wix-app/SKILL.md +4 -1
  4. package/skills/wix-app/references/BUSINESS_MANAGER_THEME.md +108 -0
  5. package/skills/wix-app/references/BUSINESS_MANAGER_TOKENS.md +81 -0
  6. package/skills/wix-app/references/DASHBOARD_MODAL.md +41 -0
  7. package/skills/wix-app/references/DASHBOARD_PAGE.md +2 -0
  8. package/skills/wix-app/references/DASHBOARD_PLUGIN.md +19 -4
  9. package/skills/wix-app/references/EDITOR_REACT_COMPONENT.md +64 -50
  10. package/skills/wix-app/references/dashboard-page/DRAFT_TEMPLATE.md +5 -4
  11. package/skills/wix-app/references/dashboard-page/DRAFT_TEMPLATE_ROUTER.md +8 -7
  12. package/skills/wix-app/references/dashboard-page/DYNAMIC_PARAMETERS.md +21 -38
  13. package/skills/wix-app/references/editor-react-component/ACCESSIBILITY.md +4 -3
  14. package/skills/wix-app/references/editor-react-component/ANIMATED-COMPONENTS.md +28 -25
  15. package/skills/wix-app/references/editor-react-component/BRANDED-COMPONENTS.md +8 -2
  16. package/skills/wix-app/references/editor-react-component/COMPONENT-CONTRACT.md +12 -14
  17. package/skills/wix-app/references/editor-react-component/CSS-GUIDELINES.md +4 -3
  18. package/skills/wix-app/references/editor-react-component/DESIGN-STATES.md +66 -9
  19. package/skills/wix-app/references/editor-react-component/EDITOR-EXTENSION-CONFIGURATION.md +25 -0
  20. package/skills/wix-app/references/editor-react-component/OVERFLOW.md +146 -0
  21. package/skills/wix-app/references/editor-react-component/PARTS.md +6 -0
  22. package/skills/wix-app/scripts/scan-a11y-eslint.cjs +25 -1
  23. package/skills/wix-headless/SKILL.md +0 -1
  24. package/skills/wix-headless/references/CAPABILITIES.md +3 -3
  25. package/skills/wix-headless/references/DISCOVERY.md +1 -1
  26. package/skills/wix-headless/references/SDK_HANDOFF.md +1 -1
  27. package/skills/wix-headless/references/SEED.md +1 -1
  28. package/skills/wix-headless/references/SETUP.md +1 -1
  29. package/skills/wix-headless/references/inline-recipes/how-to-code-restaurant-reservations.md +1 -1
  30. package/skills/wix-headless/references/inline-recipes/setup-restaurant-experiences.md +2 -2
  31. package/skills/wix-headless/references/managed/AUTHENTICATION.md +3 -14
  32. package/skills/wix-headless/scripts/bootstrap.mjs +156 -0
  33. package/skills/{wix-headless-fast → wix-headless-kit}/SKILL.md +83 -64
  34. package/skills/{wix-headless-fast → wix-headless-kit}/cold-start/bootstrap.mjs +2 -2
  35. package/skills/{wix-headless-fast → wix-headless-kit}/cold-start/cold-start.md +26 -35
  36. package/skills/wix-headless-kit/guides/capabilities.md +76 -0
  37. package/skills/wix-headless-kit/guides/feedback.md +98 -0
  38. package/skills/{wix-headless-fast → wix-headless-kit}/guides/migration.md +20 -9
  39. package/skills/{wix-headless-fast → wix-headless-kit}/install/AGENTS.md +5 -2
  40. package/skills/{wix-headless-fast → wix-headless-kit}/install/attach.mjs +5 -2
  41. package/skills/wix-headless-kit/install/bootstrap.mjs +156 -0
  42. package/skills/{wix-headless-fast → wix-headless-kit}/install/check.mjs +2 -2
  43. package/skills/wix-headless-kit/install/context.mjs +169 -0
  44. package/skills/{wix-headless-fast → wix-headless-kit}/install/deploy.mjs +17 -4
  45. package/skills/{wix-headless-fast → wix-headless-kit}/install/setup.mjs +89 -55
  46. package/skills/{wix-headless-fast → wix-headless-kit}/install/templates.mjs +1 -1
  47. package/skills/wix-manage/SKILL.md +2 -8
  48. package/skills/wix-manage/references/cms/cms-dashboard-navigation.md +2 -2
  49. package/skills/wix-manage/references/cms/cms-data-items-crud.md +263 -31
  50. package/skills/wix-manage/references/cms/cms-publishing-flow.md +15 -15
  51. package/skills/wix-manage/references/cms/cms-schema-management.md +58 -7
  52. package/skills/wix-manage/references/sites/query-sites.md +1 -8
  53. package/skills/wix-auth/SKILL.md +0 -12
  54. package/skills/wix-auth/references/device-flow.md +0 -140
  55. package/skills/wix-headless-fast/install/context.mjs +0 -126
  56. package/skills/wix-manage/references/cms/cms-data-operations-extended.md +0 -263
  57. package/skills/wix-manage/references/cms/cms-references-and-relationships.md +0 -162
  58. /package/skills/{wix-headless-fast → wix-headless-kit}/guides/existing-site.md +0 -0
  59. /package/skills/{wix-headless-fast → wix-headless-kit}/guides/reference-mode.md +0 -0
  60. /package/skills/{wix-headless-fast → wix-headless-kit}/install/agents-md.mjs +0 -0
  61. /package/skills/{wix-headless-fast → wix-headless-kit}/install/lock.mjs +0 -0
@@ -1,12 +1,12 @@
1
1
  ---
2
2
  name: "CMS Data Items CRUD"
3
- description: "Add, query, update, and delete items in CMS collections. Use this to insert content, bulk insert/update/patch/delete items, query with filters, and manage collection data. Key endpoints: /wix-data/v2/items, /wix-data/v2/bulk/items/*."
3
+ description: "Add, query, update, and delete items in CMS collections, one at a time or in bulk. Also covers counting items, upserting with bulk save, truncating a collection, aggregating data with a pipeline, linking items through single- and multi-reference fields, and reading items with their referenced items expanded."
4
4
  ---
5
5
  # CMS Data Items CRUD
6
6
 
7
7
  > **Standard call shape (every curl below).** The `<AUTH>` placeholder is shorthand for `Authorization: Bearer <TOKEN>` only. Body-bearing requests also need `Content-Type: application/json`.
8
8
 
9
- This recipe covers basic Create, Read, Update, Delete (CRUD) operations for Wix CMS data items.
9
+ This recipe covers Create, Read, Update, Delete (CRUD) operations for Wix CMS data items, plus count, upsert, truncate, aggregate, and reference-field links.
10
10
 
11
11
  ## Prerequisites
12
12
 
@@ -25,8 +25,8 @@ This recipe covers basic Create, Read, Update, Delete (CRUD) operations for Wix
25
25
  Before inserting or updating items, you need to know the collection's field names and types. If you don't already know the schema:
26
26
 
27
27
  1. **Query existing items** - Fetch a few items to infer field names from the data
28
- 2. **Get collection schema** - Use `GET /collections/{dataCollectionId}` for full field definitions, **including `plugins`** — don't omit the `plugins` field when fetching or listing schemas
29
- 3. **List collections** - Use `GET /collections?fields=displayName,plugins` to see what collections exist (see [Schema Management](cms-schema-management.md))
28
+ 2. **Get collection schema** - Use `GET https://www.wixapis.com/wix-data/v2/collections/{dataCollectionId}` for full field definitions, **including `plugins`** — don't omit the `plugins` field when fetching or listing schemas
29
+ 3. **List collections** - Use `GET https://www.wixapis.com/wix-data/v2/collections?fields=displayName,plugins` to see what collections exist (see [Schema Management](cms-schema-management.md))
30
30
 
31
31
  It may be, that user refers to schema by its `displayName` rather than `id`, if collection is not found list all collections to find the right `id` (`dataCollectionId`) to use.
32
32
 
@@ -36,7 +36,7 @@ It may be, that user refers to schema by its `displayName` rather than `id`, if
36
36
 
37
37
  ## Insert Data Item
38
38
 
39
- **Endpoint**: `POST /wix-data/v2/items`
39
+ **Endpoint**: `POST https://www.wixapis.com/wix-data/v2/items`
40
40
 
41
41
  **Request Body**:
42
42
  ```json
@@ -73,7 +73,7 @@ It may be, that user refers to schema by its `displayName` rather than `id`, if
73
73
 
74
74
  ## Bulk Insert Items
75
75
 
76
- **Endpoint**: `POST /wix-data/v2/bulk/items/insert`
76
+ **Endpoint**: `POST https://www.wixapis.com/wix-data/v2/bulk/items/insert`
77
77
 
78
78
  **Request Body**:
79
79
  ```json
@@ -108,7 +108,7 @@ It may be, that user refers to schema by its `displayName` rather than `id`, if
108
108
 
109
109
  ## Query Data Items
110
110
 
111
- **Endpoint**: `POST /wix-data/v2/items/query`
111
+ **Endpoint**: `POST https://www.wixapis.com/wix-data/v2/items/query`
112
112
 
113
113
  **Basic Query**:
114
114
  ```json
@@ -163,7 +163,7 @@ It may be, that user refers to schema by its `displayName` rather than `id`, if
163
163
 
164
164
  ## Get Single Item
165
165
 
166
- **Endpoint**: `GET /wix-data/v2/items/{itemId}?dataCollectionId={collectionId}`
166
+ **Endpoint**: `GET https://www.wixapis.com/wix-data/v2/items/{itemId}?dataCollectionId={collectionId}`
167
167
 
168
168
  ```bash
169
169
  curl -X GET \
@@ -173,7 +173,7 @@ curl -X GET \
173
173
 
174
174
  ## Update Data Item
175
175
 
176
- **Endpoint**: `PUT /wix-data/v2/items/{itemId}`
176
+ **Endpoint**: `PUT https://www.wixapis.com/wix-data/v2/items/{itemId}`
177
177
 
178
178
  **Request Body**:
179
179
  ```json
@@ -192,7 +192,7 @@ curl -X GET \
192
192
 
193
193
  ## Patch Data Item (Partial Update - Single Item)
194
194
 
195
- **Endpoint**: `PATCH /wix-data/v2/items/{dataItemId}`
195
+ **Endpoint**: `PATCH https://www.wixapis.com/wix-data/v2/items/{dataItemId}`
196
196
 
197
197
  Unlike Update, this only modifies the specified fields — all other fields remain unchanged.
198
198
 
@@ -229,7 +229,9 @@ Unlike Update, this only modifies the specified fields — all other fields rema
229
229
 
230
230
  ## Bulk Update Items
231
231
 
232
- **Endpoint**: `POST /wix-data/v2/bulk/items/update`
232
+ **Endpoint**: `POST https://www.wixapis.com/wix-data/v2/bulk/items/update`
233
+
234
+ > There is no update-by-filter endpoint. To update the items matching a filter, query them first (see [Query Data Items](#query-data-items)), then send their ids to bulk update or bulk patch.
233
235
 
234
236
  > **Important**: Use `id` (not `_id`) at the element level. The `data` object should NOT contain `_id`.
235
237
 
@@ -259,7 +261,7 @@ Unlike Update, this only modifies the specified fields — all other fields rema
259
261
 
260
262
  ## Bulk Patch Items (Partial Update)
261
263
 
262
- **Endpoint**: `POST /wix-data/v2/bulk/items/patch`
264
+ **Endpoint**: `POST https://www.wixapis.com/wix-data/v2/bulk/items/patch`
263
265
 
264
266
  Unlike bulk update, this only modifies the specified fields - other fields remain unchanged. **Use this for partial updates.**
265
267
 
@@ -297,7 +299,7 @@ Unlike bulk update, this only modifies the specified fields - other fields remai
297
299
  }
298
300
  ```
299
301
 
300
- **Setting a reference field** (single REFERENCE only):
302
+ **Setting a single `REFERENCE` field** (the value is one item ID; for `MULTI_REFERENCE` the value shape differs, see the next example):
301
303
  ```json
302
304
  {
303
305
  "dataCollectionId": "events",
@@ -318,27 +320,40 @@ Unlike bulk update, this only modifies the specified fields - other fields remai
318
320
  }
319
321
  ```
320
322
 
323
+ **Setting a `MULTI_REFERENCE` field** (verified live): the value is an **array of item IDs**, and `SET_FIELD` **replaces the whole link set**. To add links without dropping the existing ones, use [Insert Multi-Reference Links](#insert-multi-reference-links) instead. A plain string, or `APPEND_TO_ARRAY`, fails per item with `WDE0303` inside a 200 bulk response — check `results[].itemMetadata`.
324
+ ```json
325
+ {
326
+ "dataCollectionId": "Projects",
327
+ "patches": [
328
+ {
329
+ "dataItemId": "project-item-id",
330
+ "fieldModifications": [
331
+ {
332
+ "fieldPath": "team",
333
+ "action": "SET_FIELD",
334
+ "setFieldOptions": {
335
+ "value": ["alice-item-id", "bob-item-id"]
336
+ }
337
+ }
338
+ ]
339
+ }
340
+ ]
341
+ }
342
+ ```
343
+
321
344
  **Available actions**: `SET_FIELD`, `REMOVE_FIELD`, `INCREMENT_FIELD`, `APPEND_TO_ARRAY`, `REMOVE_FROM_ARRAY`
322
345
 
323
346
  > **Common error**: If you get `WDE0080: patches must not be empty`, you sent `dataItems` instead of `patches`. Use the format above.
324
347
 
325
348
  > **Recommended**: Use bulk patch instead of bulk update when you only need to change specific fields.
326
349
 
327
- > **Reference Fields**:
328
- > - **Single REFERENCE**: CAN be set during insert/update by providing the referenced item's ID as the field value (e.g., `"venue": "venue-item-id"`)
329
- > - **MULTI_REFERENCE**: **STOP** - You cannot use this recipe for multi-reference fields. They cannot be set via insert/update/patch.
330
- >
331
- > **For MULTI_REFERENCE operations (add speakers, assign tags, link categories, etc.):**
332
- > **READ [CMS References & Relationships](cms-references-and-relationships.md)** for the exact endpoints and request bodies:
333
- > - `POST /wix-data/v2/bulk/items/insert-references` - add references
334
- > - `POST /wix-data/v2/items/replace-references` - replace all references
335
- > - `POST /wix-data/v2/bulk/items/remove-references` - remove references
336
- >
337
- > Error `WDE0303` occurs when attempting to set multi-reference fields via data operations.
350
+ > **Reference fields**: a single `REFERENCE` field is set like any other value (`"venue": "venue-item-id"`, as above). `MULTI_REFERENCE` links are written only by a `SET_FIELD` patch (single or bulk) or by the reference endpoints in [Reference Fields](#reference-fields) below; insert, bulk insert, bulk save, PUT and bulk update all return 200 but silently drop multi-reference values (verified live) — read the item back after any of them.
338
351
 
339
352
  ## Delete Data Item
340
353
 
341
- **Endpoint**: `DELETE /wix-data/v2/items/{itemId}?dataCollectionId={collectionId}`
354
+ > Deletes are irreversible. Confirm with the user before calling either delete endpoint unless the request already names the items to remove.
355
+
356
+ **Endpoint**: `DELETE https://www.wixapis.com/wix-data/v2/items/{itemId}?dataCollectionId={collectionId}`
342
357
 
343
358
  ```bash
344
359
  curl -X DELETE \
@@ -348,7 +363,7 @@ curl -X DELETE \
348
363
 
349
364
  ## Bulk Delete Items
350
365
 
351
- **Endpoint**: `POST /wix-data/v2/bulk/items/remove`
366
+ **Endpoint**: `POST https://www.wixapis.com/wix-data/v2/bulk/items/remove`
352
367
 
353
368
  ```json
354
369
  {
@@ -357,6 +372,225 @@ curl -X DELETE \
357
372
  }
358
373
  ```
359
374
 
375
+ ## Count Data Items
376
+
377
+ Count items in a collection, optionally with filters.
378
+
379
+ **Endpoint**: `POST https://www.wixapis.com/wix-data/v2/items/count`
380
+
381
+ **Count All Items**:
382
+ ```json
383
+ {
384
+ "dataCollectionId": "Products"
385
+ }
386
+ ```
387
+
388
+ **Response**:
389
+ ```json
390
+ {
391
+ "totalCount": 42
392
+ }
393
+ ```
394
+
395
+ **Count with Filter**:
396
+ ```json
397
+ {
398
+ "dataCollectionId": "Products",
399
+ "filter": {
400
+ "$and": [
401
+ { "inStock": true },
402
+ { "price": { "$gte": 50 } }
403
+ ]
404
+ }
405
+ }
406
+ ```
407
+
408
+ Count returns only `totalCount`. When the user needs to know *which* items match, run Query Data Items with the same filter instead of, or after, counting.
409
+
410
+ ## Bulk Save (Upsert)
411
+
412
+ Insert new items or update existing items in a single operation. This is useful for syncing data.
413
+
414
+ **Endpoint**: `POST https://www.wixapis.com/wix-data/v2/bulk/items/save`
415
+
416
+ ```json
417
+ {
418
+ "dataCollectionId": "Products",
419
+ "dataItems": [
420
+ {
421
+ "id": "existing-item-id",
422
+ "data": {
423
+ "title": "Updated Product",
424
+ "price": 199.99,
425
+ "inStock": true
426
+ }
427
+ },
428
+ {
429
+ "data": {
430
+ "title": "New Product",
431
+ "price": 79.99,
432
+ "inStock": true
433
+ }
434
+ }
435
+ ],
436
+ "returnEntity": true
437
+ }
438
+ ```
439
+
440
+ | Scenario | Action |
441
+ |----------|--------|
442
+ | No `id` provided | INSERT - Creates new item with generated ID |
443
+ | `id` provided, doesn't exist | INSERT - Creates new item with provided ID |
444
+ | `id` provided, exists | UPDATE - Replaces existing item |
445
+
446
+ > **Warning**: When updating, the entire item is replaced. Include all fields you want to keep. Confirm with the user before saving over existing items.
447
+
448
+ ## Truncate Collection
449
+
450
+ Remove all items from a collection.
451
+
452
+ **Endpoint**: `POST https://www.wixapis.com/wix-data/v2/items/truncate`
453
+
454
+ ```json
455
+ {
456
+ "dataCollectionId": "TestCollection"
457
+ }
458
+ ```
459
+
460
+ > **Warning**: This permanently deletes ALL items in the collection and cannot be undone. Ask the user to confirm before calling it.
461
+
462
+ ## Aggregate Data
463
+
464
+ Perform calculations on collection data using a pipeline of sequential stages. The example shows one `group` stage; the full set of stages (`filter`, `group`, `sort`, `projection`, `unwindArray`, `skip`, `limit`) and accumulators is in the [Aggregate Pipeline Data Items reference](https://dev.wix.com/docs/api-reference/business-solutions/cms/data-items/aggregate-pipeline-data-items).
465
+
466
+ **Endpoint**: `POST https://www.wixapis.com/wix-data/v2/items/aggregate-pipeline`
467
+
468
+ **Count by Category**:
469
+ ```json
470
+ {
471
+ "dataCollectionId": "Products",
472
+ "pipeline": {
473
+ "stages": [
474
+ {
475
+ "group": {
476
+ "groupIds": [
477
+ {"key": "category", "expression": {"fieldPath": "category"}}
478
+ ],
479
+ "accumulators": [
480
+ {
481
+ "resultFieldName": "count",
482
+ "sum": {"expression": {"numeric": 1}}
483
+ }
484
+ ]
485
+ }
486
+ }
487
+ ]
488
+ }
489
+ }
490
+ ```
491
+
492
+ ## Operation Comparison
493
+
494
+ | Operation | Use Case | Behavior |
495
+ |-----------|----------|----------|
496
+ | **Bulk Insert** | Add new items only | Fails if ID exists |
497
+ | **Bulk Update** | Update existing items | Fails if ID doesn't exist, replaces entire item |
498
+ | **Bulk Save** | Upsert (insert or update) | Creates or updates based on ID |
499
+ | **Bulk Patch** | Partial update | Only modifies specified fields |
500
+
501
+ ## Reference Fields
502
+
503
+ Reference fields link items across collections. A single `REFERENCE` field holds one item ID and is set like any other value in insert, update, or patch. A `MULTI_REFERENCE` field holds many links, and only two kinds of write create them: a `SET_FIELD` patch on the field (single or bulk), or the reference endpoints below, which add, replace, or remove links without touching the rest of the item. To add a reference field to a collection, see [Add a Reference Field](cms-schema-management.md#add-a-reference-field).
504
+
505
+ > **Warning (verified live)**: writing IDs into a `MULTI_REFERENCE` field through insert, bulk insert, bulk save, or PUT update returns **200 and silently drops that field's value** — no error is raised. Bulk update is a full-item replace like PUT and does the same: `success: true`, value dropped (verified live, bulk save on both its insert and update paths). Never trust the write response for reference links: read the item back with `includeReferencedItems` and confirm the linked items are there.
506
+
507
+ Linking flow, every time:
508
+
509
+ 1. Resolve the referring item ID and the referenced item IDs (query by a field value; never guess IDs).
510
+ 2. Write the links with the reference endpoints below, or with a `SET_FIELD` patch on the reference field. If the field already has links, `insert-references` adds without dropping them; `replace-references` and `SET_FIELD` discard the rest — confirm with the user before replacing unless the request says to.
511
+ 3. **Read the referring item back** with Query Data Items and `includeReferencedItems: ["<field>"]` (or `includeReferences: [{ "field": "<field>" }]`), and confirm the linked items are present. The write's 200 is not proof; only the read-back is.
512
+
513
+ ### Insert Multi-Reference Links
514
+
515
+ **Endpoint**: `POST https://www.wixapis.com/wix-data/v2/bulk/items/insert-references`
516
+
517
+ ```json
518
+ {
519
+ "dataCollectionId": "Products",
520
+ "dataItemReferences": [
521
+ {
522
+ "referringItemId": "product-item-id",
523
+ "referringItemFieldName": "tags",
524
+ "referencedItemId": "tag-1-item-id"
525
+ },
526
+ {
527
+ "referringItemId": "product-item-id",
528
+ "referringItemFieldName": "tags",
529
+ "referencedItemId": "tag-2-item-id"
530
+ }
531
+ ],
532
+ "returnEntity": true
533
+ }
534
+ ```
535
+
536
+ ### Replace All References
537
+
538
+ **Endpoint**: `POST https://www.wixapis.com/wix-data/v2/items/replace-references`
539
+
540
+ ```json
541
+ {
542
+ "dataCollectionId": "Products",
543
+ "referringItemId": "product-item-id",
544
+ "referringItemFieldName": "tags",
545
+ "newReferencedItemIds": ["new-tag-1-id", "new-tag-2-id", "new-tag-3-id"]
546
+ }
547
+ ```
548
+
549
+ > **Note**: To remove all references, pass an empty array for `newReferencedItemIds`.
550
+
551
+ ### Remove References (Bulk)
552
+
553
+ **Endpoint**: `POST https://www.wixapis.com/wix-data/v2/bulk/items/remove-references`
554
+
555
+ ```json
556
+ {
557
+ "dataCollectionId": "Products",
558
+ "dataItemReferences": [
559
+ {
560
+ "referringItemId": "product-id-1",
561
+ "referringItemFieldName": "tags",
562
+ "referencedItemId": "tag-to-remove-id"
563
+ }
564
+ ]
565
+ }
566
+ ```
567
+
568
+ ### Query with Referenced Items Expanded
569
+
570
+ **Endpoint**: `POST https://www.wixapis.com/wix-data/v2/items/query`
571
+
572
+ ```json
573
+ {
574
+ "dataCollectionId": "Products",
575
+ "query": {
576
+ "filter": {
577
+ "inStock": true
578
+ }
579
+ },
580
+ "includeReferencedItems": ["category", "tags"]
581
+ }
582
+ ```
583
+
584
+ The method article documents the same expansion as `"includeReferences": [{ "field": "category" }, { "field": "tags", "limit": 50 }]`; both forms work (verified live). Either way the expanded value is an **array of item objects** (with `_id`, `name`, …), not an array of IDs. Without one of these properties a `MULTI_REFERENCE` field is absent from the returned item, and a single `REFERENCE` field is returned as the item ID string (it is stored on the item; verified live).
585
+
586
+ ### Reference Query Operators
587
+
588
+ | Operator | Description | Example |
589
+ |----------|-------------|---------|
590
+ | `$eq` | Exact match (single reference) | `{ "category": "id" }` |
591
+ | `$hasSome` | Has at least one of | `{ "tags": { "$hasSome": ["id1", "id2"] } }` |
592
+ | `$hasAll` | Has all of | `{ "tags": { "$hasAll": ["id1", "id2"] } }` |
593
+
360
594
  ## Field Types Reference
361
595
 
362
596
  | Type | Description | Example Value |
@@ -379,7 +613,7 @@ curl -X DELETE \
379
613
  | `ARRAY_STRING` | Array of strings | `["tag1", "tag2"]` |
380
614
  | `OBJECT` | JSON object | `{"key": "value"}` |
381
615
  | `REFERENCE` | Single reference | Item ID string |
382
- | `MULTI_REFERENCE` | Multiple references, use separate *reference* endpoints to manipulate, `include` to include in queries | Array of IDs |
616
+ | `MULTI_REFERENCE` | Multiple references. Write with a `SET_FIELD` patch (array of item IDs, replaces the set) or the *reference* endpoints (add / replace / remove); expand in queries with `includeReferencedItems` or `includeReferences` | Write: array of item IDs (`SET_FIELD`). Read: absent unless expanded with `includeReferencedItems` / `includeReferences`, then an array of item objects |
383
617
 
384
618
  ---
385
619
 
@@ -452,7 +686,7 @@ POST https://www.wixapis.com/apps-installer-service/v1/app-instance/install
452
686
  }
453
687
  ```
454
688
 
455
- After the installation succeeds, retry the original `POST /wix-data/v2/items` request. If the
689
+ After the installation succeeds, retry the original `POST https://www.wixapis.com/wix-data/v2/items` request. If the
456
690
  user only asks what the error means or how to fix it, explain this installation step and ask for
457
691
  confirmation before performing the install.
458
692
 
@@ -465,7 +699,7 @@ confirmation before performing the install.
465
699
  | `PERMISSION_DENIED` | Insufficient access | Check API permissions |
466
700
  | `WDE0007` | Bulk update: wrong ID field name | Use `id` not `_id` at element level |
467
701
  | `WDE0080` | Validation failed (multiple causes) | Bulk update: don't include `_id` in `data`; Bulk patch: use `patches` array not `dataItems` |
468
- | `WDE0303` | Can't set multi-reference field via data operations | Use reference endpoints: `insert-references`, `replace-references` |
702
+ | `WDE0303` | Multi-reference field value is not an array of item IDs (a single ID string, or `APPEND_TO_ARRAY`); reported per item inside a 200 bulk response | Send `"value": ["id1", "id2"]` with `SET_FIELD`, or use the reference endpoints |
469
703
  | `WDE0110` | Wix CMS (Wix Data) application is not installed | Install application with appDefId: `e593b0bd-b783-45b8-97c2-873d42aacaf4` |
470
704
 
471
705
  ---
@@ -474,6 +708,4 @@ confirmation before performing the install.
474
708
 
475
709
  - [Data Items API Reference](https://dev.wix.com/docs/api-reference/business-solutions/cms/data-items/introduction)
476
710
  - [CMS Schema Management](cms-schema-management.md) - Creating and modifying collections
477
- - [CMS References & Relationships](cms-references-and-relationships.md) - Linking collections
478
- - [CMS Data Operations Extended](cms-data-operations-extended.md) - Count, upsert, aggregate
479
711
  - [CMS Draft & Publish Workflow](cms-publishing-flow.md) - Collections gated behind a draft/publish (Draft Items plugin) workflow
@@ -68,7 +68,7 @@ Reads target a specific surface — there is no merged view:
68
68
  - **Published items**: query the published collection (`articles`).
69
69
  - **Drafts**: query the drafts collection resolved from `draftItemsPluginOptions.draftsCollectionId` (e.g. `articles__drafts`).
70
70
 
71
- **Endpoint**: `POST /wix-data/v2/items/query`
71
+ **Endpoint**: `POST https://www.wixapis.com/wix-data/v2/items/query`
72
72
 
73
73
  ```json
74
74
  {
@@ -92,7 +92,7 @@ Reads target a specific surface — there is no merged view:
92
92
 
93
93
  Insert into the **drafts** collection. The item starts as **DRAFT**.
94
94
 
95
- **Endpoint**: `POST /wix-data/v2/items`
95
+ **Endpoint**: `POST https://www.wixapis.com/wix-data/v2/items`
96
96
 
97
97
  ```json
98
98
  {
@@ -117,7 +117,7 @@ Editing a live item does **not** overwrite the live copy — it stages a **pendi
117
117
 
118
118
  Replaces the published item's data with the draft's content; the draft is then deleted. Pass the **published** collection id.
119
119
 
120
- **Endpoint**: `POST /wix-data/v2/items/publish-draft`
120
+ **Endpoint**: `POST https://www.wixapis.com/wix-data/v2/items/publish-draft`
121
121
 
122
122
  ```bash
123
123
  curl -X POST \
@@ -147,7 +147,7 @@ curl -X POST \
147
147
 
148
148
  Retracts a published item back to draft state. Pass the **published** collection id.
149
149
 
150
- **Endpoint**: `POST /wix-data/v2/items/unpublish`
150
+ **Endpoint**: `POST https://www.wixapis.com/wix-data/v2/items/unpublish`
151
151
 
152
152
  ```bash
153
153
  curl -X POST \
@@ -198,7 +198,7 @@ curl -X DELETE 'https://www.wixapis.com/wix-data/v2/items/<id>?dataCollectionId=
198
198
 
199
199
  **Enable** — add the Draft Items plugin (requires collection-management permission). Use the dedicated endpoint; the Draft Items plugin cannot be added through the generic add-plugin call.
200
200
 
201
- **Endpoint**: `POST /wix-data/v2/collections/add-draft-items-plugin`
201
+ **Endpoint**: `POST https://www.wixapis.com/wix-data/v2/collections/add-draft-items-plugin`
202
202
 
203
203
  ```bash
204
204
  curl -X POST 'https://www.wixapis.com/wix-data/v2/collections/add-draft-items-plugin' \
@@ -219,7 +219,7 @@ curl -X POST 'https://www.wixapis.com/wix-data/v2/collections/add-draft-items-pl
219
219
 
220
220
  **Disable** — remove the plugin:
221
221
 
222
- **Endpoint**: `POST /wix-data/v2/collections/delete-draft-items-plugin`
222
+ **Endpoint**: `POST https://www.wixapis.com/wix-data/v2/collections/delete-draft-items-plugin`
223
223
 
224
224
  ```bash
225
225
  curl -X POST 'https://www.wixapis.com/wix-data/v2/collections/delete-draft-items-plugin' \
@@ -252,17 +252,17 @@ At the REST level, every read/author/publish/unpublish call here goes through th
252
252
  | Collection state | Desired action | API call | Permission needed |
253
253
  |------------------|----------------|----------|-------------------|
254
254
  | Draft Items plugin absent | Any write | Normal insert/update — writes go live immediately | Write Data Items |
255
- | Draft Items enabled | Detect workflow | `GET /collections/{id}` → inspect plugins for the Draft Items plugin; read `draftItemsPluginOptions.draftsCollectionId` | (read) |
256
- | Draft Items enabled | Read published items | `POST /items/query` on the published id | read |
257
- | Draft Items enabled | Read drafts | `POST /items/query` on the drafts collection id | read |
255
+ | Draft Items enabled | Detect workflow | `GET https://www.wixapis.com/wix-data/v2/collections/{id}` → inspect plugins for the Draft Items plugin; read `draftItemsPluginOptions.draftsCollectionId` | (read) |
256
+ | Draft Items enabled | Read published items | `POST https://www.wixapis.com/wix-data/v2/items/query` on the published id | read |
257
+ | Draft Items enabled | Read drafts | `POST https://www.wixapis.com/wix-data/v2/items/query` on the drafts collection id | read |
258
258
  | PUBLISHED | Edit into a pending draft (→ CHANGED) | Create the draft (`createDataItemDraft`), then edit it on the drafts collection | Write Data Items |
259
- | — | Create new draft (→ DRAFT) | `POST /items` on the drafts collection | Write Data Items |
260
- | DRAFT / CHANGED | Publish (→ PUBLISHED) | `POST /items/publish-draft` (published id) | Write Data Items |
261
- | PUBLISHED / CHANGED | Unpublish, keep as draft (→ DRAFT) | `POST /items/unpublish` `copyToDraft:true` | Write Data Items |
262
- | PUBLISHED / CHANGED | Unpublish, discard | `POST /items/unpublish` `copyToDraft:false` | Write Data Items |
263
- | CHANGED | Revert to live version (discard edit) | `DELETE /items/{id}?dataCollectionId=<drafts id>` | Write Data Items |
259
+ | — | Create new draft (→ DRAFT) | `POST https://www.wixapis.com/wix-data/v2/items` on the drafts collection | Write Data Items |
260
+ | DRAFT / CHANGED | Publish (→ PUBLISHED) | `POST https://www.wixapis.com/wix-data/v2/items/publish-draft` (published id) | Write Data Items |
261
+ | PUBLISHED / CHANGED | Unpublish, keep as draft (→ DRAFT) | `POST https://www.wixapis.com/wix-data/v2/items/unpublish` `copyToDraft:true` | Write Data Items |
262
+ | PUBLISHED / CHANGED | Unpublish, discard | `POST https://www.wixapis.com/wix-data/v2/items/unpublish` `copyToDraft:false` | Write Data Items |
263
+ | CHANGED | Revert to live version (discard edit) | `DELETE https://www.wixapis.com/wix-data/v2/items/{id}?dataCollectionId=<drafts id>` | Write Data Items |
264
264
  | any | Delete entirely (both versions) | Delete on the published id (+ drafts id if a draft exists) | Write Data Items |
265
- | plain, no plugin | Enable workflow | `POST /collections/add-draft-items-plugin` | Manage Data Collections |
265
+ | plain, no plugin | Enable workflow | `POST https://www.wixapis.com/wix-data/v2/collections/add-draft-items-plugin` | Manage Data Collections |
266
266
 
267
267
  ---
268
268
 
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: "CMS Schema Management"
3
- description: Create and modify CMS collection structures. Covers listing collections, creating collections with fields, adding/removing fields, and updating collection settings.
3
+ description: Create and modify CMS collection structures. Covers listing collections, creating collections with fields, adding/removing fields (including single- and multi-reference fields that link two collections), and updating collection settings.
4
4
  ---
5
5
  # CMS Schema Management
6
6
 
@@ -37,7 +37,7 @@ curl -X GET \
37
37
 
38
38
  ## Get Collection Schema
39
39
 
40
- **Endpoint**: `GET /wix-data/v2/collections/{collectionId}`
40
+ **Endpoint**: `GET https://www.wixapis.com/wix-data/v2/collections/{collectionId}`
41
41
 
42
42
  ```bash
43
43
  curl -X GET \
@@ -47,7 +47,7 @@ curl -X GET \
47
47
 
48
48
  ## Create a New Collection
49
49
 
50
- **Endpoint**: `POST /wix-data/v2/collections`
50
+ **Endpoint**: `POST https://www.wixapis.com/wix-data/v2/collections`
51
51
 
52
52
  ```json
53
53
  {
@@ -72,7 +72,7 @@ curl -X GET \
72
72
 
73
73
  ## Add a Field to Existing Collection
74
74
 
75
- **Endpoint**: `POST /wix-data/v2/collections/create-field`
75
+ **Endpoint**: `POST https://www.wixapis.com/wix-data/v2/collections/create-field`
76
76
 
77
77
  ```json
78
78
  {
@@ -86,11 +86,60 @@ curl -X GET \
86
86
  }
87
87
  ```
88
88
 
89
+ ### Add a Reference Field
90
+
91
+ Same endpoint as above: `POST https://www.wixapis.com/wix-data/v2/collections/create-field`. The two bodies below differ only in `type` and `typeMetadata`; omitting `typeMetadata` fails with `WDE0075` (see Error Handling).
92
+
93
+ | Type | Field Type | Relationship | Example |
94
+ |------|------------|--------------|---------|
95
+ | Single Reference | `REFERENCE` | One-to-one, Many-to-one | Product → Category |
96
+ | Multi-Reference | `MULTI_REFERENCE` | One-to-many, Many-to-many | Product → Tags |
97
+
98
+ **Single reference** — `typeMetadata.reference` names the referenced collection:
99
+
100
+ ```json
101
+ {
102
+ "dataCollectionId": "Products",
103
+ "field": {
104
+ "key": "category",
105
+ "displayName": "Category",
106
+ "type": "REFERENCE",
107
+ "typeMetadata": {
108
+ "reference": {
109
+ "referencedCollectionId": "Categories"
110
+ }
111
+ }
112
+ }
113
+ }
114
+ ```
115
+
116
+ **Multi-reference** — `typeMetadata.multiReference` also names the field created on the other collection:
117
+
118
+ ```json
119
+ {
120
+ "dataCollectionId": "Products",
121
+ "field": {
122
+ "key": "tags",
123
+ "displayName": "Tags",
124
+ "type": "MULTI_REFERENCE",
125
+ "typeMetadata": {
126
+ "multiReference": {
127
+ "referencedCollectionId": "Tags",
128
+ "referencingFieldKey": "products",
129
+ "referencingDisplayName": "Products"
130
+ }
131
+ }
132
+ }
133
+ }
134
+ ```
135
+
136
+ To link items through these fields, see [Reference Fields](cms-data-items-crud.md#reference-fields) in the CMS Data Items CRUD recipe.
137
+
89
138
  ## Delete a Field from Collection
90
139
 
91
140
  > **Warning**: This permanently deletes all data stored in this field across all items.
92
141
 
93
- **Endpoint**: `POST /wix-data/v2/collections/delete-field`
142
+ **Endpoint**: `POST https://www.wixapis.com/wix-data/v2/collections/delete-field`
94
143
 
95
144
  ```json
96
145
  {
@@ -101,7 +150,7 @@ curl -X GET \
101
150
 
102
151
  ## Update Collection Settings
103
152
 
104
- **Endpoint**: `PATCH /wix-data/v2/collections/{collectionId}`
153
+ **Endpoint**: `PATCH https://www.wixapis.com/wix-data/v2/collections/{collectionId}`
105
154
 
106
155
  ```json
107
156
  {
@@ -116,7 +165,7 @@ This works for `displayName`/`displayField`. **Permission updates currently fail
116
165
 
117
166
  **To change permissions on an existing collection, use the full-replace endpoint instead** (`UpdateDataCollection`, not `PatchDataCollection`) — it requires the collection's current `revision` and full `fields` array (get both from a `GET` first), but it does work:
118
167
 
119
- **Endpoint**: `PUT /wix-data/v2/collections`
168
+ **Endpoint**: `PUT https://www.wixapis.com/wix-data/v2/collections`
120
169
 
121
170
  ```json
122
171
  {
@@ -170,6 +219,8 @@ Don't delete and recreate a collection just to change its permissions — this f
170
219
 
171
220
  | Error | Cause | Solution |
172
221
  |-------|-------|----------|
222
+ | `WDE0075` (`Metadata for Reference type field not provided`) | `create-field` with `type` REFERENCE or MULTI_REFERENCE but no `typeMetadata` | Send `typeMetadata.reference.referencedCollectionId` (or `typeMetadata.multiReference…`), see Add a Reference Field |
223
+ | `WDE0075` (`Not recognized role provided in permissions`) | `PATCH /collections/{id}` with a `permissions` change | Use the full-replace `PUT /collections` (see Update Collection Settings) or the Data Permissions API |
173
224
  | `WDE0110` | Wix CMS (Wix Data) app is not installed on the site | Install it: `POST https://www.wixapis.com/apps-installer-service/v1/app-instance/install` with body `{"tenant":{"tenantType":"SITE","id":"<SITE_ID>"},"appInstance":{"appDefId":"e593b0bd-b783-45b8-97c2-873d42aacaf4"}}`, then retry. See the [Install Wix Apps recipe](../app-installation/install-wix-apps.md). |
174
225
 
175
226
  ## Related Documentation
@@ -6,7 +6,7 @@ description: List, count, and find the sites in a Wix account. Covers the namesp
6
6
 
7
7
  List, count, and find the sites in a Wix account.
8
8
 
9
- - **Auth**: account-level (a Wix user token, or an account-level API key). `wix token` prints one.
9
+ - **Auth**: account-level (a Wix user token, or an account-level API key).
10
10
  - **Permission**: `SITE_LIST.READ` (scope `SCOPE.ACC-DC-OS.READ-SITE`).
11
11
  - **Endpoints**: list `POST https://www.wixapis.com/site-list/v2/sites/query` · count
12
12
  `POST https://www.wixapis.com/site-list/v2/sites/count`.
@@ -99,10 +99,3 @@ interface Site {
99
99
  parentChildRole: string; // e.g. NONE
100
100
  }
101
101
  ```
102
-
103
- ## Next Steps
104
-
105
- Use a site's `id` for site-level API calls — derive a site token from the account token
106
- (`wix token --site <id>`, or the `oauth2/token` refresh-grant in wix-auth `device-flow`), then read
107
- its context via [Read Site Context](read-site-context.md) or create sites with
108
- [Create Site from Template](create-site-from-template.md).
@@ -1,12 +0,0 @@
1
- ---
2
- name: wix-auth
3
- description: "Authenticate with Wix to obtain an access token for calling Wix APIs. Use when an agent needs a valid Wix access token and has none, or when the stored token is expired."
4
- ---
5
-
6
- # Wix Auth
7
-
8
- Wix supports multiple authentication flows. This skill currently covers:
9
-
10
- - [Device Flow](references/device-flow.md) — interactive login via browser, no client secret required. Use when the agent is acting on behalf of a logged-in Wix user.
11
-
12
- Other flows (OAuth authorization code, API key) are documented at [https://www.wix.com/skills/docs](https://www.wix.com/skills/docs).