Skip to main content

getById()

Get a record by id.

const { data, error } = await kontenbase.service('posts').getById('605a251d7b8678bf6811k3b1')

Response

NameTypeDescription
res.dataobjectResponse for data
res.statusnumberResponse for status code
res.statusTextstringResponse for status message
res.errorobjectResponse for error occurred
note

Get a record with filters:

  • select
const { data, error } = await kontenbase.service('posts').getById('605a251d7b8678bf6811k3b1', {
select: ['name'],
})
  • lookup
const { data, error } = await kontenbase.service('posts').getById('605a251d7b8678bf6811k3b1', {
lookup: ['categories'],
})