Search...
Insert Item
Insert a new item into a collection.
POST
https://example.com/data/insert
Body Params
NAME
TYPE
DESCRIPTION
collectionName
string
The collection or table to insert into.
item
struct
An object containing the item to be inserted.
requestContext
_com_wixpress_cloud_externaldb_api_RequestContext
The request context object.
Response Object
Status/Error Codes:
400 - Invalid item, Constraint violation.
409 - Item already exists.
NAME
TYPE
DESCRIPTION
item
struct
An object containing the inserted object.
Was this helpful?
Insert an item into a collection.
Request
curl
Copy Code
1curl -X POST 'https://mysql-adapter.com/data/insert' \2--header 'Content-Type: application/json' \3--data-raw '{4 "requestContext": {5 "settings": {6 "secretKey": "mySecureSecret"7 },8 "instanceId": "12a345b6-7890-98d7-65e4-f321abc1de23",9 "installationId": "987fe654-3d21-4def-ab5c-6d78e90f123a",10 "memberId": "77aa88bb-2c2c-d3d3-4e4e-ff55aa66bb77",11 "role": "OWNER"12 },13 "collectionName": "car",14 "item": {15 "_id": "12345678-abcd-9876-fedc-a9876543210",16 "_owner": "77aa88bb-2c2c-d3d3-4e4e-ff55aa66bb77",17 "make": "BMW",18 "model": "i8",19 "year": 2020,20 "date_added": {21 "$date": "2020-01-01T21:00:00.000Z"22 }23 }24}'
Response
json
12{"item": {3 "_id": "12345678-abcd-9876-fedc-a9876543210",4 "_owner": "77aa88bb-2c2c-d3d3-4e4e-ff55aa66bb77",5 "make": "BMW",6 "model": "i8",7 "year": 2020,8 "date_added": {"$date": "2020-01-01T21:00:00.000Z"}9}}