Take the 2-minute tour ×
Web Applications Stack Exchange is a question and answer site for power users of web applications. It's 100% free, no registration required.

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?

share|improve this 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
add comment

1 Answer

  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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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