Unable to infer object type from:
jonjieviduya opened this issue · comments
I'm currently getting the same error as #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
Hi @jonjieviduya .
Workable example:
$company = $hubSpot->crm()->companies()->basicApi()->getById(
'2493047614',
['name', 'city', 'country', 'description', 'industry', 'external_id'],
'external_id'
);
Hi @jonjieviduya . Workable example:
$company = $hubSpot->crm()->companies()->basicApi()->getById( '2493047614', ['name', 'city', 'country', 'description', 'industry', 'external_id'], 'external_id' );
@ksvirkou-hubspot When I tried to remove the false
value, it returns 404 Not Found
error. I think you're using the company id's value instead of the external id's value.
Workable example:
$company = $hubSpot->crm()->companies()->basicApi()->getById(
'361',
['name', 'city', 'country', 'description', 'industry', 'external_id'],
null,
null,
false,
'external_id'
);