0

I'm not able to create a list or a card using the RESTful API of Trello. I have tried using the following:

https://api.trello.com/1/lists/list-id/cards?idBoard=4fe20acefbbd331f0502ea21&name=API-CARD&key=my-app-key&token=read-write-token

The result was a GET response with this list cards.

How can I create a list or a card using the RESTful API?

closed as off-topic by ale, Vidar S. Ramdal, Rubén, Hydra, Alex Nov 9 '15 at 15:32

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "It is a question about creating/developing a web application." – Vidar S. Ramdal, Rubén, Hydra, Alex
If this question can be reworded to fit the rules in the help center, please edit the question.

  • What do you mean by “The result was a GET response with this list cards.”? More exactly, by “this list cards”. – Alex Jul 13 '12 at 19:41
  • Meaning, the result was a list of cards under the requested list. While the result I expected was creation of new card nder that list. – user21696 Jul 15 '12 at 18:22
  • Did you try doing a POST? – Daniel LeCheminant Jul 26 '12 at 19:50
  • How do I do that? Isn't the above URL is POST? – user21696 Aug 4 '12 at 22:10
3
  1. A HTTP request consists of a 'method' + URL + [optional body]

    typical HTTP methods used in RESTful API's are GET, POST, PUT and DELETE.

  2. In the case of creation of a card this could be done through:

    method = POST
    URL    = https://api.trello.com/1/lists/{LIST_ID}/cards?name={CARD_NAME}&desc{CARD_DESC}&key={APP_KEY}&token={APP_TOKEN}"
    
  3. Such a request to could be accomplished in the following bash script:

    OUTPUT=output.html
    LIST_ID=....the list id... # eg: 4051e76b61c12f3162444628
    CARD_NAME=foo
    CARD_DESC=boo
    APP_KEY=...key obtained for you application earlier....
    APP_TOKEN=...token obtained for you application earlier....
    TMP=`mktemp --tmpdir=.`
    
    echo -n > $TMP
    
    wget -O $OUTPUT \
         --debug \
         --no-check-certificate \
         --post-file="$TMP" \
         -U "Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:14.0) Gecko/20100101 Firefox/14.0.1" \
         https://api.trello.com/1/lists/${LIST_ID}/cards?name=${CARD_NAME}&desc${CARD_DESC}&key=${APP_KEY}&token=${APP_TOKEN}"
    

I have not tried this out, but hope this helps.

Not the answer you're looking for? Browse other questions tagged or ask your own question.