Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Populating custom fields via. API

Mikeres0
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
October 18, 2018

I'm having some trouble populating a custom field on a card via. the API. The URL I am using is: 

https://api.trello.com/1/card/{CardID}/customField/{CustomFieldID}/item?key={Key}&token={Token}

The response I'm getting when making the request is a 400 code, and the response body is: 

Invalid value for custom field type

The data that is being sent in the PUT request is: 

{ "value" : { "text": "Hello, world!" }}

Is there anything obvious that I'm doing wrong here? Would you be able to point me in the right directiion? The custom field is of type: text, so I'm at a loss.

1 answer

0 votes
marc -Collabello--Phase Locked-
Community Champion
October 19, 2018

@Mikeres0What seems wrong to me is the url / path for cards, you use:

https://api.trello.com/1/card/{CardID}/ ......

whereas it should be:

https://api.trello.com/1/cards/{CardID}/ ......

i.e. cards

So there seems to be an error in the Trello docs!.

ping for @bentley and @Torben_trello

bentley
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
October 19, 2018

All of the endpoints accept both singular and plural nouns in the route, so I don't think that is the problem.

That error message leads me to believe that you're trying to update a Custom Field that has a type other than text (dropdown, number, etc.). Can you confirm that it is a text type Custom Field?

If it is a text Custom Field, then I'd guess that something might be up with the body. Here is a Postman collection that includes a single PUT request that works to update a Custom Field: https://www.getpostman.com/collections/e82e59d6d5ba6e41f485

marc -Collabello--Phase Locked-
Community Champion
October 21, 2018

@bentley

All of the endpoints accept both singular and plural nouns in the route, so I don't think that is the problem.

Is that documented somewhere?  Could not find this in the API reference.

bentley
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
October 22, 2018
marc -Collabello--Phase Locked-
Community Champion
October 22, 2018

:100

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events