This article explains how you can create or update teams using simple API calls. To add or remove users from teams, see this article. To add or remove custom variables from teams, see this article.
Create Or Update Teams
To create or update teams, follow these 2 steps:
- Step 1 - Get Your API key
- Step 2 - Submit Team Changes
Step 1 - Get Your API Key
To obtain your API key:
- Login to your workspace
- On the left pane, click on "Account > My Profile"
- Click on the "Security" tab (if needed)
- Copy the API key
- Note: you must be full admin in your workspace
Step 2 - Submit Team Changes
To add or update a team:
"name": "West",
"description": "West Coast", // optional
"managerId": "b0c14677-5551-4641-855e-99ba49eb5156", // optional
"parentTeamId": "036cf924-45f4-4d81-b9d9-5a22fa455018", // optional
"managerCanViewResults": true, // optional
"managerCanViewCredits": true, // optional
"membersCanViewCredits": false, // optional
}
Sample Code
The following samples show how to make calls (using C#):
// Create a team
expando = new ExpandoObject();
expando.name = name;
expando.description = "description 1";
expando.managerId = "b0c14677-5551-4641-855e-99ba49eb5156";
expando.parentTeamId = "036cf924-45f4-4d81-b9d9-5a22fa455018";
expando.managerCanViewResults = true;
expando.managerCanViewCredits = true;
expando.membersCanViewCredits = false;
string json = JsonConvert.SerializeObject(expando);
string url = iisExpress.AppWebAppUrl + "/Api/SetTeam";
WebClient webClient = new WebClient();
webClient.Headers.Add("X-ApiKey", apiKey);
string result = webClient.UploadString(url, json);
Updating Teams
Step 2 is often used to create (add) teams. However, you can also use step 2 to update existing teams (i.e. teams you previously added via the web interface or via API calls). To update teams, make sure the name matches the team you want to update. That's it - the system will handle your action as a create or update depending on whether it can find a team with a matching name within your workspace.
Getting Teams
To visually explore the API:
- Login to your workspace
- On the left pane, click on "Settings > Connections > OData API"
- Alternatively, you can connect using a BI tool such as Microsoft Power BI to view entities
Clearing Parent Teams Or Managers
To clear parent teams or managers, make sure to specify properties "managerId" / "parentTeamId" in your payload. If they are not within your payload, no changes will occur. You can either set them to null, or to "00000000-0000-0000-0000-000000000000" to clear them.