Search.../

Get Item

Get an item based on its itemId.

Syntax

function GetItem(collectionName: string, itemId: string, requestContext: _com_wixpress_cloud_externaldb_api_RequestContext): Get<_com_wixpress_cloud_externaldb_api_GetResponse>

Get Item Parameters

NAME
TYPE
DESCRIPTION
collectionName
string

The collection or table to be queried.

itemId
string

The _id of the item to be retrieved.

requestContext
_com_wixpress_cloud_externaldb_api_RequestContext

The request context object.

Returns

Status/Error Codes:
404 - Item not found.

Return Type:

_com_wixpress_cloud_externaldb_api_GetResponse
NAME
TYPE
DESCRIPTION
item
struct

An object containing the retrieved item.

Was this helpful?

Get an item from a collection based on the _id field.

Request

curl

Copy Code
1curl -X POST 'https://mysql-adapter.com/data/get' \
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 "itemId": "86cbf595-d369-48bb-8649-c6c082c003ca"
15}'

Response

json

1
2{"item": {
3 "_id": "86cbf595-d369-48bb-8649-c6c082c003ca",
4 "_owner": "81c9168e-95b8-47fd-8e6a-ad9fdf71b38e",
5 "make": "Ford",
6 "model": "Mustang",
7 "year": 2001,
8 "date_added": {"$date": "2001-06-07T21:00:00.000Z"}
9}}