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

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

How can I create a new card with multiple members by GAS Edited

In the following URL, It is enough to create a new card with multiple members by assigning a array whose element is the ID of members by strings.

https://developer.atlassian.com/cloud/trello/rest/api-group-cards/#api-cards-post

---------------------------

idMembers

Array<string>

Comma-separated list of member IDs to add to the card

---------------------------

But, I can't create new card in this way, and the error is {"message":"Invalid objectId","error":"ERROR"} .

How can I create ? It is helpful to show a sample code to do this. 

 

My code is as follows:

 

var payload =
{"key": "XXXXXXXXXXXXXXXXXXXXXX", 
"token": "XXXXXXXXXXXXXXXXXXXXXX",
"idList" : "XXXXXXXXXXXXXXXXXXXXXX",
"name" : "aaa",
"idMembers": ["Mr. aaa","Mr. bbb"],

var option =
{"method":"POST",
"payload":payload
};

UrlFetchApp.fetch(URL,option);

1 answer

1 accepted

0 votes
Answer accepted
Iain Dooley Community Leader Jul 20, 2020

@Fujiyama Yoshinori the idMembers needs to be a comma separated list of member IDs, not member names or usernames. 

Here's an example written in Trellinator:

https://gist.github.com/iaindooley/20925ee9690aae643ad473622d1ff608

Here's the implementation of Card.create:

https://github.com/iaindooley/trellinator-libs/blob/master/Card.js#L1628

You can read more about Trellinator here:

https://community.atlassian.com/t5/Marketplace-Apps-Integrations/Introducing-Trellinator-Automate-Trello-with-Google-Apps-Script/ba-p/925271

You can also try the above code snippet here:

https://app.benkobot.com/

Thank you for your answer.

I have retried in the following way by referring URL above:

 

var payload =
{"key": "XXXXXXXXXXXXXXXXXXXXXX", 
"token": "XXXXXXXXXXXXXXXXXXXXXX",
"idList" : "XXXXXXXXXXXXXXXXXXXXXX",
"name" : "aaa",
"idMembers": "Mr. aaa's ID,Mr. bbb's ID", // not array

var option =
{"method":"POST",
"payload":payload
};

UrlFetchApp.fetch(URL,option);

 

In this way, no error has occurred and I can get the result what I wanted.

 

Very thank you !!

Like Iain Dooley likes this

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Trello

📹 What is Trello?

Hello Community!  My name is Brittany Joiner and I am a Trello enthusiast and Atlassian Community Leader. I'll be sharing with you a series of videos with my top tips on how to best use Trello...

781 views 13 30
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you