Get record by ID
Complete the tutorial setup.
The "getRecordsById"
action is the best way to retrieve records using primary keys and foreign keys. It uses the id property to return one or more records from a table. The JSON DB API always creates a table with the id property, but some other APIs may not. For tables created without an "id"
property, the "getRecordsById"
action allows you to use the table’s primary key to retrieve records.
This procedure returns two records from the "athlete"
table with "id"
values of 1
and 3
.
Paste this code into the API Request editor.
{ "api": "db", "action": "getRecordsByIds", "params": { "tableName": "athlete", "ids": [1,3] }, "authToken": "clickApplyDefaultsToReplaceThisWithValidAuthToken" }
Click Apply defaults to JSON request () to set the
"authToken"
to a valid value.Click Send request ().
Verify the action completed successfully.
Note
"errorCode"
with a value of0
indicates success."errorCode"
with a non-zero value indicates a failure. See Errors and contact FairCom for more information about an error.