I’m trying to update a multiselect column in hubDB using API.
I have been told to use the PATCH Method - unfortunately this is not working as expected. can anyone please help with the exact URL - and JSON format to use to update teh multiselect column ?
Is there a documentation available that would show how this is done ?
Note : I’m able to add rows and add selected items within the multiselect column by specifying the Multiselect list ID’s. But need to have the multiselect list populated first before I can do this.. logically.
Hi @MVaidheeswara,
In order to update the options for the multi-select column, you would need to make a call to the PATCH end point
https://api.hubapi.com/cms/v3/hubdb/tables/YOUR_TABLE_ID/draft
For the body, the key would be to make sure you find the correct column ID that you want to edit and make sure to include all of the options, as excluding an option would remove it from the column (if you already had some existing ones).
Assuming you have a column called “Occupations”, the JSON would look something like this:
{
"columns": [
{
"id": 3,
"name": "occupations",
"type": "MULTISELECT",
"label": "Occupations",
"options": [
{
"id": "1",
"name": "advertisers",
"label": "Advertisers",
"type": "option"
},
{
"id": "2",
"name": "publishers",
"label": "Publishers",
"type": "option"
},
{
"id": "3",
"name": "managers",
"label": "Managers",
"type": "option"
}
]
}
]
}
Hope this helps!
Hi @MVaidheeswara
The way to do this is to include the complete set of multi-select options in your JSON payload and call the PATCH endpoint for the particular column you want to alter.
URL PATCH
https://api.hubapi.com/cms/v3/hubdb/tables/{tableId}/columns/{columnId}?hapikey=your_api_key
{
"label": "Multiselect Column Name",
"columnType": "MULTISELECT",
"options": [
{ "label": "Option", "value": "value" },
{ "label": "Option ", "value": "value" },
{ "label": "Option ", "value": "value" }
]
}
I hope this will help you out. Please mark it as Solution Accepted and upvote to help another Community member.
Thanks!