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
<span>function</span><span> crearTarjeta</span><span>(</span><span>$nombre</span><span>,</span><span> $idLista</span><span>,</span><span> $fecha</span><span>,</span><span> $finalizada</span><span>,</span><span> $notas</span><span>)</span>
<span>{</span>
<span>//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</span>
<span>//https://stackoverflow.com/questions/12077599/creating-a-card-via-trello-fails-with-a-400-response</span>
<span>global</span><span> $apikey</span><span>,</span><span> $oauth</span><span>;</span><span> $nombre </span><span>=</span><span> urlencode</span><span>(</span><span>$nombre</span><span>);</span><span> $notas </span><span>=</span><span> urlencode</span><span>(</span><span>$notas</span><span>);</span>
<span>if</span><span>(!</span><span>empty</span><span>(</span><span>$fecha</span><span>))</span><span> $url </span><span>=</span> <span>"https://api.trello.com/1/cards?key=$apikey&token=$oauth&name=$nombre&idList=$idLista&due=$fecha&dueComplete=$finalizada&desc=$notas&idMembers=ACAMIID"</span><span>;</span>
<span>else</span><span> $url </span><span>=</span> <span>"https://api.trello.com/1/cards?key=$apikey&token=$oauth&name=$nombre&idList=$idLista&dueComplete=$finalizada&desc=$notas&idMembers=ACAMIID"</span><span>;</span><span> $metodo </span><span>=</span> <span>"POST"</span><span>;</span><span> $tarea </span><span>=</span><span> request</span><span>(</span><span>$url</span><span>,</span><span> $metodo</span><span>,</span><span> NULL</span><span>);</span>
<span>return</span><span> $tarea</span><span>;</span>
<span>}</span>
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