APIs & Integrations

Benchmark_achen
参加者

How to construct JSON codes to insert or update the contact Status property?

解決

Hi All,

I'm new to Hubspot.  I'm trying to POST some contact records from our database into Hubspot using Hubspot API.  It works with the basic property such as the contact last name, first name, email, phone, address, etc.  However, when I added the status property, it failed with the following message:

 

"Response Body: {"validationResults":[{"isValid":false,"message":"1 was not one of the allowed options: [label: \"Active\"\nvalue: \"active\"\nread_only: true\n, label: \"Inactive\"\nvalue: \"inactive\"\nread_only: true\n]","error":"INVALID_OPTION","name":"hs_content_membership_status"}],"status":"error","message":"Property values were not valid","correlationId":"5ae5251d-f999-485a-b9c8-a5f92007c4e5","requestId":"32dfc68887aaf82880cb58ec7f2980ee"}"

 

Here is the sample JSON record:

{
"properties": [
{
"property": "FirstName",
"value": "ABC"
},
{
"property": "LastName",
"value": "XYZ"
},
{
"property": "Email",
"value": "ABCXYZ@gmail.com"
},
{
"property": "Address",
"value": "54 Peirce Rd"
},
{
"property": "City",
"value": "Waltham"
},
{
"property": "State",
"value": "MA"
},
{
"property": "zip",
"value": "02420"
},
{
"property": "hs_content_membership_status",
"value": "1"
}
]
}

 

Here is the API that I use:

https://api.hubapi.com/contacts/v1/contact

 

Can someone tell me how to properly code the status property for posting?

 

Thanks,

Allan

0 いいね!
2件の承認済みベストアンサー
himanshurauthan
解決策
ソートリーダー | Elite Partner
ソートリーダー | Elite Partner

How to construct JSON codes to insert or update the contact Status property?

解決
Hello there,

You need to send the data as -

{
"property" : "hs_content_membership_status",
"value" : "active"
}

And same pattern when you have to mark inactive status, just change the value to inactive.

I hope this helps.

Thanks
Digital Marketing & Inbound Expert In Growth Hacking Technology

元の投稿で解決策を見る

Benchmark_achen
解決策
参加者

How to construct JSON codes to insert or update the contact Status property?

解決

That works! スマイリー ハッピー

 

Thank you very much!

--Allan

元の投稿で解決策を見る

4件の返信
himanshurauthan
ソートリーダー | Elite Partner
ソートリーダー | Elite Partner

How to construct JSON codes to insert or update the contact Status property?

解決
Hello there,

Everything is fine with your request. Just need to update the value that you are sending under status property. On hubspot for this property we have two options available and they are active or inactive. So in order to match drop-down select property value, we need a value from those options. Please try to send active for value 1 and inactive for value 0.

Thanks
Digital Marketing & Inbound Expert In Growth Hacking Technology
0 いいね!
Benchmark_achen
参加者

How to construct JSON codes to insert or update the contact Status property?

解決

I updated the JSON script for the status property with these codes:

 

{
"property": "hs_content_membership_status",
"active": "1",
"inactive": "0"
}

 

I was able post this record to Hubspot without error.  However, if I look at the Status property in the Hubspot app, the Status value is blank (I'm expecting it to indicate "Active").  I can manually change it to Active by select it from the dropdown and save, but that's not what I want to do.

 

Any suggestions?

 

Thanks,

Allan

0 いいね!
himanshurauthan
解決策
ソートリーダー | Elite Partner
ソートリーダー | Elite Partner

How to construct JSON codes to insert or update the contact Status property?

解決
Hello there,

You need to send the data as -

{
"property" : "hs_content_membership_status",
"value" : "active"
}

And same pattern when you have to mark inactive status, just change the value to inactive.

I hope this helps.

Thanks
Digital Marketing & Inbound Expert In Growth Hacking Technology
Benchmark_achen
解決策
参加者

How to construct JSON codes to insert or update the contact Status property?

解決

That works! スマイリー ハッピー

 

Thank you very much!

--Allan