Creating a Trello card with a solid cover color using Trello API does not set the cover?

125 views Asked by At

I am testing using Postman. I have all the needed setup for accessing my own workspace, board and list. I can create cards and update them. No problem.

But, I want to set the cover of the new cards in one of the default trello card colors.

I have this raw data in my POST request in Postman.

{
    "key": "{{APIKey}}",
    "token": "{{APIToken}}",
    "idBoard": "{{BoardId}}",
    "idList": "{{ListId}}",
    "name": "{{$randomCatchPhraseDescriptor}}",
    "desc": "{{$randomBs}} from Postman",
    "cover" : {"color":"yellow"}
} 

Endpoint: https://api.trello.com/1/cards

When I send this to the API, I get the card filled out with Postman random texts etc. but the cover color is set to NULL when I retrieve it from the API afterwards and the color does not change in the UI either. So it's clearly not set.

If I do similar using an UpdateCard (PUT) request afterwards using a PUT request like this:

Endpoint: https://api.trello.com/1/cards/

{
    "key": "{{APIKey}}",
    "token": "{{APIToken}}",
    "name": "Test from Postman - update",
    "cover": {
        "color": "yellow",
        "brightness": "light"
    }
} 

it updates, so technically I could create the card, then retrieve it from the result and then call with a PUT (update) afterwards.. but it seems wrong.

Can someone tell me what I am missing in my CREATE CARD request?

Note: I have thought about using an attachment as color, but thats a wrong workaround, as Trello supports default colors out of the box and those are the ones we want to use, so please dont suggest me using an attachment as a workaround.

And yes, I have asked ChatGPT already. LOL!

2

There are 2 answers

0
David Bakkers On BEST ANSWER

You cannot set any characteristic of the cover when creating a Card, that's why the cover parameter is not included in the documentation for the Create a New Card endpoint.

You have to create the card first, then change the Card's cover color, or other characteristics, via the Update a Card endpoint

1
Adnan On

Trello rest api for creating the new cards do not support adding cover at time of creation, you can use card update api to update the card cover.