code: @Override
      @Path("/{roleName}/users/{cuid}")
      @ApiOperation(value="Create a role or add a user to an existing role",
          notes="If users/{cuid} is present, user is added to role.", response=StatusMessage.class)
      @ApiImplicitParams({
          @ApiImplicitParam(name="Workgroup", paramType="body", dataType="com.centurylink.mdw.model.user.Role")})
      public JSONObject post(String path, JSONObject content, Map<String,String> headers)
      throws ServiceException, JSONException {
          String name = getSegment(path, 1);
          String rel = getSegment(path, 2);
  
          UserServices userServices = ServiceLocator.getUserServices();
          try {
              Role existing = userServices.getRoles().get(name);
  
              if (rel == null) {
                  if (existing != null)
                      throw new ServiceException(HTTP_409_CONFLICT, "Role name already exists: " + name);
                  Role role = new Role(content);
                  userServices.createRole(role);
              }
              else if (rel.equals("users")) {
                  String cuid = getSegment(path, 3);
                  User user = UserGroupCache.getUser(cuid);
                  if (user == null) {
                      throw new CachingException("Cannot find user: " + cuid);
                  }
                  if (user.hasRole(name))  // in case added elsewhere
                      throw new ServiceException(HTTP_409_CONFLICT, "User " + cuid + " already has role " + name);
  
                  userServices.addUserToRole(cuid, name);
              }
              else {
                  String msg = "Unsupported relationship for role " + name + ": " + rel;
                  throw new ServiceException(HTTP_400_BAD_REQUEST, msg);
              }
              return null;
          }
          catch (DataAccessException ex) {
              throw new ServiceException(HTTP_500_INTERNAL_ERROR, ex.getMessage(), ex);
          }
          catch (CachingException ex) {
              throw new ServiceException(HTTP_500_INTERNAL_ERROR, ex.getMessage(), ex);
          }
      }
docs: For creating a new role or a new role/user relationship.