APIs & Integrations

GBagrowski
Membro

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

resolver

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
1 Solução aceita
skimura
Solução
Top colaborador(a) | Parceiro Platinum
Top colaborador(a) | Parceiro Platinum

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

resolver

@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.

Exibir solução no post original

2 Respostas 2
EDash
Participante

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

resolver

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
Solução
Top colaborador(a) | Parceiro Platinum
Top colaborador(a) | Parceiro Platinum

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

resolver

@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.