Error: Cannot Deserialize

NSaad
メンバー

I'd like to know why the following request fails with this error. It's not clear as to what's going on, as it matches the expected format.

 

Error:

`{"status":"error","message":"Invalid input JSON on line 1, column 17: Cannot deserialize value of type `java.util.ArrayList<com.hubspot.crmpublic.core.models.associations.PublicAssociationsForObject>` from Object value (token `JsonToken.START_OBJECT`)","correlationId":"REDACTED"}`

 

Request Sent (Sent as one line, but multiline here for ease of viewing):

```

{
"inputs": [
{
"idProperty": "email",
"id": "aaa@aaa.com",
"properties": {
"email": "aaa@aaa.com",
"firstname": "Aaa",
"lastname": "Bbb",
"address": "123 Main St",
"city": "Edmonton",
"state": "AB ",
"zip": "T6W2R6",
"phone": "+11231231234"
}
}
]
}

```

This page shows the following sample format: https://developers.hubspot.com/beta-docs/guides/api/crm/objects/contacts#upsert-contacts

 

```

// Example request body with email
// POST /crm/v3/objects/contacts/batch/upsert
{
"inputs": [
{
"properties": {
"phone": "5555555555"
},
"id": "test@test.com",
"idProperty": "email"
},
{
"properties": {
"phone": "7777777777"
},
"id": "example@hubspot.com",
"idProperty": "email"
}
]
}

```

 

Please note that I have tried truncating the properties to just send the email. So, it's not that. Any help is greatly appreciated.

0 いいね!
1件の承認済みベストアンサー
GiantFocal
解決策
トップ投稿者 | Gold Partner
トップ投稿者 | Gold Partner

Hi @NSaad,

 

You'll need to ensure your request follows the exact format from the HubSpot API documentation:

 

{
  "inputs": [
    {
      "properties": {
        "phone": "5555555555"
      },
      "id": "test@test.com",
      "idProperty": "email"
    }
  ]
}

 

The order of properties in the request matters. You should put properties first, followed by id and idProperty. Also, remember to remove any extra whitespace or formatting.

Glad I could help.
Solving HubSpot puzzles is what we do.
Ernesto // GiantFocal


Found this answer helpful?
Marking it as the solution helps both the community and me - thanks in advance!

元の投稿で解決策を見る

1件の返信 1
GiantFocal
解決策
トップ投稿者 | Gold Partner
トップ投稿者 | Gold Partner

Hi @NSaad,

 

You'll need to ensure your request follows the exact format from the HubSpot API documentation:

 

{
  "inputs": [
    {
      "properties": {
        "phone": "5555555555"
      },
      "id": "test@test.com",
      "idProperty": "email"
    }
  ]
}

 

The order of properties in the request matters. You should put properties first, followed by id and idProperty. Also, remember to remove any extra whitespace or formatting.

Glad I could help.
Solving HubSpot puzzles is what we do.
Ernesto // GiantFocal


Found this answer helpful?
Marking it as the solution helps both the community and me - thanks in advance!