List Teams
This article provides an example of calling the List Teams API.
tip
- This API is only available for spaces on the enterprise plan.(Learn more).
- Only the primary admin and sub-admins who can manage teams can use this API.
Example: Get a list of first-level teams in a space
If we regard space as a company, then the teams in space are the departments in the company.
Suppose you have a space and want to get the list of all teams in the first level.
Follow these steps:
Get your API token. (How to get it)
Get your space ID. (How to get it)
Open the terminal on your computer and execute the following code to send a query request to the server (assuming
spaceId
isspcjXzqVrjaP3
and theunitId
of the team is0
to get the first-level teams):- cURL
curl -X GET \
"https://aitable.ai/fusion/v1/spaces/spcjXzqVrjaP3/teams/0/children?pageSize=2&pageNum=1" \
-H "Authorization: Bearer {Your API Token}"The server will return the following JSON data, with the team information under
"data"
:For the meaning of each parameter in the response, please check the API Reference.
{
"code": 200,
"message": "SUCCESS",
"success": true,
"data": {
"total": 2,
"pageSize": 2,
"pageNum": 1,
"teams": [
{
"unitId": "VS1SejiywaMWbiGMEHAohh62T9EPmmlh",
"name": "team A",
"sequence": 1,
"parentUnitId": "0",
"roles": [
{
"unitId": "zJ6TuQvH2RtNfSx9eY7XKgD1oWcE5pV",
"name": "role A",
"sequence": 1
}
]
},
{
"unitId": "bG9xSdV1fR6pMlN2tJyXkZzW5TjHcK4",
"name": "team B",
"sequence": 2,
"parentUnitId": "0",
"roles": [
{
"unitId": "zJ6TuQvH2RtNfSx9eY7XKgD1oWcE5pV",
"name": "role A",
"sequence": 1
}
]
}
]
}
}