insertDataItem( )


Deprecated

This method is deprecated and was replaced with insert.

Adds an item to a collection.

An item can only be inserted into an existing connection. You can create a new collection using the Data Collections API.

When an item is inserted into a collection, the item's ID is automatically assigned a random value. You can optionally provide a custom ID in dataItem.id when inserting the item. If you specify an ID that already exists in the collection, the insertion will fail.

If options.dataItem.data is empty, a new item is created with no data fields.

Authentication

This method may require higher-level permissions than the caller has, based on their identity and roles and permissions. In these cases, you can ensure the method is called with the required level of authorization by using one of the following:

Permissions
Write Data Items
Learn more about app permissions.
Method Declaration
Copy
Method Parameters
optionsInsertDataItemOptions

Options for adding an item to a collection.

Returns
Return Type:Promise<InsertDataItemResponse>
Errors

This method doesn't return any custom errors, but may return standard errors. Learn more about standard Wix errors.

Did this help?