Skip to content

How can I retrieve a list of all teams? #124

Answered by mhxion
LukasCBossert asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @LukasCBossert. If you want to do it via the command line, you can get a list of teams with just elapi get teams, or export it to a file with elapi get teams --format csv --export. If you want to do it with Python, then the following:

from elapi.api import GETRequest

session = GETRequest()  # Define a HTTP session
teams = session("teams", endpoint_id=None)  # First argument is the endpoint name. This line is when the GET request is actually sent.
# You don't necessarily have to pass endpoint_id=None, that's already the default.
# Replace None with a team ID, if you want information about that team only.
print(teams.json())  # Prints list of all teams as a list of Python dictionaries (…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@LukasCBossert
Comment options

Answer selected by LukasCBossert
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants