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

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

Carlos Fernández June 18, 2019

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
Atlassian Team members are employees working across the company in a wide variety of roles.
June 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
AUG Leaders

Atlassian Community Events