0

I am using the Trello API and I would Like to create a new card on a specific list.

I did it but not the way I wanted

https://api.trello.com/1/lists/idList/cards?key=<myKey>&token=<myToken>&name=My+new+card+name&desc=My+new+card+description

I would like to create a new card in my list nevertheless I want to do it by using this :

newCard = [
{
    name: "myname",
    idList: "myIdList", 
    desc: "mydesc",
    pos: "top", 
    due: null
};
]

Because with the first methode I end up with errors when I try to add spaces in the name or description (which is normal, can't have spaces in url)

However, when I try to fulfill the newCard variable it raises an error such as "invalid value for idList" and I don't know why?

Maybe someone can give me an exemple on how to do that?

Scylla
  • 57
  • 5

1 Answers1

0

Have you tried without "[]" ? On the api doc https://developers.trello.com/get-started/start-building#create :

var newCard = {
  name: 'New Test Card', 
  desc: 'This is the description of our new card.',
  // Place this card at the top of our list 
  idList: myList,
  pos: 'top'
};

And for the list ID it must look similar to "https://trello.com/c/DcqBrqdx/1-target-card.json"

Bidjes
  • 166
  • 4
  • 10