When calling batch/read endpoints (e.g. /crm/v3/objects/companies/batch/read) with a custom idProperty, HubSpot's API correctly returns an HTTP 207 Multi-Status response when some IDs are found and others are not (mixed success/error results in results + errors arrays).
However, the SDK does not handle the 207 status code in its response switch statements (readWithHttpInfo in BatchApi.php), causing the partial results to be lost or the response to be mishandled, even though the underlying HubSpot API call succeeds and contains valid data.
Steps to Reproduce
- Make a raw HTTP call to
https://api.hubapi.com/crm/v3/objects/companies/batch/read?archived=false with:
{
"idProperty": "YOUR_CUSTOM_ID_PROPERTY",
"inputs": [{ "id": "EXISTING_ID" }, { "id": "NON_EXISTING_ID" }],
"properties": ["WHATEVER_YOU_NEED_IN_RESPONSE"]
}
In this case, API returns HTTP 207 with both results (for EXISTING_ID) and errors (for NON_EXISTING_ID).
- Make the same call via the SDK:
$hubspotClient->crm()->companies()->batchApi()->read(
$batchReadInputSimplePublicObjectId,
false
);
Here, we only get the errors, and not the objects that exist on HubSpot.
Expected Behavior
The SDK should handle HTTP 207 the same way it handles 200 — deserializing into BatchResponseSimplePublicObject, which already supports both results and errors fields.
Relevant Code
In src/Crm/Companies/Api/BatchApi.php, readWithHttpInfo():
switch($statusCode) {
case 200:
return $this->handleResponseWithDataType(
'\HubSpot\Client\Crm\Companies\Model\BatchResponseSimplePublicObject',
$request,
$response,
);
default:
return $this->handleResponseWithDataType(
'\HubSpot\Client\Crm\Companies\Model\Error',
$request,
$response,
);
}
207 falls into default and is deserialized as Error, even though the response body is a valid BatchResponseSimplePublicObject with partial results.
hubspot/api-client:version: ^14
php version: ^8
When calling batch/read endpoints (e.g. /crm/v3/objects/companies/batch/read) with a custom idProperty, HubSpot's API correctly returns an HTTP 207 Multi-Status response when some IDs are found and others are not (mixed success/error results in results + errors arrays).
However, the SDK does not handle the 207 status code in its response switch statements (readWithHttpInfo in BatchApi.php), causing the partial results to be lost or the response to be mishandled, even though the underlying HubSpot API call succeeds and contains valid data.
Steps to Reproduce
https://api.hubapi.com/crm/v3/objects/companies/batch/read?archived=falsewith:In this case, API returns HTTP 207 with both results (for EXISTING_ID) and errors (for NON_EXISTING_ID).
Here, we only get the errors, and not the objects that exist on HubSpot.
Expected Behavior
The SDK should handle HTTP 207 the same way it handles 200 — deserializing into BatchResponseSimplePublicObject, which already supports both results and errors fields.
Relevant Code
In src/Crm/Companies/Api/BatchApi.php, readWithHttpInfo():
207 falls into default and is deserialized as Error, even though the response body is a valid BatchResponseSimplePublicObject with partial results.
hubspot/api-client:version: ^14
php version: ^8