Search.../

Update Item

Update an item in a collection.

Syntax

function UpdateItem(collectionName: string, item: struct, requestContext: _com_wixpress_cloud_externaldb_api_RequestContext): Update<_com_wixpress_cloud_externaldb_api_UpdateResponse>

Update Item Parameters

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.

Returns

Status/Error Codes:
400 - Invalid item, Constraint violation.
404 - Item not found

Return Type:

_com_wixpress_cloud_externaldb_api_UpdateResponse
NAME
TYPE
DESCRIPTION
item
struct

An object containing the updated item.

Was this helpful?

Update an item in a collection.

Request

curl

Copy Code
1curl -X POST 'https://mysql-adapter.com/data/update' \
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": "86cbf595-d369-48bb-8649-c6c082c003ca",
16 "_owner": "77aa88bb-2c2c-d3d3-4e4e-ff55aa66bb77",
17 "model": "Mustang GTR"
18 }
19}'

Response

json

1
2{"item": {
3 "_id": "86cbf595-d369-48bb-8649-c6c082c003ca",
4 "_owner": "77aa88bb-2c2c-d3d3-4e4e-ff55aa66bb77",
5 "model": "Mustang GTR"
6}}