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

How to add a card with membersin Trello from its API?

I am using the Trello API to create boards, lists and cards or tasks, however, a problem occurs when trying to create that card and assign a member.

I followed exactly what the documentation says: https://developers.trello.com/reference#cardsid-1

 

function crearTarjeta($nombre, $idLista, $fecha, $finalizada, $notas)
{
    //Esta función tiene una excepción, ya que si bien debe enviarse por POST, Trello espera que los parametros se especifiquen en la url
    //https://stackoverflow.com/questions/12077599/creating-a-card-via-trello-fails-with-a-400-response
    global $apikey, $oauth;    $nombre = urlencode($nombre);    $notas = urlencode($notas);
    if(!empty($fecha))        $url = "https://api.trello.com/1/cards?key=$apikey&token=$oauth&name=$nombre&idList=$idLista&due=$fecha&dueComplete=$finalizada&desc=$notas&idMembers=ACAMIID";
    else        $url = "https://api.trello.com/1/cards?key=$apikey&token=$oauth&name=$nombre&idList=$idLista&dueComplete=$finalizada&desc=$notas&idMembers=ACAMIID";    $metodo = "POST";    $tarea = request($url, $metodo, NULL);
    return $tarea;
}

 

So, when I remove the idMembers parameter from the function createCard, everything works correctly, but when I add it, it shows me the following error:

{"message": "Invalid objectId", "error": "ERROR"}

If you see the documentation it says that it is a value of the string type and that, if there are more than one they should be separated with a comma between them, despite this I have tried adding a comma / semicolon to the end to test and the error persists.

Do you have any idea how to proceed correctly in order to add the members?

I also clarify that I have tried adding the value (member ID) in double-coded commas ->% 22ACAMIID% 22

1 answer

0 votes
Garrett Atlassian Team Jun 21, 2019

Hey @Carlos Fernández 

It looks like your memberID might be invalid. Typically those are an alphanumeric value 24 characters in length.

Can you try using the memberID as seen from our API endpoint here: https://trello.com/1/members/me

Let me know if that helps, or if you have any additional questions!

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Trello

Develop a new Habit during Lockdown

If you had to thrive a new habit during a lockdown, what would it be? Trello

1,567 views 13 5
Read article

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