The "primaryKeys" property specifies primary keys to use as search criteria and to show the results found. This property is optional with a default of "null" unless "ids" is omitted.
-
"primaryKeys"is best used if tables were created with primary keys composed of multiple fields. If primary keys are composed of a single field, it is best to use"ids".- Tables created using JSON DB API actions cannot create primary keys composed of multiple fields.
- A table must have a primary key defined in order to use
"primaryKeys". - The
"primaryKeys"property is mutually exclusive with the"ids"property, meaning it is required when"ids"is omitted, or an error is returned if both have values. - The
"primaryKeys"property is an array of arrays.- The outer array contains one or more primary key definitions, enabling the server to retrieve multiple records simultaneously.
- Each inner array is a primary key definition that specifies the values the server needs to retrieve one matching record.
- A primary key definition consists of one or more objects where each object is a field-value pair that uses the following structure
({ "fieldName": "someField","value": "someValue" }).
If your table uses the "first_name" and "last_name" fields as the primary key, the following "primaryKeys" property will retrieve two records.
Note If your table does not have a primary key, its records cannot be retrieved, updated or deleted using the
"getRecordsByIds","updateRecords"and"deleteRecords"actions. OthergetRecordsactions can query its records.
"primaryKeys":
[
[
{ "fieldName": "first_name", "value": "Sam" },
{ "fieldName": "last_name", "value": "I-am" }
],
[
{ "fieldName": "first_name", "value": "The Cat" },
{ "fieldName": "last_name", "value": "in the Hat" }
]
]