Update custom fields "List" value via API

Hi everyone,
i’m struggling updating a company custom field value via API JSON.
The custom field is a listBox where there are many pre determined choices and i’m trying to update those value via zapier.

i’m using this input:

{
  "custom_fields": [{
"content": {
"_Settoreincuiopera": "Bellico"
},
"id": 25,
"content": 123,
"id": 143
    }]
}

where id 25 is the listBox field. The problem is that is updating only the field 143, which is a whole number field but it does knothing to the field 25. Here’s the output
"
custom_fields

1

id

25

content

2

id

27

content

3

id

143

content

123
"
As you can see it only PATCHES the field 143 but it doesn’t touch the listbox field 25. Of course the value “Bellico” is part of the choices you can select.

i also tried this variation

{
  "custom_fields": [{
"content": ["Bellico"],
"id": 25,
"content": 123,
"id": 143
    }]
}

but nothing happens. Can please someone help me with this?

Hi Fabrizio,

Firstly, I recommend that you back up the List Values before you attempt to update them, just in case something goes wrong and the values are wiped out.

Taking a quick look at the documentation and your code, it has not been set up properly.

DO NOT USE THIS BELOW, AS REST USES THE ID NUMBER, AS OPPOSE TO XML-RPC WHICH USES THE NAME.

“custom_fields”: 
[
    {
        “content”: { "<CUSTOM FIELD NAME>": “Bellico” },
        “id”: 25
    },
    {
        “content”: {  "<CUSTOM FIELD NAME>":  123 },
        “id”: 143
    }
]

You will have to experiment with this, as updating Lists is not something I have done, so I cannot comment what is needed here.

The REST API Documentation needs to be clearer on these things.

Hi Pav, thank you very much for the quick reply!

I’m tring to use this code

{
  "custom_fields": [
{
"content": { "Settoreincuiopera": "Bellico" },
"id": 25
}, 
{
"content": { "Fatturato20202021inMLN": 123 },
"id": 143}
    }
]
}

But no luck i have error 400
Failed to create a request in Webhooks by Zapier

Input could not be converted to a valid request (HTTP Status Code: 400)

I also tried with the _ before the name of the field.
I’ve tried to use { } before but it seems like syntax is not good…

I completely agree that docs are quite difficult to understand, i’ve seen more clear exapmples with other softwares’ API!

i also tried this code

{
  "custom_fields": [
{
"content": "Bellico",
"id": 25
}, 
{
"content": 123,
"id": 143}
    }
]
}

but same error!

Tagging @Jeff_Arnold, as he has got experience with Zapier.

Try this:

Jeff

Thanks Jeff!! It Worked! And what if i want to add also a second choice to the field 25, let’s say “Manifattura meccanica”? Do i only need to add a comma and the value inside brackets?
Does the same principle work for radio button? so {["Value], id}?
Thank you very much!

{
“custom_fields”: [
{
“content”: [
“Bellico”,
“Manifattura meccanica”
],
“id”: 25, },
{
“content”: 123,
“id”: 143
}
]
}

This should be the code.

Thanks,
Jeff

1 Like