Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

I am not able to add comment to the card.

Kowshik Prasad Navilur
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
October 5, 2020

I am trying to create a card and add labels and comments to the card through the python program. I am able to create the card. However, I am not able to add comments to the card created. I am passing the card_id as a parameter to the function. I am getting an invalid id error. Can someone help me with this? I am attaching my code for reference. 

def create_card(list_idcard_name):    url = f"https://api.trello.com/1/cards"    querystring = {"name": card_name, "idList": list_id, "key": key, "token": token}    response = requests.request("POST", url, params=querystring)    card_id = response.json()["id"]    print("create card")    print(response.json())    return card_id


def add_comment(comment, card_id):    url = "https://api.trello.com/1/cards/{id}/actions/comments"    querystring = {"key": key, "token": token, "text": comment,"id": card_id}    response = requests.request("POST", url, params=querystring)    #comment_data = response.json()    #return comment_data    return response.text

1 answer

1 accepted

1 vote
Answer accepted
Iain Dooley
Community Champion
October 5, 2020

@Kowshik Prasad Navilur the id of the card should appear in the URL where you currently have {id}

Kowshik Prasad Navilur
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
October 5, 2020

Thank you, @Iain Dooley. It Worked !! 

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events