Skip to main content

사용자 팀 설정

Swit User 팀 등록


  • Swit 의 Team API를 이용하여 등록한 유저들을 팀에 추가 합니다.
  • 소속된 팀이 없는 유저를 처음 추가하면 Main 부서로 등록되게 됩니다.

public SwitDeptDto addUserToSwitTeam(String teamId, List<String> userIds) throws Exception{
    SwitDeptDto retVal = new SwitDeptDto();
    JSONObject params = new JSONObject();
    try {
        JSONArray userList = new JSONArray();
        for(String id : userIds)
            userList.add(id);
        params.put("user_ids", userList);
        params.put("id", teamId);
        SwitTokenDto tokenDto = authService.getSwitTokenByDb("cts-api");

        JsonObject result = httpUtils.post("team.user.add", params, tokenDto);
        JsonElement data = result.getAsJsonObject().get("data").getAsJsonObject().get("data");
        retVal = this.parsingTeamResult(data);
    } catch (Exception e) {
        log.error(e.getMessage());
        throw new Exception(e);
    }
    return retVal;
}