@wix/agent-skills 1.15.0 → 1.16.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.
- package/README.md +5 -1
- package/package.json +1 -1
- package/skills/wix-app/SKILL.md +4 -1
- package/skills/wix-app/references/APP_TOOLS.md +134 -0
- package/skills/wix-app/references/CUSTOM_ELEMENT_WIDGET.md +1 -1
- package/skills/wix-app/references/DASHBOARD_PAGE.md +0 -10
- package/skills/wix-app/references/DATA_COLLECTION.md +6 -4
- package/skills/wix-app/references/EDITOR_REACT_COMPONENT.md +28 -7
- package/skills/wix-app/references/SERVICE_PLUGIN.md +12 -10
- package/skills/wix-app/references/STORES_VERSIONING.md +9 -211
- package/skills/wix-app/references/app-tools/TOOLS.md +75 -0
- package/skills/wix-app/references/backend-event/COMMON-EVENTS.md +5 -0
- package/skills/wix-app/references/dashboard-page/DASHBOARD_API.md +2 -2
- package/skills/wix-app/references/editor-react-component/A11Y-REVIEW-REFERENCE.md +172 -0
- package/skills/wix-app/references/editor-react-component/A11Y-REVIEW.md +138 -0
- package/skills/wix-app/references/editor-react-component/ANIMATED-COMPONENTS.md +172 -0
- package/skills/wix-app/references/editor-react-component/BRANDED-COMPONENTS.md +29 -0
- package/skills/wix-app/references/editor-react-component/COMPONENT-API.md +1 -1
- package/skills/wix-app/references/editor-react-component/COMPONENT-PREVIEW.md +57 -0
- package/skills/wix-app/references/editor-react-component/CSS-GUIDELINES.md +33 -2
- package/skills/wix-app/references/editor-react-component/DESIGN-STATES.md +5 -3
- package/skills/wix-app/references/editor-react-component/DIRECTIONALITY.md +18 -1
- package/skills/wix-app/references/editor-react-component/PARTS.md +15 -2
- package/skills/wix-app/references/editor-react-component/REACT-GUIDELINES.md +4 -3
- package/skills/wix-app/references/service-plugin/BOOKINGS-STAFF-SORTING.md +13 -9
- package/skills/wix-app/references/service-plugin/DISCOUNT-TRIGGERS.md +4 -0
- package/skills/wix-app/references/service-plugin/GIFT-CARDS.md +4 -0
- package/skills/wix-app/references/service-plugin/PAYMENT-SETTINGS.md +3 -1
- package/skills/wix-app/references/service-plugin/SHIPPING-RATES.md +4 -0
- package/skills/wix-app/references/service-plugin/TOOLS_PROVIDER.md +54 -0
- package/skills/wix-app/references/stores/CATEGORIES.md +22 -0
- package/skills/wix-app/references/stores/GET_PRODUCT.md +99 -0
- package/skills/wix-app/references/stores/INVENTORY.md +37 -0
- package/skills/wix-app/references/stores/QUERY.md +119 -0
- package/skills/wix-app/references/stores/WRITE.md +55 -0
- package/skills/wix-docs/SKILL.md +35 -3
- package/skills/wix-headless/SKILL.md +9 -2
- package/skills/wix-headless/entry/bootstrap.mjs +2 -2
- package/skills/wix-headless/entry/skill.md +0 -2
- package/skills/wix-headless/references/CAPABILITIES.md +6 -4
- package/skills/wix-headless/references/CONTENT.md +36 -0
- package/skills/wix-headless/references/DESIGN.md +54 -0
- package/skills/wix-headless/references/DISCOVERY.md +25 -1
- package/skills/wix-headless/references/FEEDBACK.md +16 -5
- package/skills/wix-headless/references/IMAGE_GENERATION.md +10 -0
- package/skills/wix-headless/references/SDK_HANDOFF.md +2 -0
- package/skills/wix-headless/references/SEED.md +3 -1
- package/skills/wix-headless/references/SETUP.md +1 -1
- package/skills/wix-headless/references/inline-recipes/how-to-code-a-store.md +3 -2
- package/skills/wix-headless/references/inline-recipes/how-to-code-restaurant-reservations.md +42 -2
- package/skills/wix-headless/references/inline-recipes/setup-bookings.md +5 -1
- package/skills/wix-headless/references/inline-recipes/setup-forms.md +1 -1
- package/skills/wix-headless/references/inline-recipes/setup-online-store.md +33 -8
- package/skills/wix-headless/references/inline-recipes/setup-portfolio.md +3 -1
- package/skills/wix-headless/references/inline-recipes/setup-restaurant-experiences.md +73 -0
- package/skills/wix-headless/references/inline-recipes/setup-restaurant-orders.md +38 -2
- package/skills/wix-headless/references/inline-recipes/setup-restaurant-reservations.md +20 -1
- package/skills/wix-headless/references/inline-recipes/setup-restaurants.md +1 -1
- package/skills/wix-headless/references/managed/CONNECT.md +2 -2
- package/skills/wix-headless/references/managed/CREATE.md +15 -1
- package/skills/wix-headless/references/managed/DEPLOYMENT.md +47 -0
- package/skills/wix-headless/references/self-managed/DEPLOYMENT.md +8 -0
- package/skills/wix-headless/references/stripe/DEPLOYMENT.md +8 -0
- package/skills/wix-manage/SKILL.md +131 -12
- package/skills/wix-manage/references/analytics/analytics-dashboard-navigation.md +41 -0
- package/skills/wix-manage/references/analytics/query-site-analytics.md +66 -9
- package/skills/wix-manage/references/app-installation/app-installation-dashboard-navigation.md +28 -0
- package/skills/wix-manage/references/app-installation/install-wix-apps.md +3 -0
- package/skills/wix-manage/references/blog/blog-dashboard-navigation.md +56 -0
- package/skills/wix-manage/references/blog/how-to-create-blog-posts.md +31 -6
- package/skills/wix-manage/references/bookings/booking-service-policy-setup.md +3 -1
- package/skills/wix-manage/references/bookings/bookings-dashboard-navigation.md +63 -0
- package/skills/wix-manage/references/bookings/create-booking-service-from-prompt.md +6 -5
- package/skills/wix-manage/references/bookings/create-course-service.md +30 -5
- package/skills/wix-manage/references/bookings/diagnose-availability-issues.md +85 -42
- package/skills/wix-manage/references/cms/cms-dashboard-navigation.md +44 -0
- package/skills/wix-manage/references/cms/cms-data-items-crud.md +31 -3
- package/skills/wix-manage/references/cms/cms-publishing-flow.md +287 -0
- package/skills/wix-manage/references/cms/cms-schema-management.md +33 -1
- package/skills/wix-manage/references/contacts/contacts-dashboard-navigation.md +46 -0
- package/skills/wix-manage/references/contacts/create-a-contact.md +82 -0
- package/skills/wix-manage/references/contacts/update-a-contact.md +119 -0
- package/skills/wix-manage/references/dashboard-navigation/dashboard-navigation.md +82 -0
- package/skills/wix-manage/references/dashboard-navigation/routes.json +1733 -0
- package/skills/wix-manage/references/domains/domains-dashboard-navigation.md +32 -0
- package/skills/wix-manage/references/ecommerce/ecom-pricing.md +4 -4
- package/skills/wix-manage/references/ecommerce/ecom-shipping.md +1 -1
- package/skills/wix-manage/references/ecommerce/gift-cards/ecom-gift-cards-goal-sell-gift-cards.md +338 -0
- package/skills/wix-manage/references/ecommerce/pricing-promotions/ecom-pricing-create-discount-rule.md +42 -78
- package/skills/wix-manage/references/ecommerce/pricing-promotions/ecom-pricing-flow-bundle-and-save.md +1 -1
- package/skills/wix-manage/references/ecommerce/pricing-promotions/ecom-pricing-flow-stock-mover.md +1 -1
- package/skills/wix-manage/references/ecommerce/pricing-promotions/ecom-pricing-flow-upsell-boost.md +1 -1
- package/skills/wix-manage/references/ecommerce/recommend-ecommerce-strategy.md +90 -92
- package/skills/wix-manage/references/events/create-wix-event.md +176 -0
- package/skills/wix-manage/references/events/manage-wix-events.md +174 -0
- package/skills/wix-manage/references/forms/forms-dashboard-navigation.md +44 -0
- package/skills/wix-manage/references/get-paid/get-paid-dashboard-navigation.md +52 -0
- package/skills/wix-manage/references/get-paid/how-to-setup-wix-payments.md +30 -7
- package/skills/wix-manage/references/google-ads/billing-and-payment.md +80 -0
- package/skills/wix-manage/references/google-ads/create-performance-max-campaign.md +212 -0
- package/skills/wix-manage/references/google-ads/get-campaign-suggestions.md +110 -0
- package/skills/wix-manage/references/google-ads/google-ads-dashboard-navigation.md +25 -0
- package/skills/wix-manage/references/google-ads/install-and-create-account.md +155 -0
- package/skills/wix-manage/references/google-ads/manage-campaign-lifecycle.md +63 -0
- package/skills/wix-manage/references/google-ads/query-campaign-analytics.md +155 -0
- package/skills/wix-manage/references/marketing/create-and-publish-social-post.md +225 -144
- package/skills/wix-manage/references/marketing/generate-and-publish-marketing-plan.md +19 -10
- package/skills/wix-manage/references/marketing/marketing-dashboard-navigation.md +52 -0
- package/skills/wix-manage/references/pricing-plans/create-and-update-pricing-plans.md +99 -1
- package/skills/wix-manage/references/pricing-plans/pricing-plans-dashboard-navigation.md +45 -0
- package/skills/wix-manage/references/restaurants/restaurants-dashboard-navigation.md +68 -0
- package/skills/wix-manage/references/restaurants/wix-restaurants-setup.md +94 -125
- package/skills/wix-manage/references/site-properties/change-payment-currency-site-properties.md +48 -9
- package/skills/wix-manage/references/site-properties/site-properties-dashboard-navigation.md +31 -0
- package/skills/wix-manage/references/sites/create-headless-site.md +52 -0
- package/skills/wix-manage/references/sites/create-site-from-template.md +2 -25
- package/skills/wix-manage/references/sites/site-import.md +243 -0
- package/skills/wix-manage/references/sites/sites-dashboard-navigation.md +29 -0
- package/skills/wix-manage/references/stores/add-store-pages-to-site.md +17 -1
- package/skills/wix-manage/references/stores/create-product-from-image.md +8 -6
- package/skills/wix-manage/references/stores/create-product-with-options-catalog-v3.md +16 -10
- package/skills/wix-manage/references/stores/find-products-query-and-search-catalog-v3.md +26 -8
- package/skills/wix-manage/references/stores/stores-dashboard-navigation.md +65 -0
- package/skills/wix-manage/references/stores/update-product-with-options.md +39 -7
- package/skills/wix-replatform/.publish-manifest.json +8 -0
- package/skills/wix-replatform/SKILL.md +693 -0
- package/skills/wix-replatform/lib/artifact-freshness.js +215 -0
- package/skills/wix-replatform/lib/completion-report.js +200 -0
- package/skills/wix-replatform/lib/config-env.js +59 -0
- package/skills/wix-replatform/lib/execution-manifest.js +185 -0
- package/skills/wix-replatform/lib/execution-state.js +173 -0
- package/skills/wix-replatform/lib/import-recovery.js +313 -0
- package/skills/wix-replatform/lib/local-state.js +642 -0
- package/skills/wix-replatform/lib/orchestration-preflight.js +143 -0
- package/skills/wix-replatform/lib/orchestration-router.js +122 -0
- package/skills/wix-replatform/lib/orchestration-state.js +455 -0
- package/skills/wix-replatform/lib/progress-log.js +224 -0
- package/skills/wix-replatform/lib/progress-log.sh +140 -0
- package/skills/wix-replatform/lib/url-preservation-state.js +391 -0
- package/skills/wix-replatform/resources/rp-discovery/SKILL.md +184 -0
- package/skills/wix-replatform/resources/rp-execute-import/SKILL.md +529 -0
- package/skills/wix-replatform/resources/rp-execute-setup/SKILL.md +316 -0
- package/skills/wix-replatform/resources/rp-execute-setup/scripts/mint-token.sh +64 -0
- package/skills/wix-replatform/resources/rp-import-codegen/SKILL.md +1114 -0
- package/skills/wix-replatform/resources/rp-mapper/SKILL.md +430 -0
- package/skills/wix-replatform/resources/rp-mapper/lib/mapping-resolve.js +217 -0
- package/skills/wix-replatform/resources/rp-mapper/scripts/resolve-mapping.js +148 -0
- package/skills/wix-replatform/resources/rp-mapper/wix-business-solutions-taxonomy.md +378 -0
- package/skills/wix-replatform/resources/rp-setup-discovery/SKILL.md +183 -0
- package/skills/wix-replatform/resources/rp-source-csv/SKILL.md +478 -0
- package/skills/wix-replatform/resources/rp-source-csv/lib/canonical-record.js +136 -0
- package/skills/wix-replatform/resources/rp-source-csv/lib/csv-fileset.js +0 -0
- package/skills/wix-replatform/resources/rp-source-csv/lib/csv-fingerprint.js +310 -0
- package/skills/wix-replatform/resources/rp-source-csv/lib/csv-layout.js +1081 -0
- package/skills/wix-replatform/resources/rp-source-csv/lib/csv-parse.js +618 -0
- package/skills/wix-replatform/resources/rp-source-csv/scripts/csv-discovery.js +949 -0
- package/skills/wix-replatform/resources/rp-source-csv/source-schema.example.json +196 -0
- package/skills/wix-replatform/resources/rp-source-csv/vendors/bigcommerce.json +66 -0
- package/skills/wix-replatform/resources/rp-source-csv/vendors/magento.json +60 -0
- package/skills/wix-replatform/resources/rp-source-csv/vendors/shopify.json +95 -0
- package/skills/wix-replatform/resources/rp-source-csv/vendors/woocommerce.json +82 -0
- package/skills/wix-replatform/resources/rp-source-wordpress/SKILL.md +256 -0
- package/skills/wix-replatform/resources/rp-source-wordpress/lib/wp-http.js +249 -0
- package/skills/wix-replatform/resources/rp-source-wordpress/lib/wp-route-classifier.js +444 -0
- package/skills/wix-replatform/resources/rp-source-wordpress/scripts/wp-discovery.js +774 -0
- package/skills/wix-replatform/resources/rp-source-wordpress/source-schema.example.json +71 -0
- package/skills/wix-replatform/resources/rp-target-wix/SKILL.md +632 -0
- package/skills/wix-replatform/resources/rp-target-wix/SPEC-product-reviews-and-blog-authorship.md +330 -0
- package/skills/wix-replatform/resources/rp-target-wix/domains/README.md +21 -0
- package/skills/wix-replatform/resources/rp-target-wix/domains/blog/domain.json +19 -0
- package/skills/wix-replatform/resources/rp-target-wix/domains/blog/entities/category.json +37 -0
- package/skills/wix-replatform/resources/rp-target-wix/domains/blog/entities/comment.json +37 -0
- package/skills/wix-replatform/resources/rp-target-wix/domains/blog/entities/post.json +39 -0
- package/skills/wix-replatform/resources/rp-target-wix/domains/blog/entities/tag.json +35 -0
- package/skills/wix-replatform/resources/rp-target-wix/domains/cms/domain.json +14 -0
- package/skills/wix-replatform/resources/rp-target-wix/domains/cms/entities/collection.json +35 -0
- package/skills/wix-replatform/resources/rp-target-wix/domains/cms/entities/data-item.json +36 -0
- package/skills/wix-replatform/resources/rp-target-wix/domains/cms/entities/reference.json +35 -0
- package/skills/wix-replatform/resources/rp-target-wix/domains/crm/domain.json +14 -0
- package/skills/wix-replatform/resources/rp-target-wix/domains/crm/entities/contact.json +131 -0
- package/skills/wix-replatform/resources/rp-target-wix/domains/crm/entities/email-subscription.json +37 -0
- package/skills/wix-replatform/resources/rp-target-wix/domains/crm/entities/label.json +37 -0
- package/skills/wix-replatform/resources/rp-target-wix/domains/ecom/domain.json +21 -0
- package/skills/wix-replatform/resources/rp-target-wix/domains/ecom/entities/order-line-item.json +37 -0
- package/skills/wix-replatform/resources/rp-target-wix/domains/ecom/entities/order-refund.json +37 -0
- package/skills/wix-replatform/resources/rp-target-wix/domains/ecom/entities/order.json +97 -0
- package/skills/wix-replatform/resources/rp-target-wix/domains/index.json +528 -0
- package/skills/wix-replatform/resources/rp-target-wix/domains/media/domain.json +14 -0
- package/skills/wix-replatform/resources/rp-target-wix/domains/media/entities/media-file.json +38 -0
- package/skills/wix-replatform/resources/rp-target-wix/domains/media/entities/media-folder.json +37 -0
- package/skills/wix-replatform/resources/rp-target-wix/domains/members/domain.json +13 -0
- package/skills/wix-replatform/resources/rp-target-wix/domains/members/entities/badge.json +37 -0
- package/skills/wix-replatform/resources/rp-target-wix/domains/members/entities/member.json +53 -0
- package/skills/wix-replatform/resources/rp-target-wix/domains/schema.json +84 -0
- package/skills/wix-replatform/resources/rp-target-wix/domains/stores/domain.json +25 -0
- package/skills/wix-replatform/resources/rp-target-wix/domains/stores/entities/category.json +37 -0
- package/skills/wix-replatform/resources/rp-target-wix/domains/stores/entities/coupon.json +37 -0
- package/skills/wix-replatform/resources/rp-target-wix/domains/stores/entities/inventory-item.json +38 -0
- package/skills/wix-replatform/resources/rp-target-wix/domains/stores/entities/product-tag.json +37 -0
- package/skills/wix-replatform/resources/rp-target-wix/domains/stores/entities/product.json +90 -0
- package/skills/wix-replatform/resources/rp-target-wix/lib/audit-summary.js +64 -0
- package/skills/wix-replatform/resources/rp-target-wix/lib/contract-ledger.js +141 -0
- package/skills/wix-replatform/resources/rp-target-wix/lib/domain-knowledge.js +384 -0
- package/skills/wix-replatform/resources/rp-target-wix/lib/ndjson.js +260 -0
- package/skills/wix-replatform/resources/rp-target-wix/lib/stores-verification.js +238 -0
- package/skills/wix-replatform/resources/rp-target-wix/lib/wix-build.js +237 -0
- package/skills/wix-replatform/resources/rp-target-wix/lib/wix-target-spec.js +238 -0
- package/skills/wix-replatform/resources/rp-target-wix/lib/wix-writers.js +2219 -0
- package/skills/wix-replatform/resources/rp-target-wix/scripts/domain-knowledge-validate.js +31 -0
- package/skills/wix-replatform/resources/rp-target-wix/scripts/domain-knowledge.js +100 -0
- package/skills/wix-replatform/resources/rp-target-wix/scripts/verify-stores.js +107 -0
- package/skills/wix-replatform/resources/rp-telemetry/SKILL.md +344 -0
- package/skills/wix-replatform/resources/rp-telemetry/lib/bi-sink.js +250 -0
- package/skills/wix-replatform/resources/rp-telemetry/lib/telemetry-recorder.js +1927 -0
- package/skills/wix-replatform/resources/rp-telemetry/scripts/meter-from-audit.js +83 -0
- package/skills/wix-replatform/resources/rp-telemetry/scripts/rp-telemetry.js +141 -0
- package/skills/wix-replatform/scripts/artifact-freshness.js +76 -0
- package/skills/wix-replatform/scripts/execution-manifest-validate.js +43 -0
- package/skills/wix-replatform/scripts/execution-state-prepare.js +128 -0
- package/skills/wix-replatform/scripts/orchestration-preflight.js +48 -0
- package/skills/wix-replatform/scripts/orchestration-route.js +46 -0
- package/skills/wix-replatform/scripts/orchestration-state.js +245 -0
- package/skills/wix-vibe-headless/SKILL.md +54 -25
- package/skills/wix-vibe-headless/install/deploy.cjs +95 -0
- package/skills/wix-vibe-headless/install/pin-agents-md.cjs +34 -0
- package/skills/wix-vibe-headless/platforms/README.md +26 -0
- package/skills/wix-vibe-headless/platforms/base44.md +177 -0
- package/skills/wix-vibe-headless/platforms/generic.md +122 -0
- package/skills/wix-vibe-headless/references/blog/INSTRUCTIONS.md +230 -119
- package/skills/wix-vibe-headless/references/blog/app/components/PostCard.jsx +43 -0
- package/skills/wix-vibe-headless/references/blog/app/components/PostChips.jsx +25 -0
- package/skills/wix-vibe-headless/references/blog/app/components/PostGrid.jsx +15 -0
- package/skills/wix-vibe-headless/references/blog/app/context/TaxonomyContext.jsx +35 -0
- package/skills/wix-vibe-headless/references/blog/app/hooks/usePostDetail.js +38 -0
- package/skills/wix-vibe-headless/references/blog/app/pages/Blog.jsx +40 -0
- package/skills/wix-vibe-headless/references/blog/app/pages/CategoryPage.jsx +54 -0
- package/skills/wix-vibe-headless/references/blog/app/pages/PostDetail.jsx +65 -0
- package/skills/wix-vibe-headless/references/blog/app/pages/TagPage.jsx +50 -0
- package/skills/wix-vibe-headless/references/blog/seed/SEED.md +103 -0
- package/skills/wix-vibe-headless/references/blog/seed/seed-blog.js +270 -0
- package/skills/wix-vibe-headless/references/bookings/INSTRUCTIONS.md +260 -145
- package/skills/wix-vibe-headless/references/bookings/app/components/BookingForm.jsx +65 -0
- package/skills/wix-vibe-headless/references/bookings/app/components/ServiceCard.jsx +47 -0
- package/skills/wix-vibe-headless/references/bookings/app/components/ServiceGrid.jsx +13 -0
- package/skills/wix-vibe-headless/references/bookings/app/components/SlotPicker.jsx +126 -0
- package/skills/wix-vibe-headless/references/bookings/app/hooks/useServiceDetail.js +108 -0
- package/skills/wix-vibe-headless/references/bookings/app/hooks/useServices.js +58 -0
- package/skills/wix-vibe-headless/references/bookings/app/lib/serviceFacts.js +95 -0
- package/skills/wix-vibe-headless/references/bookings/app/pages/ServiceDetail.jsx +94 -0
- package/skills/wix-vibe-headless/references/bookings/app/pages/Services.jsx +89 -0
- package/skills/wix-vibe-headless/references/bookings/{wix-bookings-checkout.js → app/rest/wix-bookings-checkout.js} +1 -1
- package/skills/wix-vibe-headless/references/bookings/{wix-bookings-services.js → app/rest/wix-bookings-services.js} +90 -12
- package/skills/wix-vibe-headless/references/bookings/seed/SEED.md +117 -0
- package/skills/wix-vibe-headless/references/bookings/seed/seed-bookings.js +333 -0
- package/skills/wix-vibe-headless/references/cms/INSTRUCTIONS.md +169 -147
- package/skills/wix-vibe-headless/references/cms/app/collection.config.js +31 -0
- package/skills/wix-vibe-headless/references/cms/app/lib/wixImage.js +18 -0
- package/skills/wix-vibe-headless/references/cms/{wix-cms.js → app/rest/wix-cms.js} +47 -2
- package/skills/wix-vibe-headless/references/cms/seed/SEED.md +145 -0
- package/skills/wix-vibe-headless/references/events/INSTRUCTIONS.md +228 -131
- package/skills/wix-vibe-headless/references/events/app/components/CategoryFilter.jsx +23 -0
- package/skills/wix-vibe-headless/references/events/app/components/EventCard.jsx +43 -0
- package/skills/wix-vibe-headless/references/events/app/components/EventGrid.jsx +13 -0
- package/skills/wix-vibe-headless/references/events/app/components/EventRegistration.jsx +29 -0
- package/skills/wix-vibe-headless/references/events/app/components/RsvpForm.jsx +57 -0
- package/skills/wix-vibe-headless/references/events/app/components/TicketPicker.jsx +78 -0
- package/skills/wix-vibe-headless/references/events/app/hooks/useEventDetail.js +27 -0
- package/skills/wix-vibe-headless/references/events/app/hooks/useEventsList.js +54 -0
- package/skills/wix-vibe-headless/references/events/app/hooks/useRsvpForm.js +40 -0
- package/skills/wix-vibe-headless/references/events/app/hooks/useTicketing.js +81 -0
- package/skills/wix-vibe-headless/references/events/app/pages/EventDetail.jsx +48 -0
- package/skills/wix-vibe-headless/references/events/app/pages/Events.jsx +36 -0
- package/skills/wix-vibe-headless/references/events/{wix-events-browse.js → app/rest/wix-events-browse.js} +3 -2
- package/skills/wix-vibe-headless/references/events/seed/SEED.md +107 -0
- package/skills/wix-vibe-headless/references/events/seed/seed-events.js +251 -0
- package/skills/wix-vibe-headless/references/members/INSTRUCTIONS.md +276 -188
- package/skills/wix-vibe-headless/references/members/app/components/LoginForm.jsx +101 -0
- package/skills/wix-vibe-headless/references/members/app/components/MemberMenu.jsx +33 -0
- package/skills/wix-vibe-headless/references/members/app/components/RequireAuth.jsx +21 -0
- package/skills/wix-vibe-headless/references/members/app/components/SocialButtons.jsx +29 -0
- package/skills/wix-vibe-headless/references/members/app/context/MemberContext.jsx +54 -0
- package/skills/wix-vibe-headless/references/members/app/hooks/useLoginForm.js +77 -0
- package/skills/wix-vibe-headless/references/members/app/pages/Account.jsx +36 -0
- package/skills/wix-vibe-headless/references/members/app/pages/Callback.jsx +32 -0
- package/skills/wix-vibe-headless/references/members/app/pages/Login.jsx +35 -0
- package/skills/wix-vibe-headless/references/members/{wix-members-auth.js → app/rest/wix-members-auth.js} +6 -3
- package/skills/wix-vibe-headless/references/members/install/Register.jsx +22 -0
- package/skills/wix-vibe-headless/references/members/seed/SEED.md +22 -0
- package/skills/wix-vibe-headless/references/portfolio/INSTRUCTIONS.md +233 -104
- package/skills/wix-vibe-headless/references/portfolio/app/components/CollectionCard.jsx +31 -0
- package/skills/wix-vibe-headless/references/portfolio/app/components/CollectionGrid.jsx +15 -0
- package/skills/wix-vibe-headless/references/portfolio/app/components/ProjectCard.jsx +39 -0
- package/skills/wix-vibe-headless/references/portfolio/app/components/ProjectGrid.jsx +15 -0
- package/skills/wix-vibe-headless/references/portfolio/app/components/ProjectMedia.jsx +29 -0
- package/skills/wix-vibe-headless/references/portfolio/app/hooks/useCollectionProjects.js +35 -0
- package/skills/wix-vibe-headless/references/portfolio/app/hooks/usePortfolioGallery.js +27 -0
- package/skills/wix-vibe-headless/references/portfolio/app/hooks/useProjectDetail.js +25 -0
- package/skills/wix-vibe-headless/references/portfolio/app/pages/CollectionPage.jsx +39 -0
- package/skills/wix-vibe-headless/references/portfolio/app/pages/Portfolio.jsx +27 -0
- package/skills/wix-vibe-headless/references/portfolio/app/pages/ProjectDetail.jsx +60 -0
- package/skills/wix-vibe-headless/references/portfolio/{wix-portfolio.js → app/rest/wix-portfolio.js} +84 -55
- package/skills/wix-vibe-headless/references/portfolio/seed/SEED.md +94 -0
- package/skills/wix-vibe-headless/references/portfolio/seed/seed-portfolio.js +236 -0
- package/skills/wix-vibe-headless/references/pricing-plans/INSTRUCTIONS.md +240 -117
- package/skills/wix-vibe-headless/references/pricing-plans/app/components/OrderCard.jsx +35 -0
- package/skills/wix-vibe-headless/references/pricing-plans/app/components/PlanCard.jsx +48 -0
- package/skills/wix-vibe-headless/references/pricing-plans/app/components/PlanGrid.jsx +16 -0
- package/skills/wix-vibe-headless/references/pricing-plans/app/components/PlanPrice.jsx +35 -0
- package/skills/wix-vibe-headless/references/pricing-plans/app/hooks/useMyPlans.js +25 -0
- package/skills/wix-vibe-headless/references/pricing-plans/app/hooks/usePlanDetail.js +28 -0
- package/skills/wix-vibe-headless/references/pricing-plans/app/hooks/usePlans.js +30 -0
- package/skills/wix-vibe-headless/references/pricing-plans/app/pages/MyPlans.jsx +30 -0
- package/skills/wix-vibe-headless/references/pricing-plans/app/pages/PlanDetail.jsx +53 -0
- package/skills/wix-vibe-headless/references/pricing-plans/app/pages/Plans.jsx +28 -0
- package/skills/wix-vibe-headless/references/pricing-plans/seed/SEED.md +86 -0
- package/skills/wix-vibe-headless/references/pricing-plans/seed/seed-pricing-plans.js +251 -0
- package/skills/wix-vibe-headless/references/restaurants/INSTRUCTIONS.md +248 -124
- package/skills/wix-vibe-headless/references/restaurants/app/components/ItemDialog.jsx +81 -0
- package/skills/wix-vibe-headless/references/restaurants/app/components/MenuItemCard.jsx +71 -0
- package/skills/wix-vibe-headless/references/restaurants/app/components/MenuList.jsx +43 -0
- package/skills/wix-vibe-headless/references/restaurants/app/components/OrderCartButton.jsx +21 -0
- package/skills/wix-vibe-headless/references/restaurants/app/components/OrderCartDrawer.jsx +60 -0
- package/skills/wix-vibe-headless/references/restaurants/app/context/OrderCartContext.jsx +63 -0
- package/skills/wix-vibe-headless/references/restaurants/app/hooks/useItemOrder.js +32 -0
- package/skills/wix-vibe-headless/references/restaurants/app/hooks/useReservation.js +73 -0
- package/skills/wix-vibe-headless/references/restaurants/app/pages/Menu.jsx +28 -0
- package/skills/wix-vibe-headless/references/restaurants/app/pages/Reservations.jsx +102 -0
- package/skills/wix-vibe-headless/references/restaurants/seed/SEED.md +180 -0
- package/skills/wix-vibe-headless/references/restaurants/seed/seed-restaurants.js +452 -0
- package/skills/wix-vibe-headless/references/shared/app/components/WixManageBanner.jsx +56 -0
- package/skills/wix-vibe-headless/references/shared/{wix-client.js → app/rest/wix-client.js} +6 -8
- package/skills/wix-vibe-headless/references/shared/app/rest/wix-config.js +6 -0
- package/skills/wix-vibe-headless/references/storefront/INSTRUCTIONS.md +263 -148
- package/skills/wix-vibe-headless/references/storefront/app/components/CartButton.jsx +20 -0
- package/skills/wix-vibe-headless/references/storefront/app/components/CartDrawer.jsx +150 -0
- package/skills/wix-vibe-headless/references/storefront/app/components/ProductCard.jsx +167 -0
- package/skills/wix-vibe-headless/references/storefront/app/components/ProductGallery.jsx +51 -0
- package/skills/wix-vibe-headless/references/storefront/app/components/ProductGrid.jsx +54 -0
- package/skills/wix-vibe-headless/references/storefront/app/components/VariantPicker.jsx +119 -0
- package/skills/wix-vibe-headless/references/storefront/app/context/CartContext.jsx +71 -0
- package/skills/wix-vibe-headless/references/storefront/app/hooks/useProductDetail.js +109 -0
- package/skills/wix-vibe-headless/references/storefront/app/hooks/useShop.js +98 -0
- package/skills/wix-vibe-headless/references/storefront/app/lib/storeImage.js +27 -0
- package/skills/wix-vibe-headless/references/storefront/app/pages/ProductDetail.jsx +139 -0
- package/skills/wix-vibe-headless/references/storefront/app/pages/Shop.jsx +75 -0
- package/skills/wix-vibe-headless/references/storefront/{wix-store-cart.js → app/rest/wix-store-cart.js} +1 -1
- package/skills/wix-vibe-headless/references/storefront/{wix-store-catalog.js → app/rest/wix-store-catalog.js} +25 -2
- package/skills/wix-vibe-headless/references/storefront/seed/SEED.md +111 -0
- package/skills/wix-vibe-headless/references/storefront/seed/seed-store.js +299 -0
- /package/skills/wix-vibe-headless/references/blog/{wix-blog.js → app/rest/wix-blog.js} +0 -0
- /package/skills/wix-vibe-headless/references/events/{wix-events-registration.js → app/rest/wix-events-registration.js} +0 -0
- /package/skills/wix-vibe-headless/references/pricing-plans/{wix-pricing-plans.js → app/rest/wix-pricing-plans.js} +0 -0
- /package/skills/wix-vibe-headless/references/restaurants/{wix-restaurants-menu.js → app/rest/wix-restaurants-menu.js} +0 -0
- /package/skills/wix-vibe-headless/references/restaurants/{wix-restaurants-ordering.js → app/rest/wix-restaurants-ordering.js} +0 -0
- /package/skills/wix-vibe-headless/references/restaurants/{wix-restaurants-reservations.js → app/rest/wix-restaurants-reservations.js} +0 -0
|
@@ -25,11 +25,13 @@ 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
|
|
29
|
-
3. **List collections** - Use `GET /collections?fields=displayName` to see what collections exist (see [Schema Management](cms-schema-management.md))
|
|
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))
|
|
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
|
|
|
33
|
+
**Check for the Draft Items plugin.** If the collection's `plugins` include the Draft Items plugin, this collection gates items behind a draft/publish workflow. **Stop and load [CMS Draft & Publish Workflow](cms-publishing-flow.md)** before making any data changes, and follow its instructions instead of the plain CRUD flow below for that collection.
|
|
34
|
+
|
|
33
35
|
---
|
|
34
36
|
|
|
35
37
|
## Insert Data Item
|
|
@@ -367,7 +369,7 @@ curl -X DELETE \
|
|
|
367
369
|
| `IMAGE` | Image reference (HTTP url or wix:image://v1/{mediaId}/{friendlyName}) | `"wix:image://v1/3f72369f2219e2ee853e9e3df0217ce1.jpg/Colorful%20Business%20Cards.jpg"` |
|
|
368
370
|
| `VIDEO` | Video reference (HTTP url or wix:video://v1/{mediaId}/{friendlyName}) | `"wix:video://v1/11062b_484182533ede4b9a81329daf20238867/Sketching%20Design%20Concepts#posterUri=11062b_484182533ede4b9a81329daf20238867f000.jpg&posterWidth=1920&posterHeight=1080"` |
|
|
369
371
|
| `DOCUMENT` | Document reference (HTTP url or wix:document://v1/{mediaId}) | `"wix:document://v1/..."` |
|
|
370
|
-
| `MEDIA_IMAGE` | Wix Media Image | `{ "url": "http://...", "height": 640, "width": 480, "
|
|
372
|
+
| `MEDIA_IMAGE` | Wix Media Image | `{ "id": "<mediaId>", "url": "http://...", "height": 640, "width": 480, "altText": "Picture" }` |
|
|
371
373
|
| `MEDIA_VECTOR_ART` | Wix Media Vector Art | `{ "uri": "wix:vector://v1/...", "viewBox": "0 0 100 100", "contentType": "shape", "svgContent": "<svg>...</svg>" }` |
|
|
372
374
|
| `URL` | Web URL | `"https://example.com"` |
|
|
373
375
|
| `RICH_TEXT` | HTML content | `"<p>Rich text</p>"` |
|
|
@@ -429,6 +431,31 @@ curl -X DELETE \
|
|
|
429
431
|
|
|
430
432
|
## Error Handling
|
|
431
433
|
|
|
434
|
+
### Recovering from WDE0110
|
|
435
|
+
|
|
436
|
+
`WDE0110` means the Wix CMS (Wix Data) app is not installed on the site. If the user has
|
|
437
|
+
explicitly asked to install it, install the app before retrying the data-item request:
|
|
438
|
+
|
|
439
|
+
```http
|
|
440
|
+
POST https://www.wixapis.com/apps-installer-service/v1/app-instance/install
|
|
441
|
+
```
|
|
442
|
+
|
|
443
|
+
```json
|
|
444
|
+
{
|
|
445
|
+
"tenant": {
|
|
446
|
+
"tenantType": "SITE",
|
|
447
|
+
"id": "<SITE_ID>"
|
|
448
|
+
},
|
|
449
|
+
"appInstance": {
|
|
450
|
+
"appDefId": "e593b0bd-b783-45b8-97c2-873d42aacaf4"
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
```
|
|
454
|
+
|
|
455
|
+
After the installation succeeds, retry the original `POST /wix-data/v2/items` request. If the
|
|
456
|
+
user only asks what the error means or how to fix it, explain this installation step and ask for
|
|
457
|
+
confirmation before performing the install.
|
|
458
|
+
|
|
432
459
|
| Error | Cause | Solution |
|
|
433
460
|
|-------|-------|----------|
|
|
434
461
|
| `COLLECTION_NOT_FOUND` | Invalid collection ID | Check collection exists |
|
|
@@ -449,3 +476,4 @@ curl -X DELETE \
|
|
|
449
476
|
- [CMS Schema Management](cms-schema-management.md) - Creating and modifying collections
|
|
450
477
|
- [CMS References & Relationships](cms-references-and-relationships.md) - Linking collections
|
|
451
478
|
- [CMS Data Operations Extended](cms-data-operations-extended.md) - Count, upsert, aggregate
|
|
479
|
+
- [CMS Draft & Publish Workflow](cms-publishing-flow.md) - Collections gated behind a draft/publish (Draft Items plugin) workflow
|
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: "CMS Draft & Publish Workflow (Draft Items plugin)"
|
|
3
|
+
description: "Interact with CMS collections that gate their items behind a draft/publish workflow via the Draft Items plugin. Covers detecting the plugin, locating the paired drafts collection, reading published vs draft items, authoring/editing drafts, and publishing, unpublishing, reverting, and deleting items. Key endpoints: /wix-data/v2/items/publish-draft, /wix-data/v2/items/unpublish, /wix-data/v2/collections/add-draft-items-plugin, and the paired drafts collection referenced by draftItemsPluginOptions.draftsCollectionId."
|
|
4
|
+
---
|
|
5
|
+
# CMS Draft & Publish Workflow
|
|
6
|
+
|
|
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
|
+
|
|
9
|
+
Some CMS collections gate their items behind a **draft/publish workflow** instead of writing straight to the live site. Such a collection has the **Draft Items plugin** installed. Each item is in one of three states — **DRAFT**, **PUBLISHED**, or **CHANGED** (a published item with a pending draft edit) — and edits are staged as drafts until explicitly published.
|
|
10
|
+
|
|
11
|
+
This reference is for an agent that must **detect** whether a collection uses this workflow, **read** the right version of an item, and **drive item state transitions** (publish, unpublish, revert, delete) through the public Wix Data REST API.
|
|
12
|
+
|
|
13
|
+
## Prerequisites
|
|
14
|
+
|
|
15
|
+
1. Wix CMS enabled on the site.
|
|
16
|
+
2. The collection already exists (see [CMS Schema Management](cms-schema-management.md)).
|
|
17
|
+
3. API access with write permission on the collection's data items (reading, authoring drafts, and publishing all go through the Data Items API), plus collection-management permission to add or remove the Draft Items plugin.
|
|
18
|
+
|
|
19
|
+
## Required APIs
|
|
20
|
+
|
|
21
|
+
- **Data Items API**: [REST](https://dev.wix.com/docs/api-reference/business-solutions/cms/data-items/introduction) — includes Publish Data Item Draft and Unpublish Data Item.
|
|
22
|
+
- **Data Collections API**: [REST](https://dev.wix.com/docs/api-reference/business-solutions/cms/collection-management/data-collections/introduction) — Add/Delete Data Collection Plugin.
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## Mental model — where drafts live
|
|
27
|
+
|
|
28
|
+
A collection with the Draft Items plugin has **two paired surfaces**:
|
|
29
|
+
|
|
30
|
+
| Surface | Collection ID | Holds |
|
|
31
|
+
|---------|---------------|-------|
|
|
32
|
+
| Published (live) | the collection's own id (e.g. `articles`) | Items visible on the site |
|
|
33
|
+
| Paired drafts | `draftItemsPluginOptions.draftsCollectionId` (conventionally `<collectionId>__drafts`, e.g. `articles__drafts`) | Pending drafts (new items not yet published, or edits to a published item) |
|
|
34
|
+
|
|
35
|
+
**Read the drafts collection id from the plugin — do not assume the `__drafts` suffix.** The published collection's Draft Items plugin exposes `draftItemsPluginOptions.draftsCollectionId`; the drafts collection's plugin exposes `draftItemsPluginOptions.publishedCollectionId`. Resolve the pairing from those fields.
|
|
36
|
+
|
|
37
|
+
Item **state** is derived from where the item exists:
|
|
38
|
+
|
|
39
|
+
| State | Meaning | Where it lives |
|
|
40
|
+
|-------|---------|----------------|
|
|
41
|
+
| **DRAFT** | Not yet on the site | Only in the drafts collection |
|
|
42
|
+
| **PUBLISHED** | Live on the site, no pending edit | Only in the published collection |
|
|
43
|
+
| **CHANGED** | Live on the site **and** has a pending draft edit | In both the published and drafts collections |
|
|
44
|
+
|
|
45
|
+
> Treat state as **server-authoritative**. Derive it from the published/draft surfaces (or the item the API returns) — never render an optimistic status before the write confirms.
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
## 1. Detect the workflow on a collection
|
|
50
|
+
|
|
51
|
+
Read the collection and inspect its **plugins**. A collection with the **Draft Items plugin** uses the draft/publish workflow.
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
curl -X GET \
|
|
55
|
+
'https://www.wixapis.com/wix-data/v2/collections/articles' \
|
|
56
|
+
-H 'Authorization: <AUTH>'
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
- **Draft Items plugin present** → the collection gates items behind draft/publish. Its `draftItemsPluginOptions.draftsCollectionId` gives the paired drafts collection to author and edit drafts against.
|
|
60
|
+
- **Draft Items plugin absent** → plain collection; every insert/update goes straight live. No draft surface exists.
|
|
61
|
+
|
|
62
|
+
---
|
|
63
|
+
|
|
64
|
+
## 2. Read items
|
|
65
|
+
|
|
66
|
+
Reads target a specific surface — there is no merged view:
|
|
67
|
+
|
|
68
|
+
- **Published items**: query the published collection (`articles`).
|
|
69
|
+
- **Drafts**: query the drafts collection resolved from `draftItemsPluginOptions.draftsCollectionId` (e.g. `articles__drafts`).
|
|
70
|
+
|
|
71
|
+
**Endpoint**: `POST /wix-data/v2/items/query`
|
|
72
|
+
|
|
73
|
+
```json
|
|
74
|
+
{
|
|
75
|
+
"dataCollectionId": "articles__drafts",
|
|
76
|
+
"query": {
|
|
77
|
+
"filter": { "category": "news" },
|
|
78
|
+
"paging": { "limit": 50, "offset": 0 }
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
- To read only **published** items, query with `dataCollectionId: "articles"`.
|
|
84
|
+
- To read **drafts**, query with `dataCollectionId` set to the paired drafts collection id.
|
|
85
|
+
- Compute **CHANGED** by checking whether an item id exists in **both** the published and drafts surfaces.
|
|
86
|
+
|
|
87
|
+
---
|
|
88
|
+
|
|
89
|
+
## 3. Write & transition items
|
|
90
|
+
|
|
91
|
+
### Author a brand-new draft
|
|
92
|
+
|
|
93
|
+
Insert into the **drafts** collection. The item starts as **DRAFT**.
|
|
94
|
+
|
|
95
|
+
**Endpoint**: `POST /wix-data/v2/items`
|
|
96
|
+
|
|
97
|
+
```json
|
|
98
|
+
{
|
|
99
|
+
"dataCollectionId": "articles__drafts",
|
|
100
|
+
"dataItem": {
|
|
101
|
+
"data": { "title": "Draft headline", "body": "Work in progress" }
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
### Edit a draft
|
|
107
|
+
|
|
108
|
+
Update or patch against the **drafts** collection (`articles__drafts`). See [CMS Data Items CRUD](cms-data-items-crud.md) for Update/Patch shapes.
|
|
109
|
+
|
|
110
|
+
### Edit a PUBLISHED item → produces CHANGED
|
|
111
|
+
|
|
112
|
+
Editing a live item does **not** overwrite the live copy — it stages a **pending draft**, leaving the published version untouched until published. The live item then has a pending draft (state **CHANGED**).
|
|
113
|
+
|
|
114
|
+
**Create the draft first, then edit it.** To edit a published item, explicitly create the draft via the **create-draft** flow (`createDataItemDraft`) rather than relying on an implicit draft-on-update. Create-draft seeds a full draft copy of the currently-published item into the drafts collection under the same item id; you then apply your edits to that draft. This is the more reliable path — a bare partial update straight to the drafts collection risks producing a draft that is missing the fields you didn't touch. So: create-draft for the published item id, then Update/Patch that draft on the drafts collection (`articles__drafts`).
|
|
115
|
+
|
|
116
|
+
### Publish a pending draft (DRAFT/CHANGED → PUBLISHED)
|
|
117
|
+
|
|
118
|
+
Replaces the published item's data with the draft's content; the draft is then deleted. Pass the **published** collection id.
|
|
119
|
+
|
|
120
|
+
**Endpoint**: `POST /wix-data/v2/items/publish-draft`
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
curl -X POST \
|
|
124
|
+
'https://www.wixapis.com/wix-data/v2/items/publish-draft' \
|
|
125
|
+
-H 'Content-Type: application/json' \
|
|
126
|
+
-H 'Authorization: <AUTH>' \
|
|
127
|
+
-d '{
|
|
128
|
+
"dataCollectionId": "articles",
|
|
129
|
+
"dataItemId": "5331fc15-9441-4fd4-bc7b-7f6870c69228"
|
|
130
|
+
}'
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
**Response** — the newly-published item (the draft is gone):
|
|
134
|
+
```json
|
|
135
|
+
{
|
|
136
|
+
"dataItem": {
|
|
137
|
+
"id": "5331fc15-9441-4fd4-bc7b-7f6870c69228",
|
|
138
|
+
"dataCollectionId": "articles",
|
|
139
|
+
"data": { "_id": "5331fc15-...", "title": "Draft headline" }
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
- Returns `NOT_FOUND` if no pending draft exists for that id.
|
|
145
|
+
|
|
146
|
+
### Unpublish a live item (PUBLISHED/CHANGED → DRAFT)
|
|
147
|
+
|
|
148
|
+
Retracts a published item back to draft state. Pass the **published** collection id.
|
|
149
|
+
|
|
150
|
+
**Endpoint**: `POST /wix-data/v2/items/unpublish`
|
|
151
|
+
|
|
152
|
+
```bash
|
|
153
|
+
curl -X POST \
|
|
154
|
+
'https://www.wixapis.com/wix-data/v2/items/unpublish' \
|
|
155
|
+
-H 'Content-Type: application/json' \
|
|
156
|
+
-H 'Authorization: <AUTH>' \
|
|
157
|
+
-d '{
|
|
158
|
+
"dataCollectionId": "articles",
|
|
159
|
+
"dataItemId": "5331fc15-9441-4fd4-bc7b-7f6870c69228",
|
|
160
|
+
"copyToDraft": true
|
|
161
|
+
}'
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
`copyToDraft` controls the two "keep vs discard" variants:
|
|
165
|
+
|
|
166
|
+
| `copyToDraft` | Behavior | Use for |
|
|
167
|
+
|---------------|----------|---------|
|
|
168
|
+
| `true` (default) | Removes the live copy, creates a draft seeded with the previously-published data. Any existing pending draft for that id is **overwritten**. | "Unpublish and keep changes" |
|
|
169
|
+
| `false` | Removes the live copy **without** creating a draft. No `dataItem` returned. | "Unpublish and discard" |
|
|
170
|
+
|
|
171
|
+
- Response (`copyToDraft: true`) carries the **new draft**, not the removed live item.
|
|
172
|
+
- Returns `NOT_FOUND` if no published item exists with that id.
|
|
173
|
+
|
|
174
|
+
### Revert to live version (CHANGED → PUBLISHED, discard the pending edit)
|
|
175
|
+
|
|
176
|
+
Discard the pending draft while keeping the live version as-is: **delete the item from the drafts collection**.
|
|
177
|
+
|
|
178
|
+
```bash
|
|
179
|
+
curl -X DELETE \
|
|
180
|
+
'https://www.wixapis.com/wix-data/v2/items/5331fc15-...?dataCollectionId=articles__drafts' \
|
|
181
|
+
-H 'Authorization: <AUTH>'
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
### Delete an item entirely (removes both versions)
|
|
185
|
+
|
|
186
|
+
Deleting must remove **both** the live item and any pending draft.
|
|
187
|
+
|
|
188
|
+
```bash
|
|
189
|
+
# live version
|
|
190
|
+
curl -X DELETE 'https://www.wixapis.com/wix-data/v2/items/<id>?dataCollectionId=articles' -H 'Authorization: <AUTH>'
|
|
191
|
+
# drafts collection, if a draft exists
|
|
192
|
+
curl -X DELETE 'https://www.wixapis.com/wix-data/v2/items/<id>?dataCollectionId=articles__drafts' -H 'Authorization: <AUTH>'
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
---
|
|
196
|
+
|
|
197
|
+
## 4. Enable / disable the workflow on a collection
|
|
198
|
+
|
|
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
|
+
|
|
201
|
+
**Endpoint**: `POST /wix-data/v2/collections/add-draft-items-plugin`
|
|
202
|
+
|
|
203
|
+
```bash
|
|
204
|
+
curl -X POST 'https://www.wixapis.com/wix-data/v2/collections/add-draft-items-plugin' \
|
|
205
|
+
-H 'Content-Type: application/json' \
|
|
206
|
+
-H 'Authorization: <AUTH>' \
|
|
207
|
+
-d '{
|
|
208
|
+
"dataCollectionId": "articles",
|
|
209
|
+
"publishPluginConflictAction": "FAIL_WHEN_PUBLISH_INSTALLED"
|
|
210
|
+
}'
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
`publishPluginConflictAction` controls what happens if the legacy Publish plugin is already installed:
|
|
214
|
+
|
|
215
|
+
| Value | Behavior |
|
|
216
|
+
|-------|----------|
|
|
217
|
+
| `FAIL_WHEN_PUBLISH_INSTALLED` | Fail if the Publish plugin is already installed. |
|
|
218
|
+
| `COPY_DRAFT_ITEMS_WITH_DRAFT_STATUS` | Copy draft items with draft status; where a published version already exists, discard the draft item. |
|
|
219
|
+
|
|
220
|
+
**Disable** — remove the plugin:
|
|
221
|
+
|
|
222
|
+
**Endpoint**: `POST /wix-data/v2/collections/delete-draft-items-plugin`
|
|
223
|
+
|
|
224
|
+
```bash
|
|
225
|
+
curl -X POST 'https://www.wixapis.com/wix-data/v2/collections/delete-draft-items-plugin' \
|
|
226
|
+
-H 'Content-Type: application/json' \
|
|
227
|
+
-H 'Authorization: <AUTH>' \
|
|
228
|
+
-d '{
|
|
229
|
+
"dataCollectionId": "articles",
|
|
230
|
+
"draftItemsRemovalAction": "FAIL_IF_DRAFT_ITEMS_EXIST"
|
|
231
|
+
}'
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
`draftItemsRemovalAction` decides the fate of existing drafts:
|
|
235
|
+
|
|
236
|
+
| Value | Behavior |
|
|
237
|
+
|-------|----------|
|
|
238
|
+
| `FAIL_IF_DRAFT_ITEMS_EXIST` | Fail if any draft items exist. |
|
|
239
|
+
| `DISCARD_EXISTING_DRAFT_ITEMS` | Discard draft items (data loss). |
|
|
240
|
+
| `PUBLISH_EXISTING_DRAFT_ITEMS` | Publish draft items, overwriting any currently published items with the same ids. |
|
|
241
|
+
|
|
242
|
+
---
|
|
243
|
+
|
|
244
|
+
## Permissions
|
|
245
|
+
|
|
246
|
+
At the REST level, every read/author/publish/unpublish call here goes through the Data Items API and requires write access to the collection's data items. Beyond that, individual draft and publish actions may be further permission-restricted per caller on the collection, and there's no way to introspect those permissions ahead of time — so attempt the action and **handle authorization errors gracefully** if the write is rejected.
|
|
247
|
+
|
|
248
|
+
---
|
|
249
|
+
|
|
250
|
+
## Decision table — collection + desired action → API + permission
|
|
251
|
+
|
|
252
|
+
| Collection state | Desired action | API call | Permission needed |
|
|
253
|
+
|------------------|----------------|----------|-------------------|
|
|
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 |
|
|
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 |
|
|
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 |
|
|
266
|
+
|
|
267
|
+
---
|
|
268
|
+
|
|
269
|
+
## Agent gotchas
|
|
270
|
+
|
|
271
|
+
- **Resolve the drafts collection from the plugin.** Read `draftItemsPluginOptions.draftsCollectionId` off the published collection's Draft Items plugin rather than assuming a `__drafts` suffix.
|
|
272
|
+
- **Status is server-authoritative.** Derive DRAFT/PUBLISHED/CHANGED from the published + drafts surfaces (or the value the API returns). Never compute it locally, and never render an optimistic status before the write confirms (**confirm-then-render**).
|
|
273
|
+
- **Pass the *published* collection id** to `publish-draft` and `unpublish` — not the drafts collection id. Author and edit drafts against the drafts collection id.
|
|
274
|
+
- **Publishing deletes the draft.** After `publish-draft`, the pending draft no longer exists; the returned item is the live one.
|
|
275
|
+
- **Unpublish overwrites an existing draft** when `copyToDraft: true` — any pending edit for that id is replaced with the previously-published data.
|
|
276
|
+
- **Refetch after publish/unpublish.** State changes across the published/draft surfaces are not guaranteed atomic; re-query rather than assuming local state. Wix Data is eventually consistent — use `consistentRead: true` if you must read immediately after a write.
|
|
277
|
+
|
|
278
|
+
---
|
|
279
|
+
|
|
280
|
+
## Related Documentation
|
|
281
|
+
|
|
282
|
+
- [Publish Data Item Draft](https://dev.wix.com/docs/api-reference/business-solutions/cms/data-items/publish-data-item-draft)
|
|
283
|
+
- [Unpublish Data Item](https://dev.wix.com/docs/api-reference/business-solutions/cms/data-items/unpublish-data-item)
|
|
284
|
+
- [Data Collections API](https://dev.wix.com/docs/api-reference/business-solutions/cms/collection-management/data-collections/introduction) — plugin management
|
|
285
|
+
- [CMS Data Items CRUD](cms-data-items-crud.md) — insert/update/patch/delete/query shapes
|
|
286
|
+
- [CMS Schema Management](cms-schema-management.md) — creating and modifying collections
|
|
287
|
+
- [Wix Data and Eventual Consistency](https://dev.wix.com/docs/api-reference/business-solutions/cms/eventual-consistency)
|
|
@@ -112,6 +112,31 @@ curl -X GET \
|
|
|
112
112
|
}
|
|
113
113
|
```
|
|
114
114
|
|
|
115
|
+
This works for `displayName`/`displayField`. **Permission updates currently fail with `WDE0075: Not recognized role provided in permissions.`** Use the full-replace endpoint below to update a collection's permissions.
|
|
116
|
+
|
|
117
|
+
**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
|
+
|
|
119
|
+
**Endpoint**: `PUT /wix-data/v2/collections`
|
|
120
|
+
|
|
121
|
+
```json
|
|
122
|
+
{
|
|
123
|
+
"collection": {
|
|
124
|
+
"id": "Products",
|
|
125
|
+
"revision": "3",
|
|
126
|
+
"displayName": "Product Catalog",
|
|
127
|
+
"fields": [ /* the collection's full current non-system fields, from GET */ ],
|
|
128
|
+
"permissions": {
|
|
129
|
+
"insert": "ADMIN",
|
|
130
|
+
"update": "ADMIN",
|
|
131
|
+
"remove": "ADMIN",
|
|
132
|
+
"read": "SITE_MEMBER"
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
Don't delete and recreate a collection just to change its permissions — this full-replace call is the working path.
|
|
139
|
+
|
|
115
140
|
## Field Types Reference
|
|
116
141
|
|
|
117
142
|
| Type | Description | Example Value |
|
|
@@ -122,7 +147,7 @@ curl -X GET \
|
|
|
122
147
|
| `DATE` | Date only | `"2024-01-15"` |
|
|
123
148
|
| `DATETIME` | Date and time | `{ "$date": "2024-01-15T10:00:00.000Z" }` |
|
|
124
149
|
| `IMAGE` | Image reference | `"wix:image://v1/..."` |
|
|
125
|
-
| `MEDIA_IMAGE` | Wix Media Image | `{ "url": "http://...", "height": 640, "width": 480, "
|
|
150
|
+
| `MEDIA_IMAGE` | Wix Media Image | `{ "id": "<mediaId>", "url": "http://...", "height": 640, "width": 480, "altText": "Picture" }` |
|
|
126
151
|
| `MEDIA_VECTOR_ART` | Wix Media Vector Art | `{ "uri": "wix:vector://v1/...", "viewBox": "0 0 100 100", "contentType": "shape", "svgContent": "<svg>...</svg>" }` |
|
|
127
152
|
| `URL` | Web URL | `"https://example.com"` |
|
|
128
153
|
| `RICH_TEXT` | HTML content | `"<p>Rich text</p>"` |
|
|
@@ -138,8 +163,15 @@ curl -X GET \
|
|
|
138
163
|
| `ANYONE` | All visitors (including anonymous) |
|
|
139
164
|
| `SITE_MEMBER` | Logged-in site members |
|
|
140
165
|
| `SITE_MEMBER_AUTHOR` | Members who created the item |
|
|
166
|
+
| `PRIVILEGED` | Access to collection is controlled per role |
|
|
141
167
|
| `ADMIN` | Site admins only |
|
|
142
168
|
|
|
169
|
+
## Error Handling
|
|
170
|
+
|
|
171
|
+
| Error | Cause | Solution |
|
|
172
|
+
|-------|-------|----------|
|
|
173
|
+
| `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
|
+
|
|
143
175
|
## Related Documentation
|
|
144
176
|
|
|
145
177
|
- [Data Collections API Reference](https://dev.wix.com/docs/api-reference/business-solutions/cms/collection-management/data-collections/introduction)
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: "Contacts Dashboard Navigation"
|
|
3
|
+
description: "Builds direct links to Wix Contacts (CRM) dashboard pages on manage.wix.com — the contacts list, a specific contact's view page, contact import, and the segments page. Pairs each main contacts entity with its read API so you can fetch an entity and hand back a 'view it in your dashboard' link. Use when the user asks where something is in the Wix dashboard, wants a direct link to a dashboard page, or you need a dashboard URL to include with the result of an API operation."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Contacts Dashboard Navigation
|
|
7
|
+
|
|
8
|
+
Build direct links into the contacts (CRM) pages of a site's dashboard. For the general URL contract (metaSiteId, fallbacks, redirects), see [Dashboard Navigation](../dashboard-navigation/dashboard-navigation.md).
|
|
9
|
+
|
|
10
|
+
Contacts pages are split across **two apps** with two URL namespaces:
|
|
11
|
+
|
|
12
|
+
- **Contacts** (`74bff718-5977-47f2-9e5f-a9fd0047fd1f`) — the contact list, contact view, and import. Routes under `contacts/`.
|
|
13
|
+
- **Segments** (`ee070097-0850-4f23-ad8c-3cdd4efd5244`) — contact segments. Routes under `segments/`.
|
|
14
|
+
|
|
15
|
+
## Contacts Pages
|
|
16
|
+
|
|
17
|
+
| Page | URL after `/dashboard/{metaSiteId}/` | What it manages |
|
|
18
|
+
|---|---|---|
|
|
19
|
+
| Contacts list | `contacts` | All contacts (filter, label, search) |
|
|
20
|
+
| Contact view | `contacts/view/{contactId}` | A specific contact's details and activity |
|
|
21
|
+
| Import contacts | `contacts/contacts/import` | Import contacts (CSV, Gmail) |
|
|
22
|
+
|
|
23
|
+
Older `contacts/import` links redirect to the current import route.
|
|
24
|
+
|
|
25
|
+
## Segments Pages
|
|
26
|
+
|
|
27
|
+
| Page | URL after `/dashboard/{metaSiteId}/` | What it manages |
|
|
28
|
+
|---|---|---|
|
|
29
|
+
| Segments | `segments` | Contact segments (saved smart filters over contacts) |
|
|
30
|
+
|
|
31
|
+
## Pairing Entities with Their Read APIs
|
|
32
|
+
|
|
33
|
+
Fetch the entity via REST, then link the matching dashboard page. All calls use `https://www.wixapis.com` with an `Authorization` header.
|
|
34
|
+
|
|
35
|
+
| Entity | Read API | Dashboard link |
|
|
36
|
+
|---|---|---|
|
|
37
|
+
| Contact | `POST /contacts/v4/contacts/query` · `GET /contacts/v4/contacts/{id}` | `contacts/view/{contactId}` (view) or `contacts` (list) |
|
|
38
|
+
| Label | `GET /contacts/v4/labels` · `POST /contacts/v4/labels/query` | `contacts` (labels filter the contacts list) |
|
|
39
|
+
| Segment | Segments API (no public REST read endpoint) | `segments` |
|
|
40
|
+
|
|
41
|
+
Example — after creating a contact, hand back its view link:
|
|
42
|
+
|
|
43
|
+
```
|
|
44
|
+
Created contact "Dana Cohen".
|
|
45
|
+
View them here: https://manage.wix.com/dashboard/{metaSiteId}/contacts/view/{contactId}
|
|
46
|
+
```
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: "Create a Contact"
|
|
3
|
+
description: Creates a contact with the Contacts API. Covers the minimum identifying fields, the single-object shape of `email` and `phone`, and adding a physical address with the ISO 3166-2 subdivision format required for state, region, and province codes.
|
|
4
|
+
---
|
|
5
|
+
# Create a Contact
|
|
6
|
+
|
|
7
|
+
## Description
|
|
8
|
+
Creates a contact, optionally with a physical address in the same call.
|
|
9
|
+
|
|
10
|
+
## API Endpoint
|
|
11
|
+
`POST https://www.wixapis.com/contacts/v5/contacts`
|
|
12
|
+
|
|
13
|
+
## Steps
|
|
14
|
+
|
|
15
|
+
### 1. Create the contact
|
|
16
|
+
|
|
17
|
+
At least one of `name.first`, `name.last`, `email.email`, or `phone.phone` must be present. Copy this body and change the values:
|
|
18
|
+
|
|
19
|
+
```json
|
|
20
|
+
{
|
|
21
|
+
"contact": {
|
|
22
|
+
"name": { "first": "Maria", "last": "Gomez" },
|
|
23
|
+
"email": { "email": "maria.gomez@example.com" },
|
|
24
|
+
"phone": { "phone": "+1 212 555 0134" }
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
`email` is a single object, exactly as above. Send a list instead — `emails: [{ tag: 'MAIN', email: '…' }]` — and the request still returns `200`, but the field is discarded: the contact is created with no email at all. Nothing in the response reports this, so it surfaces only when something later reads the contact back and the email is missing. The same holds for `phone`. Read `contact.email.email` off the create response to confirm it was stored.
|
|
30
|
+
|
|
31
|
+
### 2. Add an address (optional)
|
|
32
|
+
|
|
33
|
+
Include `addresses` in the same create call when the user gave a street address:
|
|
34
|
+
|
|
35
|
+
```json
|
|
36
|
+
{
|
|
37
|
+
"contact": {
|
|
38
|
+
"name": { "first": "Maria", "last": "Gomez" },
|
|
39
|
+
"email": { "email": "maria.gomez@example.com" },
|
|
40
|
+
"addresses": [
|
|
41
|
+
{
|
|
42
|
+
"tag": "HOME",
|
|
43
|
+
"address": {
|
|
44
|
+
"addressLine": "350 Fifth Avenue",
|
|
45
|
+
"city": "New York",
|
|
46
|
+
"subdivision": "US-NY",
|
|
47
|
+
"postalCode": "10118",
|
|
48
|
+
"country": "US"
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
]
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
`addresses[].address` takes either `addressLine` as free text, or a structured `streetAddress` object — not both.
|
|
57
|
+
|
|
58
|
+
`tag` is one of `OTHER`, `HOME`, `WORK`, `BILLING`, `SHIPPING`, and that list is closed — there is no "untagged" or "none" member. When the user did not say what kind of address it is, leave `tag` out and it defaults to `OTHER`; inventing a value for that case is rejected with `400`.
|
|
59
|
+
|
|
60
|
+
### 3. Write `subdivision` in ISO 3166-2 form
|
|
61
|
+
|
|
62
|
+
`subdivision` is the 2-letter country code, a hyphen, then 1-3 characters for the state, region, prefecture or province: `US-NY`, `GB-ENG`, `FR-976`. A bare state code is rejected:
|
|
63
|
+
|
|
64
|
+
```
|
|
65
|
+
HTTP 400 {"message":"contact is invalid:
|
|
66
|
+
`-- addresses [at index 0] is invalid:
|
|
67
|
+
`-- address is invalid:
|
|
68
|
+
`-- subdivision is not a valid subdivision code",
|
|
69
|
+
"details":{"validationError":{"fieldViolations":[{
|
|
70
|
+
"field":"contact.addresses[0].address.subdivision",
|
|
71
|
+
"description":"is not a valid subdivision code","violatedRule":"FORMAT",
|
|
72
|
+
"data":{"type":"SUBDIVISION"}}]}}}
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
The Create Contact reference describes this field as a "short code (2 or 3 letters)" and gives `NY` as the example, which the server does not accept. Use the hyphenated form.
|
|
76
|
+
|
|
77
|
+
`country` is the plain [ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) code — `US`, no hyphen. Only `subdivision` carries the country prefix.
|
|
78
|
+
|
|
79
|
+
## Related
|
|
80
|
+
|
|
81
|
+
- [Create Contact](https://dev.wix.com/docs/api-reference/crm/members-contacts/contacts/contacts-v5/create-contact)
|
|
82
|
+
- [Update Contact](https://dev.wix.com/docs/api-reference/crm/members-contacts/contacts/contacts-v5/update-contact)
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: "Update a Contact"
|
|
3
|
+
description: Updates an existing contact's email, phone, name, or address with the Contacts API. Covers locating the contact when the user identifies it by name, passing its current revision, and the ISO 3166-2 subdivision format required for state, region and province codes.
|
|
4
|
+
---
|
|
5
|
+
# Update a Contact
|
|
6
|
+
|
|
7
|
+
## Description
|
|
8
|
+
Changes fields on a contact that already exists — its email, phone, name, or address.
|
|
9
|
+
|
|
10
|
+
## API Endpoints
|
|
11
|
+
- `POST https://www.wixapis.com/contacts/v5/contacts/search` — locate the contact
|
|
12
|
+
- `PATCH https://www.wixapis.com/contacts/v5/contacts/{contactId}` — change its fields
|
|
13
|
+
- `POST https://www.wixapis.com/contacts/v5/contacts/{contactId}/addresses` — add one address
|
|
14
|
+
|
|
15
|
+
Contacts has two live versions. Use the v5 endpoints above for updates; the v4 update takes a
|
|
16
|
+
different, more deeply nested body, and mixing the two shapes is rejected with
|
|
17
|
+
`400 {"message":"Expected an object"}`.
|
|
18
|
+
|
|
19
|
+
## Steps
|
|
20
|
+
|
|
21
|
+
### 1. Locate the contact with Search Contacts, not Query Contacts
|
|
22
|
+
|
|
23
|
+
When the user identifies a contact by name — "my contact Jordan Lee" — the lookup is Search
|
|
24
|
+
Contacts. Query Contacts filters on a small closed set of fields that does not include the
|
|
25
|
+
contact's name, so a query filtered by name is rejected:
|
|
26
|
+
|
|
27
|
+
```
|
|
28
|
+
HTTP 400 {"message":"value Field 'name.first' is not declared as filterable",
|
|
29
|
+
"details":{"validationError":{"fieldViolations":[{"field":"value",
|
|
30
|
+
"description":"Field 'name.first' is not declared as filterable"}]}}}
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Search Contacts takes a free-text expression, and matches on names. Note the doubled `search` —
|
|
34
|
+
the outer one is the search request, the inner one is the free-text clause:
|
|
35
|
+
|
|
36
|
+
```json
|
|
37
|
+
{ "search": { "search": { "expression": "Jordan Lee" } } }
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Read both `id` and `revision` off the contact it returns. Step 2 needs both. Query Contacts is
|
|
41
|
+
still the right call when you already have an email address, a phone number or an id to filter on.
|
|
42
|
+
|
|
43
|
+
### 2. Send the update with the contact's current revision
|
|
44
|
+
|
|
45
|
+
Copy this body and change the values. Only the fields you send are being set; `id` and `revision`
|
|
46
|
+
identify which contact and which version you are updating:
|
|
47
|
+
|
|
48
|
+
```json
|
|
49
|
+
{
|
|
50
|
+
"contact": {
|
|
51
|
+
"id": "<contact id from step 1>",
|
|
52
|
+
"revision": "<revision from step 1>",
|
|
53
|
+
"email": { "email": "jordan.lee@newmail.com" }
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Swap `email` for `phone` (`{ "phone": { "phone": "+1-212-555-0100" } }`) or `name` to change those
|
|
59
|
+
instead. `revision` changes on every write, so re-read it if an update conflicts.
|
|
60
|
+
|
|
61
|
+
### 3. Add an address with Add Contact Address
|
|
62
|
+
|
|
63
|
+
To attach one more address, post it to the contact's `addresses` sub-resource rather than sending
|
|
64
|
+
the whole contact — the address is appended, so existing addresses survive:
|
|
65
|
+
|
|
66
|
+
```json
|
|
67
|
+
{
|
|
68
|
+
"revision": "<revision from step 1>",
|
|
69
|
+
"address": {
|
|
70
|
+
"address": {
|
|
71
|
+
"addressLine": "350 Fifth Avenue",
|
|
72
|
+
"city": "New York",
|
|
73
|
+
"subdivision": "US-NY",
|
|
74
|
+
"postalCode": "10118",
|
|
75
|
+
"country": "US"
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
Note the doubled `address` here too: the outer object is the contact's address entry, which can
|
|
82
|
+
carry a `tag`, and the inner one is the postal address itself.
|
|
83
|
+
|
|
84
|
+
`tag` is one of `OTHER`, `HOME`, `WORK`, `BILLING`, `SHIPPING`, and that list is closed — there is
|
|
85
|
+
no "untagged" or "none" member. When the user did not say what kind of address it is, leave `tag`
|
|
86
|
+
out, exactly as above; inventing a value for that case is rejected:
|
|
87
|
+
|
|
88
|
+
```
|
|
89
|
+
HTTP 400 {"message":"address is invalid:
|
|
90
|
+
`-- tag enum must be in [UNKNOWN_ADDRESS_TAG(0), OTHER(1), HOME(2), WORK(3), BILLING(4), SHIPPING(5)]"}
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### 4. Write `subdivision` in ISO 3166-2 form
|
|
94
|
+
|
|
95
|
+
`subdivision` is the 2-letter country code, a hyphen, then 1-3 characters for the state, region,
|
|
96
|
+
prefecture or province: `US-NY`, `GB-ENG`, `FR-976`. A bare state code is rejected, on updates as
|
|
97
|
+
well as on creates:
|
|
98
|
+
|
|
99
|
+
```
|
|
100
|
+
HTTP 400 {"message":"address is invalid:
|
|
101
|
+
`-- address is invalid:
|
|
102
|
+
`-- subdivision is not a valid subdivision code",
|
|
103
|
+
"details":{"validationError":{"fieldViolations":[{
|
|
104
|
+
"field":"address.address.subdivision",
|
|
105
|
+
"description":"is not a valid subdivision code","violatedRule":"FORMAT",
|
|
106
|
+
"data":{"type":"SUBDIVISION"}}]}}}
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
The Contacts reference describes this field as a "short code (2 or 3 letters)" and gives `NY` as
|
|
110
|
+
the example, which the server does not accept. Use the hyphenated form.
|
|
111
|
+
|
|
112
|
+
`country` is the plain [ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) code
|
|
113
|
+
— `US`, no hyphen. Only `subdivision` carries the country prefix.
|
|
114
|
+
|
|
115
|
+
## Related
|
|
116
|
+
|
|
117
|
+
- [Update Contact](https://dev.wix.com/docs/api-reference/crm/members-contacts/contacts/contacts-v5/update-contact)
|
|
118
|
+
- [Search Contacts](https://dev.wix.com/docs/api-reference/crm/members-contacts/contacts/contacts-v5/search-contacts)
|
|
119
|
+
- [Add Contact Address](https://dev.wix.com/docs/api-reference/crm/members-contacts/contacts/contacts-v5/add-contact-address)
|