APIs & Integrations

NAhmed4
Member

How to set dropdown select custom property on contact via API

SOLVE

Hi

Im using this endpoint to create a contact 

 {
                    "property": "lastname",
                    "value": "myemail"
                },
                {
                    "property": "drop_down_property",
                    "value": "Public "
                }]
This doesnt set the value for the drop_down_property
The property exists on the contact but how do i set its value
0 Upvotes
1 Accepted solution
SPfeiffer8
Solution
Participant

How to set dropdown select custom property on contact via API

SOLVE

I've figured it out - just separate the values with a semicolon

View solution in original post

0 Upvotes
4 Replies 4
SPfeiffer8
Participant

How to set dropdown select custom property on contact via API

SOLVE

Hi Jaycee, how would you do that for multiple values? e.g. you want red and green to be selected

0 Upvotes
SPfeiffer8
Solution
Participant

How to set dropdown select custom property on contact via API

SOLVE

I've figured it out - just separate the values with a semicolon

0 Upvotes
Jaycee_Lewis
Community Manager
Community Manager

How to set dropdown select custom property on contact via API

SOLVE

Thank you for coming back and sharing your solution! — Jaycee







HubSpot’s AI-powered customer agent resolves up to 50% of customer queries instantly, with some customers reaching up to 90% resolution rates.


Learn More.





Did you know that the Community is available in other languages?
Join regional conversations by changing your language settings !
0 Upvotes
Jaycee_Lewis
Community Manager
Community Manager

How to set dropdown select custom property on contact via API

SOLVE

Hey, @NAhmed4 👋 Thanks for reaching out. Here are examples using the v1 and v3 versions of this endpoint.

Steps taken for both:

  • Created a custom contact property — dropdown select
  • Grabbed the internal value to use in my API request
    dds-01.png

Update an existing contact — POST /contacts/v1/contact/vid/:vid/profile

  • My request URL and body
    POST https://api.hubapi.com/contacts/v1/contact/vid/901/profile​
    
    {
        "properties": [
            {
                "property": "new_mexico_chile",
                "value": "Green"
            }
        ]
    }
  • I received a 204 No Content response which indicates a successful update
    dds-04.png
  • From the documentation — “Response details – Returns a 204 with no response body when a contact is updated successfully.”

 

For the v3 version — Update a Contact:

  • Update a contact — PATCH/crm/v3/objects/contacts/{contactId}
  • Request 
    curl --request PATCH \
      --url https://api.hubapi.com/crm/v3/objects/contacts/901 \
      --header 'authorization: Bearer YOUR_ACCESS_TOKEN' \
      --header 'content-type: application/json' \
      --data '{
      "properties": {
        "new_mexico_chile": "Red"
      }
    }'​
  • Response
    HTTP 200
    
    {
      "id": "901",
      "properties": {
        "createdate": "2022-11-03T21:42:31.255Z",
        "hs_lifecyclestage_lead_date": "2022-11-03T21:42:31.255Z",
        "hs_pipeline": "contacts-lifecycle-pipeline",
        "lastmodifieddate": "2022-12-14T20:30:50.877Z",
        "lifecyclestage": "lead",
        "new_mexico_chile": "Red"
      },
      "createdAt": "2022-11-03T21:42:31.255Z",
      "updatedAt": "2022-12-14T20:30:50.877Z",
      "archived": false
    }​
    dds-03.png

 

Have fun building! — Jaycee

 







HubSpot’s AI-powered customer agent resolves up to 50% of customer queries instantly, with some customers reaching up to 90% resolution rates.


Learn More.





Did you know that the Community is available in other languages?
Join regional conversations by changing your language settings !
0 Upvotes