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

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

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

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

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). 

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
Community showcase
Posted in Trello

Taco Tuesday: Your favorite Trello blog takeaway

Hello friends! From the community that brought you Welcome Wednesday, Throwback Thursday and Friday Fun, welcome to Taco Tuesday, a weekly discussion about all things Trello. The best part? One Tac...

391 views 14 12
Join discussion

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you