How can I move a Trello card using my custom Power-Up?

Cassidy Truter
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!
March 2, 2023

I am creating a custom Power-Up and want some things to be done automatically whenever a card is moved from one board to another. I created my own button at the back of a card called "Move Card" that I wanted to use to move the card and at the same time to make the additional changes that I had wanted to make. The only problem is that I can't figure out how to move a card. 

I tried doing a card PUT request (https://developer.atlassian.com/cloud/trello/rest/api-group-cards/#api-cards-id-put) with each of the following two request bodies:

{ "idBoard": newBoardId, "idList": newListId }
{ "idList": newListId }
In both cases I received code 400 ERR_BAD_REQUEST.
If I do a PUT request that changes the card's name and description, it works. In other words, the card's name and description are updated when my PUT request body is:
{ "name": "new test name", "desc": "new description" }
I also tried to find a way to create an Action but it seems that is not possible (https://developer.atlassian.com/cloud/trello/rest/api-group-actions). 
Is there any way to move a Trello card using my custom Power-Up?
moveCard.PNG

1 answer

1 accepted

1 vote
Answer accepted
David Bakkers
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 2, 2023

Hello @Cassidy Truter 

I can advise that the Update a card endpoint will definitely move a card to a list on another board, if you submit a correctly formatted request.

If you are getting a 400 error, you've probably just got a mal-formed request. If the IDs for the card, list or board were invalid, you'd get 'Resource not found', 'List not found' or 'Board not found' errors, respectively. Test your request using a tool like Postman first, to confirm the request is valid before committing it to code.

Your request should look something like this:

PUT https://api.trello.com/1/cards/616fd52169ab06e48bc3c160

body:

{
    "idBoard" : "640142fe316d931725eb38c1",
    "idList" : "640142f7c1b7e83e3f3393b1"
}

With regards creating an Action, you're correct; there currently are no REST API endpoints for creating Actions, only getting, updating or deleting an existing Action. Also, when updating an Action, only comment actions can be updated.

Cassidy Truter
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!
March 7, 2023

Thank you very much for your help @David Bakkers ! It is working now

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events