getById()
Get a record by id.
- Javascript
- Go
- PHP
- API
const { data, error } = await kontenbase.service('posts').getById('605a251d7b8678bf6811k3b1')
Response
Name | Type | Description |
---|---|---|
res.data | object | Response for data |
res.status | number | Response for status code |
res.statusText | string | Response for status message |
res.error | object | Response 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'],
})
resp, err := client.Service("posts").GetByID("605a251d7b8678bf6811k3b1")
Response
Name | Type | Description |
---|---|---|
resp.Data | map[string]interface{} | Response for data |
resp.Status | int | Response for status code |
resp.StatusText | string | Response for status message |
note
Get a record with filters:
- select
resp, err := client.Service("posts").GetByID("605a251d7b8678bf6811k3b1")
.SetSelect([]interface{}{"name", "notes"})
- lookup
resp, err := client.Service("posts").GetByID("605a251d7b8678bf6811k3b1")
.SetLookup("*")
$res = $kontenbase->service('posts')->getById('605a251d7b8678bf6811k3b1');
Response
Name | Type | Description |
---|---|---|
$res['data'] | object | Response for data |
$res['status'] | integer | Response for status code |
$res['statusText'] | string | Response for status message |
$res['error'] | object | Response for error occurred |
note
Get a record with filters:
- select
$res = $kontenbase->service('posts')->getById('605a251d7b8678bf6811k3b1')->([
'select' => ['name', 'notes']
]);
- lookup
$res = $kontenbase->service('posts')->getById('605a251d7b8678bf6811k3b1')->([
'lookup' => '*'
]);
[GET]
https://api.kontenbase.com/query/api/v1/API_KEY/posts/605a251d7b8678bf6811k3b1