Search
addItems
Add new items to this Collection, or update existing ones if their IDs match.
// Create a new item await collection.addItems([{ slug: "eric", fieldData: { [nameField.id]: { type: "string", value: "Eric" }, [ageField.id]: { type: "number", value: 47 }, }, }]) // Update an existing item await collection.addItems([{ id: "aBc123", slug: "bar" }])
If an
idis provided and matches an existing item, that item will be updated.Items without an
idare created as new records.slugshould be unique.
Omitted top-level fields remain unchanged. Supplied arrays replace their items and nested field data; include everything to keep. Reuse array item IDs to preserve matching localized values, or omit IDs to create new items. Each provided array item ID must be unique within that array value. Pass value: [] to clear an array.
Parameters
items:CollectionItemInput[]– An array of items to add or update.
Returns
Promise<void>