我正在尝试获取在指定时间后最后修改的联系人列表,但我似乎无法正确处理。当我执行脚本时,我收到错误:
Invalid input JSON on line 1, column 17: Cannot deserialize value of type `java.util.HashSet` from Object value (token `JsonToken.START_OBJECT`)
当我测试发布数据时,它返回为有效的 JSON:
{"filterGroups":{"filters":{"value":1646144686,"propertyName":"lastmodifieddate","operator":"GT"}}}
我在这里和 HubSpot 的社区上都发现了一些类似错误的帖子,但没有适合我的解决方案。
我的代码是这样的:
$url = "https://api.hubapi.com/crm/v3/objects/contacts/search";
$api_key = 'xxxxxxxxxxxxxxxxxxxxx';
$range = strtotime("-1 hour");
$data = array(
"filterGroups" => array(
"filters" => array(
"value" => $range,
"propertyName" => "lastmodifieddate",
"operator" => "GT"
)
)
);
$post = json_encode($data);
$ch = curl_init($url . "?hapikey=" . $api_key);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
$response = curl_exec($ch);
curl_close($ch);
print_r(json_decode($response));
我也在 HubSpot 的社区论坛上发布了这个,但我总是在这里运气更好。对我做错的任何帮助将不胜感激。
从输出echo print_r($response);
stdClass Object (
[status] => error
[message] => Invalid input JSON on line 1, column 17: Cannot deserialize value of type java.util.HashSet from Object value (token JsonToken.START_OBJECT)
[correlationId] => 6737df28-b53c-4add-81ae-cd19b722e01c
)