-1

Is there a way to check if a board, list, or card exists in Trello? Would like to create a python script that will display the list of the mentioned components if the name already exists.

I checked the API it seems there is no query function.

Hoping for your inputs. Thanks in advance.

Jamojo
  • 41
  • 4
  • You could build a web scraper? Try looking at the beautifulsoup documentation – Evorage Oct 11 '20 at 14:39
  • Thans for the reply. Will check what you have recommended. Here the sample I would like to do. Lets say "My Board" board already exists. So it will give me the URL https://trello.com/b/bd7pgoeO/my-board. I would like to create a function that will search the "my-board" and it will return the "bd7pgoeO". Not sure if I missed a function already included in the Trello API. – Jamojo Oct 11 '20 at 15:01

1 Answers1

3

Got it now. I was able to use the search API from trello. https://developer.atlassian.com/cloud/trello/rest/api-group-search/#api-search-get

Sharing the code:

def search_board(board_name):
    url = "https://api.trello.com/1/search"
    querystring = {"query": board_name, "key": key, "token": token}
    response = requests.request("GET", url, params=querystring)
    print(response)
    board_id = ""
    print(response.json())
    if response.json()["boards"]:
        board_id = response.json()["boards"][0]["id"]
        print(board_id)
    else:
       return board_id
Jamojo
  • 41
  • 4