To fetch a single record by ID, use the Model::get method.
$model = $client->model('Contact');
$result = $model->get('7eba2a01-6cb6-f38c-d4c2-5a8fc2def9d2');
echo json_encode($result, JSON_PRETTY_PRINT);
2 "id": "7eba2a01-6cb6-f38c-d4c2-5a8fc2def9d2",
4 "date_entered": "2018-02-23 07:28:28",
5 "date_modified": "2018-02-23 07:28:28",
6 // ...... omited long list of fields
7 "photo_filename": null,
11 "livechat_activity": "0"
You can specify a list of fields you want returned:
$model = $client->model('Contact');
$result = $model->get(
'7eba2a01-6cb6-f38c-d4c2-5a8fc2def9d2',
['first_name', 'last_name', 'email1']
);
echo json_encode($result, JSON_PRETTY_PRINT);
2 "first_name": "Kristina",
3 "last_name": "Abramowitz",
4 "email1": "code.mobile.code@example.co.uk",
5 "id": "7eba2a01-6cb6-f38c-d4c2-5a8fc2def9d2"