Updating a contact property via API

SOLVE
Highlighted
New Member

Hi there, 

 

I am trying to update a contact property via API, but I am getting errors constantly and I am not finding any help in the documentation. As such, the property in question has the following characteristics:

 

Its a multiple checkboxes property named Tags

 

My goal is to create a new checkbox item in the property ( I know that by adding one i erased the current ones)

What I am sending:

 

'https://api.hubapi.com/properties/v1/contacts/properties/named/tags?hapikey=xxxx',
                    {
                        'Content-type': 'application/json'
                    },
                    {
                        "name": "tags",
                        "groupName": "xpto_information",
                        "description": "",
                        "fieldType": "checkbox",
                        "formField": False,
                        "type": "enumeration",
                        "displayOrder": -1,
                        "label": "Tags",
                        "options": [
                            {
                                "label": "TestA",
                                "displayOrder": -1,
                                "hidden": False,
                                "readOnly": False,
                                "doubleData": False,
                                "description": False,
                                "value": "TestA"
                            }
                        ]
                    }

I am getting a 400 error invalid JSON input and cannot deserialize .....

Reply
0 Upvotes
1 Accepted solution

Accepted Solutions
HubSpot Employee

Hi @pquinta ,

In your payload I would recommend setting "doubleData" to null and also to ensure you are passing "false" instead of "False". For example I am able to successfully update a property using the payload below:

 

{
    "name": "tags",
    "description": "",
    "groupName": "contactinformation",
    "type": "enumeration",
    "fieldType": "checkbox",
    "formField": true,
    "options": [
        {
            "label": "TestA",
            "displayOrder": -1,
            "hidden": false,
            "readOnly": false,
            "doubleData": null,
            "description": "false",
            "value": "TestA"
        },
        {
            "label": "TestB",
            "displayOrder": -1,
            "hidden": false,
            "readOnly": false,
            "doubleData": null,
            "description": "false",
            "value": "TestB"
        }
    ],
    "createdUserId": null,
    "searchableInGlobalSearch": false
}

Which results in this property being updated in my portal:

tags.png

 

3 Replies 3
HubSpot Employee

Hi @pquinta ,

In your payload I would recommend setting "doubleData" to null and also to ensure you are passing "false" instead of "False". For example I am able to successfully update a property using the payload below:

 

{
    "name": "tags",
    "description": "",
    "groupName": "contactinformation",
    "type": "enumeration",
    "fieldType": "checkbox",
    "formField": true,
    "options": [
        {
            "label": "TestA",
            "displayOrder": -1,
            "hidden": false,
            "readOnly": false,
            "doubleData": null,
            "description": "false",
            "value": "TestA"
        },
        {
            "label": "TestB",
            "displayOrder": -1,
            "hidden": false,
            "readOnly": false,
            "doubleData": null,
            "description": "false",
            "value": "TestB"
        }
    ],
    "createdUserId": null,
    "searchableInGlobalSearch": false
}

Which results in this property being updated in my portal:

tags.png

 

New Member

Thanks a lot @jackcoldrick . It works now.

As I was using python I unconsciously replaced false with False and yeah almost certain that it was causing trouble.

HubSpot Employee

No worries @pquinta happy to help! Smiley Happy 

Reply
0 Upvotes