code: func (hs *HTTPServer) CreateTeam(c *m.ReqContext, cmd m.CreateTeamCommand) Response {
  	cmd.OrgId = c.OrgId
  
  	if c.OrgRole == m.ROLE_VIEWER {
  		return Error(403, "Not allowed to create team.", nil)
  	}
  
  	if err := hs.Bus.Dispatch(&cmd); err != nil {
  		if err == m.ErrTeamNameTaken {
  			return Error(409, "Team name taken", err)
  		}
  		return Error(500, "Failed to create Team", err)
  	}
  
  	if c.OrgRole == m.ROLE_EDITOR && hs.Cfg.EditorsCanAdmin {
  		addMemberCmd := m.AddTeamMemberCommand{
  			UserId:     c.SignedInUser.UserId,
  			OrgId:      cmd.OrgId,
  			TeamId:     cmd.Result.Id,
  			Permission: m.PERMISSION_ADMIN,
  		}
  
  		if err := hs.Bus.Dispatch(&addMemberCmd); err != nil {
  			c.Logger.Error("Could not add creator to team.", "error", err)
  		}
  	}
  
  	return JSON(200, &util.DynMap{
  		"teamId":  cmd.Result.Id,
  		"message": "Team created",
  	})
  }
docs: // POST /api/teams