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_id, card_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
@Kowshik Prasad Navilur the id of the card should appear in the URL where you currently have {id}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.