I'm currently getting the same error as https://github.com/HubSpot/hubspot-api-php/issues/128, but in my case I'm using the Read endpoint. Please see my code below.
Code
$client = Factory::createWithAccessToken($accessToken);
try {
$apiResponse = $client->crm()->companies()->basicApi()->getById('361', [
'name', 'city', 'country', 'description', 'industry', 'external_id'
], false, 'external_id');
return response()->json($apiResponse);
} catch (ApiException $e) {
return response()->json($e->getMessage());
}
Error
Unable to infer object type from: external_id
Laravel version: 9
Hubspot API Client version: 9.2