APIs & Integrations

GBagrowski
Membro

Private App Key Migration: Cannot deserialize value of type `java.lang.String (truncated...

Hi,

 

Trying to migrate to using the Private App Key. 

Running 

$client->crm()->contacts()->batchApi()->create()

for a list of "inputs" created like:

$property = [
'email' => $email,
'properties' => [
[
'property' => $customPropertyField1,
'value' => $value1,
],//...
],
];
$batch[] = new SimplePublicObjectInput(['properties' => $property]);
// ... above loop finishes
$BatchInputSimplePublicObjectInput = new BatchInputSimplePublicObjectInput(['inputs' => $batch,]);
$apiResponse = $client->crm()->contacts()->batchApi()->create($BatchInputSimplePublicObjectInput);

Getting the following exception info:

[400] Client error: `POST https://api.hubapi.com/crm/v3/objects/contacts/batch/create` resulted in a `400 Bad Request` response:
{"status":"error","message":"Invalid input JSON on line 1, column 75: Cannot deserialize value of type `java.lang.String (truncated...)

 

Am I doing something wrong above? 

Or is it that I'm using the old data format rather than what I see at https://developers.hubspot.com/docs/api/crm/contacts ?

Do I need to perform the create for the custom properties, or should they exist still regardless of the migration?

 

Thanks,

Glenn

0 Avaliação positiva
2 Respostas 2
EDash
Participante

Private App Key Migration: Cannot deserialize value of type `java.lang.String (truncated...

The JSON is different in V3 than V1. On the same documentation page that is snapped above, scroll down and look at the Response example. It shows properly formatted JSON. It no longer has property & value. So, skimura was on the right track. 

0 Avaliação positiva
skimura
Top colaborador(a) | Parceiro Platinum
Top colaborador(a) | Parceiro Platinum

Private App Key Migration: Cannot deserialize value of type `java.lang.String (truncated...

@GBagrowski 

 

Hi. 

 

Input parameter format might be wrong.

// before
$property = [
    'email' => $email,
    'properties' => [
        [
            'property' => $customPropertyField1,
            'value' => $value1,
        ],//...
    ],
];

// after (reference sample code uses this.)
$properties1 = [
    'company' => 'Biglytics',
    'email' => 'bcooper@biglytics.net',
    ...,
];

 

 How about use API 'test call' ? It is very helpful.

 

スクリーンショット 2022-10-13 19.30.14.png

 

Thanks.