Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Trello API cover color... is Trello's API color blind?

Paul Mullen January 27, 2021

I'm struggling to properly form an API call to change the cover color for a card.  I posted the approach I'm taking in StackOverflow as well here.

I suspect I have a problem of proper formation of the PUT request.  I've tried it in my Python code, using Postman, and using a simple cURL command, all with similar results.  Here's the basic form that I have tried:

Except when I make a gross syntax error, the API returns a JSON that simply returns the current color of the card's cover (and a lot of other attributes of the card).  The color of the cover does not actually change.   I asked for pink and I got confirmation of green:

Screenshot 2021-01-27 075916.png

Is there a chance the Trello API is color blind?  ;-)

For those looking for it, the capability is documented in the API and discussed here.

 

 

Any hints about how to properly form this request?

 

Paul

1 answer

0 votes
Michael Pryor
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
January 27, 2021

I think it’s because you actually need to PUT the JSON in the body of your request. You are appending it to the query string like it’s a GET but you need to specify the content-type text/JSON and actually  send the JSON payload in the body of the request (I think). 

Paul Mullen January 27, 2021

OK.  You were right.  Here is the syntax for those who need it:

 

curl -H 'Content-Type: application/json' -X PUT -d '{"cover" : {"color":"pink"}}' https://api.trello.com/1/cards/24CHARCARDNUMBER?token=64CHARTOKEN&key=32CHARKEY

 

If you're doing it in python with the urllib3 library, it owuld be this:

            params = {"cover" : {"color":"pink"}}
            #got the id, now send the message to color it pink            result = http.request(                "PUT"                "https://api.trello.com/1/cards/" + new_card_id + "?key=" + trello_api_key + "&token=" + trello_token,                 body=json.dumps(params),                headers={'Content-Type''application/json'}                )

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events