Count the number of items that match a filter.
The collection or table to be queried
The number of items in the collection that match the query filter.
curl -X POST 'https://mysql-adapter.com/data/count' \
--header 'Content-Type: application/json' \
--data-raw '{
"requestContext": {
"settings": {
"secretKey": "mySecureSecret"
},
"instanceId": "12a345b6-7890-98d7-65e4-f321abc1de23",
"installationId": "987fe654-3d21-4def-ab5c-6d78e90f123a",
"memberId": "77aa88bb-2c2c-d3d3-4e4e-ff55aa66bb77",
"role": "OWNER"
},
"collectionName": "car",
"filter": {
"operator": "$contains",
"fieldName": "make",
"value": "Hyundai"
}
}'
{ "totalCount": 2 }
This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.
Get a list of items based on a filter
The number of items to skip from the first item.
The collection or table to be queried.
The maximum number of items to retrieve
A list of objects containing the retrieved items.
The total number of items matching the query filter.
curl -X POST 'https://mysql-adapter.com/data/find' \
--header 'Content-Type: application/json' \
--data-raw '{
"requestContext": {
"settings": {
"secretKey": "mySecureSecret"
},
"instanceId": "12a345b6-7890-98d7-65e4-f321abc1de23",
"installationId": "987fe654-3d21-4def-ab5c-6d78e90f123a",
"memberId": "77aa88bb-2c2c-d3d3-4e4e-ff55aa66bb77",
"role": "OWNER"
},
"collectionName": "car",
"filter": {
"operator": "$and",
"value": [
{
"operator": "$contains",
"fieldName": "make",
"value": "a"
},
{
"operator": "$gt",
"fieldName": "year",
"value": 2018
}
]
},
"sort": [
{
"fieldName": "year",
"direction": "asc"
}
],
"skip": 0,
"limit": 10000
}'
{
"items": [
{
"_id": "95953ca3-5fe5-4ce7-9cca-9bcc1ba64ba6",
"_owner": "77aa88bb-2c2c-d3d3-4e4e-ff55aa66bb77",
"make": "Toyota",
"model": "Corolla",
"year": 2019,
"date_added": { "$date": "2020-09-30T21:30:00.000Z" }
},
{
"_id": "20cd8f8d-1a0f-4530-91df-6d31fe9e83a5",
"_owner": "77aa88bb-2c2c-d3d3-4e4e-ff55aa66bb77",
"make": "Ferrari",
"model": "812GTS",
"year": 2020,
"date_added": { "$date": "2020-03-31T21:00:00.000Z" }
}
],
"totalCount": 2
}
This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.
Get an item based on its itemId
The collection or table to be queried.
An object containing the retrieved item
curl -X POST 'https://mysql-adapter.com/data/get' \
--header 'Content-Type: application/json' \
--data-raw '{
"requestContext": {
"settings": {
"secretKey": "mySecureSecret"
},
"instanceId": "12a345b6-7890-98d7-65e4-f321abc1de23",
"installationId": "987fe654-3d21-4def-ab5c-6d78e90f123a",
"memberId": "77aa88bb-2c2c-d3d3-4e4e-ff55aa66bb77",
"role": "OWNER"
},
"collectionName": "car",
"itemId": "86cbf595-d369-48bb-8649-c6c082c003ca"
}'
{
"item": {
"_id": "86cbf595-d369-48bb-8649-c6c082c003ca",
"_owner": "81c9168e-95b8-47fd-8e6a-ad9fdf71b38e",
"make": "Ford",
"model": "Mustang",
"year": 2001,
"date_added": { "$date": "2001-06-07T21:00:00.000Z" }
}
}
This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.
Insert a new item into a collection
The collection or table to be queried.
curl -X POST 'https://mysql-adapter.com/data/insert' \
--header 'Content-Type: application/json' \
--data-raw '{
"requestContext": {
"settings": {
"secretKey": "mySecureSecret"
},
"instanceId": "12a345b6-7890-98d7-65e4-f321abc1de23",
"installationId": "987fe654-3d21-4def-ab5c-6d78e90f123a",
"memberId": "77aa88bb-2c2c-d3d3-4e4e-ff55aa66bb77",
"role": "OWNER"
},
"collectionName": "car",
"item": {
"_id": "12345678-abcd-9876-fedc-a9876543210",
"_owner": "77aa88bb-2c2c-d3d3-4e4e-ff55aa66bb77",
"make": "BMW",
"model": "i8",
"year": 2020,
"date_added": {
"$date": "2020-01-01T21:00:00.000Z"
}
}
}'
{
"item": {
"_id": "12345678-abcd-9876-fedc-a9876543210",
"_owner": "77aa88bb-2c2c-d3d3-4e4e-ff55aa66bb77",
"make": "BMW",
"model": "i8",
"year": 2020,
"date_added": { "$date": "2020-01-01T21:00:00.000Z" }
}
}
This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.
Remove an item from a collection
The collection or table to delete from.
curl --X POST 'https://mysql-adapter.com/data/remove' \
--header 'Content-Type: application/json' \
--data-raw '{
"requestContext": {
"settings": {
"secretKey": "mySecureSecret"
},
"instanceId": "12a345b6-7890-98d7-65e4-f321abc1de23",
"installationId": "987fe654-3d21-4def-ab5c-6d78e90f123a",
"memberId": "77aa88bb-2c2c-d3d3-4e4e-ff55aa66bb77",
"role": "OWNER"
"collectionName": "car",
"itemId": "12345678-abcd-9876-fedc-a9876543210"
}'
{
"item": {
"_id": "12345678-abcd-9876-fedc-a9876543210",
"_owner": "77aa88bb-2c2c-d3d3-4e4e-ff55aa66bb77",
"make": "BMW",
"model": "i8",
"year": 2020,
"date_added": { "$date": "2020-01-01T21:00:00.000Z" }
}
}
This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.
Update an item in a collection.
The collection or table to insert into.
curl -X POST 'https://mysql-adapter.com/data/update' \
--header 'Content-Type: application/json' \
--data-raw '{
"requestContext": {
"settings": {
"secretKey": "mySecureSecret"
},
"instanceId": "12a345b6-7890-98d7-65e4-f321abc1de23",
"installationId": "987fe654-3d21-4def-ab5c-6d78e90f123a",
"memberId": "77aa88bb-2c2c-d3d3-4e4e-ff55aa66bb77",
"role": "OWNER"
},
"collectionName": "car",
"item": {
"_id": "86cbf595-d369-48bb-8649-c6c082c003ca",
"_owner": "77aa88bb-2c2c-d3d3-4e4e-ff55aa66bb77",
"model": "Mustang GTR"
}
}'
{
"item": {
"_id": "86cbf595-d369-48bb-8649-c6c082c003ca",
"_owner": "77aa88bb-2c2c-d3d3-4e4e-ff55aa66bb77",
"model": "Mustang GTR"
}
}
This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.