APIs & Integrations

THa51
Member

Dropdown values in API

SOLVE

Hi,

I've been googling to see if there's a hubspot API to search for a contact's properties dropdown list of values via api. I know you can list all a contact's property's drop down, but is there a way to just search to see if there is a match for the drop down if the list is very long?

 

I am trying to see of drop down list values are case sensitive. Eg:

We have a custom contact field called "advert_source". The values for this field are pre-defined dropdown list of values.

 

I am trying to ascertain whether the values:

Facebook - Week

and 

Facebook - WEEK

are the same.

 

Meaning if the drop down list contains 

AAA

BBB

CCC

Facebook - Week

 

And in the api, I submit the value "Facebook - WEEK", should this fail?

 

Thanks.

 

0 Upvotes
2 Accepted solutions
BérangèreL
Solution
Community Manager
Community Manager

Dropdown values in API

SOLVE

Hi @THa51 and Happy Friday!

Thanks so much for sharing your question and for detailing your use case around dropdown property values and API behavior with the HubSpot Community.
 

To answer your main question: dropdown values in HubSpot are case sensitive.

So, if your “advert_source” dropdown property contains “Facebook - Week” (with a capital “W”), submitting “Facebook - WEEK” (all caps) via the API will generally result in a mismatch or error, as the exact value must match one of the defined options.

This applies both when updating a contact via the API and when searching for matching dropdown options.

Also, here is a documentation "CRM API | Properties" that can help you.

Now, let's check with our Top Experts: Hi @GRajput, @KhushbooP11 and @NMetnik do you know of a way via the HubSpot API to search for a specific value (rather than list all values) in a contact property’s dropdown list, especially if the list is very long, please?

Have a lovely weekend and thanks so much!
Bérangère





loop


Loop Marketing is a new four-stage approach that combines AI efficiency and human authenticity to drive growth.

Learn More




View solution in original post

evaldas
Solution
Recognized Expert | Platinum Partner
Recognized Expert | Platinum Partner

Dropdown values in API

SOLVE

Hi @THa51,

 

In order to see all values of a property, you can use CRM Properties API as @BérangèreL mentioned. In particular, you can use the GET endpoint and include your property:

 

https://api.hubapi.com/crm/v3/properties/0-1/advert_source

 

This will return all of the dropdown options, containing the label and the value.

 

When trying to add/update a contact record via the API, it is important that the data matches the value (not the label).

 

So in your case, if your dropdown option looks like this:

 

{
    "label": "Facebook - Week",
    "value": "Facebook - Week",
    "displayOrder": 1,
    "hidden": false
}

 

But you try to pass "Facebook - WEEK", then then it would fail and contact record would not be updated/created.

 

So you would either need to change the data you are passing or update your dropdown option value to match the data you are passing, i.e.:

 

{
    "label": "Facebook - Week",
    "value": "Facebook - WEEK",
    "displayOrder": 1,
    "hidden": false
}

 

Hope this helps!

✔️ Did this post help answer your query? Help the community by marking it as a solution.

View solution in original post

0 Upvotes
3 Replies 3
evaldas
Solution
Recognized Expert | Platinum Partner
Recognized Expert | Platinum Partner

Dropdown values in API

SOLVE

Hi @THa51,

 

In order to see all values of a property, you can use CRM Properties API as @BérangèreL mentioned. In particular, you can use the GET endpoint and include your property:

 

https://api.hubapi.com/crm/v3/properties/0-1/advert_source

 

This will return all of the dropdown options, containing the label and the value.

 

When trying to add/update a contact record via the API, it is important that the data matches the value (not the label).

 

So in your case, if your dropdown option looks like this:

 

{
    "label": "Facebook - Week",
    "value": "Facebook - Week",
    "displayOrder": 1,
    "hidden": false
}

 

But you try to pass "Facebook - WEEK", then then it would fail and contact record would not be updated/created.

 

So you would either need to change the data you are passing or update your dropdown option value to match the data you are passing, i.e.:

 

{
    "label": "Facebook - Week",
    "value": "Facebook - WEEK",
    "displayOrder": 1,
    "hidden": false
}

 

Hope this helps!

✔️ Did this post help answer your query? Help the community by marking it as a solution.

0 Upvotes
THa51
Member

Dropdown values in API

SOLVE

Thank you  @BérangèreL and @evaldas for your assistance and reply.

BérangèreL
Solution
Community Manager
Community Manager

Dropdown values in API

SOLVE

Hi @THa51 and Happy Friday!

Thanks so much for sharing your question and for detailing your use case around dropdown property values and API behavior with the HubSpot Community.
 

To answer your main question: dropdown values in HubSpot are case sensitive.

So, if your “advert_source” dropdown property contains “Facebook - Week” (with a capital “W”), submitting “Facebook - WEEK” (all caps) via the API will generally result in a mismatch or error, as the exact value must match one of the defined options.

This applies both when updating a contact via the API and when searching for matching dropdown options.

Also, here is a documentation "CRM API | Properties" that can help you.

Now, let's check with our Top Experts: Hi @GRajput, @KhushbooP11 and @NMetnik do you know of a way via the HubSpot API to search for a specific value (rather than list all values) in a contact property’s dropdown list, especially if the list is very long, please?

Have a lovely weekend and thanks so much!
Bérangère





loop


Loop Marketing is a new four-stage approach that combines AI efficiency and human authenticity to drive growth.

Learn More