Update Custom Field Value

Hi,

I’m trying to update the value of a specific customField

this is de field

[
  {
    "id": "5fa45a5-------------24a19b",
    "idValue": "5fa1f9c-----------fe3664",
    "idCustomField": "5fa1f7f9-----------279650db",
    "idModel": "5fa0aecb-----------bc5ad",
    "modelType": "card"
  },
  {
    "id": "5fa45aa-------------3bf69",
    "value": {
      "text": "555555"
    },
    "idCustomField": "5f9a39d-----------93fb47",
    "idModel": "5fa0aecb3----------a3bc5ad",
    "modelType": "card"
  }
]

Using this code in Python

url = "https://api.trello.com/1/cards/{cardId}/customField/{??????}/item"

query = {

'value': {'text':'casino'},
'key': '----------',
'token': '----------------'
}

response = requests.request(
"PUT",
url,
params=query
)

What I receive is

<response [400]>

{
    "error": "ERROR",
    "message": "Invalid custom field item value."
}

I have tryed with severals id’s that are in the model

What I’m doing wrong?

Or updating a custom field value is something that can’t be done by a REST API?

regards

Ruben

Hi @RubenCentineo,

For updating Custom Field Items in Python, you’re going to have to pass in the updated value as a JSON serializable Python object. For your example, you should change the request like this:

url = "https://api.trello.com/1/cards/{cardId}/customField/{??????}/item"

query = {
'key': '----------',
'token': '----------------'
}

response = requests.request(
"PUT",
url,
params=query
json={'value':{'text':'casino'}}
)

Perfect!!!

Thanks Bryan!!!