diff --git a/core/src/main/java/de/ids_mannheim/korap/exceptions/StatusCodes.java b/core/src/main/java/de/ids_mannheim/korap/exceptions/StatusCodes.java
index bd4bf89..2116102 100644
--- a/core/src/main/java/de/ids_mannheim/korap/exceptions/StatusCodes.java
+++ b/core/src/main/java/de/ids_mannheim/korap/exceptions/StatusCodes.java
@@ -122,6 +122,7 @@
     public static final int GROUP_MEMBER_DELETED = 1603;
     public static final int GROUP_MEMBER_NOT_FOUND = 1604;
     public static final int INVITATION_EXPIRED = 1605;
+    @Deprecated
     public static final int GROUP_NOT_FOUND = 1606;
     public static final int GROUP_DELETED = 1607;
     public static final int GROUP_EXISTS = 1608;
diff --git a/full/Changes b/full/Changes
index 0256d49..b8b6e88 100644
--- a/full/Changes
+++ b/full/Changes
@@ -3,6 +3,9 @@
    - Handled vulnerability CVE-2019-17195. (margaretha)
 8/11/2019
    - Added user-group name pattern (margaretha, issue #33)
+11/11/2019
+   - Updated user group service paths and replaced groupId with groupName 
+     (margaretha, resolved #33)
 
 # version 0.62.1
 08/07/2019
diff --git a/full/src/main/java/de/ids_mannheim/korap/dao/UserGroupDao.java b/full/src/main/java/de/ids_mannheim/korap/dao/UserGroupDao.java
index 358ba99..28b8650 100644
--- a/full/src/main/java/de/ids_mannheim/korap/dao/UserGroupDao.java
+++ b/full/src/main/java/de/ids_mannheim/korap/dao/UserGroupDao.java
@@ -208,7 +208,7 @@
         }
     }
 
-    public UserGroup retrieveGroupByName (String groupName)
+    public UserGroup retrieveGroupByName (String groupName, boolean fetchMembers)
             throws KustvaktException {
         ParameterChecker.checkStringValue(groupName, "groupName");
 
@@ -217,6 +217,9 @@
                 criteriaBuilder.createQuery(UserGroup.class);
 
         Root<UserGroup> root = query.from(UserGroup.class);
+        if (fetchMembers) {
+            root.fetch(UserGroup_.members);
+        }
         query.select(root);
         query.where(
                 criteriaBuilder.equal(root.get(UserGroup_.name), groupName));
diff --git a/full/src/main/java/de/ids_mannheim/korap/service/UserGroupService.java b/full/src/main/java/de/ids_mannheim/korap/service/UserGroupService.java
index 8eee9a4..78dcd55 100644
--- a/full/src/main/java/de/ids_mannheim/korap/service/UserGroupService.java
+++ b/full/src/main/java/de/ids_mannheim/korap/service/UserGroupService.java
@@ -135,7 +135,7 @@
     
     public UserGroup retrieveUserGroupByName (String groupName)
             throws KustvaktException {
-        return userGroupDao.retrieveGroupByName(groupName);
+        return userGroupDao.retrieveGroupByName(groupName, false);
     }
 
     public UserGroup retrieveHiddenUserGroupByVC (int vcId)
@@ -227,7 +227,7 @@
         }
         
         try{
-            userGroupDao.retrieveGroupByName(groupJson.getName());
+            userGroupDao.retrieveGroupByName(groupJson.getName(),false);
             throw new KustvaktException(StatusCodes.GROUP_EXISTS,
                     "User-group name must be unique.");
         }
@@ -271,29 +271,9 @@
         }
     }
 
-    public void deleteGroup (int groupId, String username)
-            throws KustvaktException {
-        UserGroup userGroup = userGroupDao.retrieveGroupById(groupId);
-        if (userGroup.getStatus() == UserGroupStatus.DELETED) {
-            throw new KustvaktException(StatusCodes.GROUP_DELETED,
-                    "Group " + userGroup.getName() + " has been deleted.",
-                    userGroup.getName());
-        }
-        else if (userGroup.getCreatedBy().equals(username)
-                || adminDao.isAdmin(username)) {
-            // soft delete
-            userGroupDao.deleteGroup(groupId, username,
-                    config.isSoftDeleteGroup());
-        }
-        else {
-            throw new KustvaktException(StatusCodes.AUTHORIZATION_FAILED,
-                    "Unauthorized operation for user: " + username, username);
-        }
-    }
-    
     public void deleteGroup (String groupName, String username)
             throws KustvaktException {
-        UserGroup userGroup = userGroupDao.retrieveGroupByName(groupName);
+        UserGroup userGroup = userGroupDao.retrieveGroupByName(groupName,false);
         if (userGroup.getStatus() == UserGroupStatus.DELETED) {
             // EM: should this be "not found" instead?
             throw new KustvaktException(StatusCodes.GROUP_DELETED,
@@ -312,7 +292,7 @@
         }
     }
 
-    public int createAutoHiddenGroup (int vcId) throws KustvaktException {
+    public int createAutoHiddenGroup () throws KustvaktException {
         String code = random.createRandomCode();
         String groupName = "auto-"+code;
         int groupId = userGroupDao.createGroup(groupName, "system",
@@ -411,14 +391,13 @@
         return null;
     }
 
-    public void inviteGroupMembers (UserGroupJson group, String inviter)
-            throws KustvaktException {
-        int groupId = group.getId();
+    public void inviteGroupMembers (UserGroupJson group, String groupName,
+            String inviter) throws KustvaktException {
         String[] members = group.getMembers();
-        ParameterChecker.checkIntegerValue(groupId, "id");
+        ParameterChecker.checkStringValue(groupName, "group name");
         ParameterChecker.checkObjectValue(members, "members");
 
-        UserGroup userGroup = retrieveUserGroupById(groupId);
+        UserGroup userGroup = retrieveUserGroupByName(groupName);
         if (userGroup.getStatus() == UserGroupStatus.DELETED) {
             throw new KustvaktException(StatusCodes.GROUP_DELETED,
                     "Group " + userGroup.getName() + " has been deleted.",
@@ -463,13 +442,13 @@
      *            the username of the group member
      * @throws KustvaktException
      */
-    public void acceptInvitation (int groupId, String username)
+    public void acceptInvitation (String groupName, String username)
             throws KustvaktException {
 
         ParameterChecker.checkStringValue(username, "userId");
-        ParameterChecker.checkIntegerValue(groupId, "groupId");
+        ParameterChecker.checkStringValue(groupName, "groupId");
 
-        UserGroup userGroup = userGroupDao.retrieveGroupById(groupId);
+        UserGroup userGroup = userGroupDao.retrieveGroupByName(groupName, false);
         if (userGroup.getStatus() == UserGroupStatus.DELETED) {
             throw new KustvaktException(StatusCodes.GROUP_DELETED,
                     "Group " + userGroup.getName() + " has been deleted.",
@@ -477,7 +456,7 @@
         }
 
         UserGroupMember member =
-                groupMemberDao.retrieveMemberById(username, groupId);
+                groupMemberDao.retrieveMemberById(username, userGroup.getId());
         GroupMemberStatus status = member.getStatus();
         if (status.equals(GroupMemberStatus.DELETED)) {
             throw new KustvaktException(StatusCodes.GROUP_MEMBER_DELETED,
@@ -528,10 +507,10 @@
         return false;
     }
 
-    public void deleteGroupMember (String memberId, int groupId,
+    public void deleteGroupMember (String memberId, String groupName,
             String deletedBy) throws KustvaktException {
 
-        UserGroup userGroup = userGroupDao.retrieveGroupById(groupId);
+        UserGroup userGroup = userGroupDao.retrieveGroupByName(groupName, false);
         if (userGroup.getStatus() == UserGroupStatus.DELETED) {
             throw new KustvaktException(StatusCodes.GROUP_DELETED,
                     "Group " + userGroup.getName() + " has been deleted.",
@@ -546,7 +525,7 @@
                 || isUserGroupAdmin(deletedBy, userGroup)
                 || adminDao.isAdmin(deletedBy)) {
             // soft delete
-            doDeleteMember(memberId, groupId, deletedBy,
+            doDeleteMember(memberId, userGroup.getId(), deletedBy,
                     config.isSoftDeleteGroupMember());
         }
         else {
@@ -588,10 +567,11 @@
         groupMemberDao.deleteMember(member, deletedBy, isSoftDelete);
     }
 
-    public UserGroupDto searchById (String username, int groupId)
+    public UserGroupDto searchByName (String username, String groupName)
             throws KustvaktException {
         if (adminDao.isAdmin(username)) {
-            UserGroup userGroup = userGroupDao.retrieveGroupById(groupId, true);
+            UserGroup userGroup =
+                    userGroupDao.retrieveGroupByName(groupName, true);
             UserGroupDto groupDto = converter.createUserGroupDto(userGroup,
                     userGroup.getMembers(), null, null);
             return groupDto;
@@ -603,15 +583,15 @@
 
     }
 
-    public void editMemberRoles (String username, int groupId,
+    public void editMemberRoles (String username, String groupName,
             String memberUsername, List<Integer> roleIds)
             throws KustvaktException {
 
-        ParameterChecker.checkIntegerValue(groupId, "groupId");
         ParameterChecker.checkStringValue(username, "username");
+        ParameterChecker.checkStringValue(groupName, "groupName");
         ParameterChecker.checkStringValue(memberUsername, "memberUsername");
 
-        UserGroup userGroup = userGroupDao.retrieveGroupById(groupId, true);
+        UserGroup userGroup = userGroupDao.retrieveGroupByName(groupName, true);
         UserGroupStatus groupStatus = userGroup.getStatus();
         if (groupStatus == UserGroupStatus.DELETED) {
             throw new KustvaktException(StatusCodes.GROUP_DELETED,
@@ -621,7 +601,8 @@
                 || adminDao.isAdmin(username)) {
 
             UserGroupMember member =
-                    groupMemberDao.retrieveMemberById(memberUsername, groupId);
+                    groupMemberDao.retrieveMemberById(memberUsername,
+                            userGroup.getId());
 
             if (!member.getStatus().equals(GroupMemberStatus.ACTIVE)) {
                 throw new KustvaktException(StatusCodes.GROUP_MEMBER_INACTIVE,
@@ -643,15 +624,15 @@
         }
     }
 
-    public void addMemberRoles (String username, int groupId,
+    public void addMemberRoles (String username, String groupName,
             String memberUsername, List<Integer> roleIds)
             throws KustvaktException {
 
-        ParameterChecker.checkIntegerValue(groupId, "groupId");
         ParameterChecker.checkStringValue(username, "username");
+        ParameterChecker.checkStringValue(groupName, "groupName");
         ParameterChecker.checkStringValue(memberUsername, "memberUsername");
 
-        UserGroup userGroup = userGroupDao.retrieveGroupById(groupId, true);
+        UserGroup userGroup = userGroupDao.retrieveGroupByName(groupName, true);
         UserGroupStatus groupStatus = userGroup.getStatus();
         if (groupStatus == UserGroupStatus.DELETED) {
             throw new KustvaktException(StatusCodes.GROUP_DELETED,
@@ -661,7 +642,8 @@
                 || adminDao.isAdmin(username)) {
 
             UserGroupMember member =
-                    groupMemberDao.retrieveMemberById(memberUsername, groupId);
+                    groupMemberDao.retrieveMemberById(memberUsername,
+                            userGroup.getId());
 
             if (!member.getStatus().equals(GroupMemberStatus.ACTIVE)) {
                 throw new KustvaktException(StatusCodes.GROUP_MEMBER_INACTIVE,
@@ -683,21 +665,22 @@
         }
     }
 
-    public void deleteMemberRoles (String username, int groupId,
+    public void deleteMemberRoles (String username, String groupName,
             String memberUsername, List<Integer> roleIds)
             throws KustvaktException {
 
-        ParameterChecker.checkIntegerValue(groupId, "groupId");
         ParameterChecker.checkStringValue(username, "username");
+        ParameterChecker.checkStringValue(groupName, "groupName");
         ParameterChecker.checkStringValue(memberUsername, "memberUsername");
 
-        UserGroup userGroup = userGroupDao.retrieveGroupById(groupId, true);
+        UserGroup userGroup = userGroupDao.retrieveGroupByName(groupName, true);
 
         if (isUserGroupAdmin(username, userGroup)
                 || adminDao.isAdmin(username)) {
 
             UserGroupMember member =
-                    groupMemberDao.retrieveMemberById(memberUsername, groupId);
+                    groupMemberDao.retrieveMemberById(memberUsername,
+                            userGroup.getId());
 
             Set<Role> roles = member.getRoles();
             Iterator<Role> i = roles.iterator();
diff --git a/full/src/main/java/de/ids_mannheim/korap/service/VirtualCorpusService.java b/full/src/main/java/de/ids_mannheim/korap/service/VirtualCorpusService.java
index 48d2a62..4ebb07a 100644
--- a/full/src/main/java/de/ids_mannheim/korap/service/VirtualCorpusService.java
+++ b/full/src/main/java/de/ids_mannheim/korap/service/VirtualCorpusService.java
@@ -301,7 +301,7 @@
         if (access == null) {
             VirtualCorpus vc = vcDao.retrieveVCById(vcId);
             // create and assign a new hidden group
-            int groupId = userGroupService.createAutoHiddenGroup(vcId);
+            int groupId = userGroupService.createAutoHiddenGroup();
             UserGroup autoHidden =
                     userGroupService.retrieveUserGroupById(groupId);
             accessDao.createAccessToVC(vc, autoHidden, "system",
diff --git a/full/src/main/java/de/ids_mannheim/korap/web/controller/UserGroupController.java b/full/src/main/java/de/ids_mannheim/korap/web/controller/UserGroupController.java
index 4f66530..013b61a 100644
--- a/full/src/main/java/de/ids_mannheim/korap/web/controller/UserGroupController.java
+++ b/full/src/main/java/de/ids_mannheim/korap/web/controller/UserGroupController.java
@@ -63,8 +63,8 @@
     /**
      * Returns all user-groups in which a user is an active or a
      * pending member.
-     * Not suitable for system-admin, instead use
-     * {@link UserGroupController#
+     * 
+     * Not suitable for system-admin, instead use {@link UserGroupController#
      * getUserGroupBySystemAdmin(SecurityContext, String, UserGroupStatus)}
      * 
      * @param securityContext
@@ -119,24 +119,25 @@
     }
 
     /**
-     * Retrieves a specific user-group for system admins.
+     * Retrieves a specific user-group. Only system admins are
+     * allowed.
      * 
      * @param securityContext
-     * @param groupId
-     *            group id
+     * @param groupName
+     *            group name
      * @return a user-group
      */
     @GET
-    @Path("{groupId}")
+    @Path("{groupName}")
     @Produces(MediaType.APPLICATION_JSON + ";charset=utf-8")
-    public UserGroupDto searchUserGroup (
+    public UserGroupDto retrieveUserGroup (
             @Context SecurityContext securityContext,
-            @PathParam("groupId") int groupId) {
+            @PathParam("groupName") String groupName) {
         TokenContext context =
                 (TokenContext) securityContext.getUserPrincipal();
         try {
             scopeService.verifyScope(context, OAuth2Scope.ADMIN);
-            return service.searchById(context.getUsername(), groupId);
+            return service.searchByName(context.getUsername(), groupName);
         }
         catch (KustvaktException e) {
             throw kustvaktResponseHandler.throwit(e);
@@ -187,29 +188,12 @@
      * owner and system admins can delete groups.
      * 
      * @param securityContext
-     * @param groupId
+     * @param groupName the name of the group to delete
      * @return HTTP 200, if successful.
      */
     @DELETE
-    @Path("delete/{groupId}")
-    public Response deleteUserGroup (@Context SecurityContext securityContext,
-            @PathParam("groupId") int groupId) {
-        TokenContext context =
-                (TokenContext) securityContext.getUserPrincipal();
-        try {
-            scopeService.verifyScope(context, OAuth2Scope.DELETE_USER_GROUP);
-            service.deleteGroup(groupId, context.getUsername());
-            return Response.ok().build();
-        }
-        catch (KustvaktException e) {
-            throw kustvaktResponseHandler.throwit(e);
-        }
-    }
-
-    @DELETE
     @Path("{groupName}")
-    public Response deleteUserGroupByName (
-            @Context SecurityContext securityContext,
+    public Response deleteUserGroup (@Context SecurityContext securityContext,
             @PathParam("groupName") String groupName) {
         TokenContext context =
                 (TokenContext) securityContext.getUserPrincipal();
@@ -223,28 +207,32 @@
         }
     }
 
+
     /**
-     * Deletes a user-group member. Group owner cannot be deleted.
+     * Removes a user-group member. Group owner cannot be deleted.
+     * Only group admins, system admins and the member himself can
+     * remove a member. 
      * 
      * @param securityContext
-     * @param memberId
+     * @param memberUsername
      *            a username of a group member
-     * @param groupId
-     *            a group id
+     * @param groupName
+     *            a group name
      * @return if successful, HTTP response status OK
      */
     @DELETE
-    @Path("member/delete/{groupId}/{memberId}")
-    public Response deleteUserFromGroup (
+    @Path("{groupName}/{memberUsername}")
+    public Response removeUserFromGroup (
             @Context SecurityContext securityContext,
-            @PathParam("memberId") String memberId,
-            @PathParam("groupId") int groupId) {
+            @PathParam("memberUsername") String memberUsername,
+            @PathParam("groupName") String groupName) {
         TokenContext context =
                 (TokenContext) securityContext.getUserPrincipal();
         try {
             scopeService.verifyScope(context,
                     OAuth2Scope.DELETE_USER_GROUP_MEMBER);
-            service.deleteGroupMember(memberId, groupId, context.getUsername());
+            service.deleteGroupMember(memberUsername, groupName,
+                    context.getUsername());
             return Response.ok().build();
         }
         catch (KustvaktException e) {
@@ -259,22 +247,23 @@
      * 
      * @param securityContext
      * @param group
-     *            UserGroupJson containing groupId and usernames to be
-     *            invited
-     *            as members
+     *            UserGroupJson containing groupName and usernames to be
+     *            invited as members
      * @return if successful, HTTP response status OK
      */
     @POST
-    @Path("member/invite")
+    @Path("{groupName}/invite")
     @Consumes(MediaType.APPLICATION_JSON)
     public Response inviteGroupMembers (
-            @Context SecurityContext securityContext, UserGroupJson group) {
+            @Context SecurityContext securityContext,
+            @PathParam("groupName") String groupName,
+            UserGroupJson group) {
         TokenContext context =
                 (TokenContext) securityContext.getUserPrincipal();
         try {
             scopeService.verifyScope(context,
                     OAuth2Scope.ADD_USER_GROUP_MEMBER);
-            service.inviteGroupMembers(group, context.getUsername());
+            service.inviteGroupMembers(group, groupName, context.getUsername());
             return Response.ok("SUCCESS").build();
         }
         catch (KustvaktException e) {
@@ -287,16 +276,16 @@
      * as well.
      * 
      * @param securityContext
-     * @param groupId
+     * @param groupName
      * @param memberUsername
      * @param roleIds
      * @return
      */
     @POST
-    @Path("member/role/edit")
+    @Path("{groupName}/role/edit")
     @Consumes(MediaType.APPLICATION_FORM_URLENCODED)
     public Response editMemberRoles (@Context SecurityContext securityContext,
-            @FormParam("groupId") int groupId,
+            @PathParam("groupName") String groupName,
             @FormParam("memberUsername") String memberUsername,
             @FormParam("roleIds") List<Integer> roleIds) {
         TokenContext context =
@@ -304,7 +293,7 @@
         try {
             scopeService.verifyScope(context,
                     OAuth2Scope.EDIT_USER_GROUP_MEMBER_ROLE);
-            service.editMemberRoles(context.getUsername(), groupId,
+            service.editMemberRoles(context.getUsername(), groupName,
                     memberUsername, roleIds);
             return Response.ok("SUCCESS").build();
         }
@@ -318,19 +307,19 @@
      * admins and system admins are allowed.
      * 
      * @param securityContext
-     * @param groupId
-     *            a group id
+     * @param groupName
+     *            a group name
      * @param memberUsername
-     *            the username of a group member
+     *            a username of a group member
      * @param roleIds
      *            list of role ids
      * @return if successful, HTTP response status OK
      */
     @POST
-    @Path("member/role/add")
+    @Path("{groupName}/role/add")
     @Consumes(MediaType.APPLICATION_FORM_URLENCODED)
     public Response addMemberRoles (@Context SecurityContext securityContext,
-            @FormParam("groupId") int groupId,
+            @PathParam("groupName") String groupName,
             @FormParam("memberUsername") String memberUsername,
             @FormParam("roleIds") List<Integer> roleIds) {
         TokenContext context =
@@ -338,7 +327,7 @@
         try {
             scopeService.verifyScope(context,
                     OAuth2Scope.ADD_USER_GROUP_MEMBER_ROLE);
-            service.addMemberRoles(context.getUsername(), groupId,
+            service.addMemberRoles(context.getUsername(), groupName,
                     memberUsername, roleIds);
             return Response.ok("SUCCESS").build();
         }
@@ -348,23 +337,23 @@
     }
 
     /**
-     * Deletes roles of a member of a user-group. Only user-group
-     * admins and system admins are allowed.
+     * Updates the roles of a member of a user-group by removing the
+     * given roles. Only user-group admins and system admins are allowed.
      * 
      * @param securityContext
-     * @param groupId
-     *            a group id
+     * @param groupName
+     *            a group name
      * @param memberUsername
-     *            the username of a group member
+     *            a username of a group member
      * @param roleIds
      *            list of role ids
      * @return if successful, HTTP response status OK
      */
     @POST
-    @Path("member/role/delete")
+    @Path("{groupName}/role/delete")
     @Consumes(MediaType.APPLICATION_FORM_URLENCODED)
     public Response deleteMemberRoles (@Context SecurityContext securityContext,
-            @FormParam("groupId") int groupId,
+            @PathParam("groupName") String groupName,
             @FormParam("memberUsername") String memberUsername,
             @FormParam("roleIds") List<Integer> roleIds) {
         TokenContext context =
@@ -372,7 +361,7 @@
         try {
             scopeService.verifyScope(context,
                     OAuth2Scope.DELETE_USER_GROUP_MEMBER_ROLE);
-            service.deleteMemberRoles(context.getUsername(), groupId,
+            service.deleteMemberRoles(context.getUsername(), groupName,
                     memberUsername, roleIds);
             return Response.ok("SUCCESS").build();
         }
@@ -386,21 +375,20 @@
      * users can subscribe to the corresponding user-group.
      * 
      * @param securityContext
-     * @param groupId
-     *            a group id
+     * @param groupName
+     *            a group name
      * @return if successful, HTTP response status OK
      */
     @POST
-    @Path("subscribe")
-    @Consumes(MediaType.APPLICATION_FORM_URLENCODED)
+    @Path("{groupName}/subscribe")
     public Response subscribeToGroup (@Context SecurityContext securityContext,
-            @FormParam("groupId") int groupId) {
+            @PathParam("groupName") String groupName) {
         TokenContext context =
                 (TokenContext) securityContext.getUserPrincipal();
         try {
             scopeService.verifyScope(context,
                     OAuth2Scope.ADD_USER_GROUP_MEMBER);
-            service.acceptInvitation(groupId, context.getUsername());
+            service.acceptInvitation(groupName, context.getUsername());
             return Response.ok("SUCCESS").build();
         }
         catch (KustvaktException e) {
@@ -412,24 +400,23 @@
      * Handles requests to reject membership invitation. A member can
      * only unsubscribe him/herself from a group.
      * 
-     * Implemented identical to delete group member.
+     * Implemented identical to {@link #removeUserFromGroup(SecurityContext, String, String)}.
      * 
      * @param securityContext
-     * @param groupId
+     * @param groupName
      * @return if successful, HTTP response status OK
      */
-    @POST
-    @Path("unsubscribe")
-    @Consumes(MediaType.APPLICATION_FORM_URLENCODED)
+    @DELETE
+    @Path("{groupName}/unsubscribe")
     public Response unsubscribeFromGroup (
             @Context SecurityContext securityContext,
-            @FormParam("groupId") int groupId) {
+            @PathParam("groupName") String groupName) {
         TokenContext context =
                 (TokenContext) securityContext.getUserPrincipal();
         try {
             scopeService.verifyScope(context,
                     OAuth2Scope.DELETE_USER_GROUP_MEMBER);
-            service.deleteGroupMember(context.getUsername(), groupId,
+            service.deleteGroupMember(context.getUsername(), groupName,
                     context.getUsername());
             return Response.ok("SUCCESS").build();
         }
diff --git a/full/src/main/java/de/ids_mannheim/korap/web/input/UserGroupJson.java b/full/src/main/java/de/ids_mannheim/korap/web/input/UserGroupJson.java
index b08e85f..f89743e 100644
--- a/full/src/main/java/de/ids_mannheim/korap/web/input/UserGroupJson.java
+++ b/full/src/main/java/de/ids_mannheim/korap/web/input/UserGroupJson.java
@@ -14,6 +14,7 @@
 @Setter
 public class UserGroupJson {
 
+    @Deprecated
     private int id;
     private String name;
     private String[] members;
diff --git a/full/src/test/java/de/ids_mannheim/korap/web/controller/UserGroupControllerAdminTest.java b/full/src/test/java/de/ids_mannheim/korap/web/controller/UserGroupControllerAdminTest.java
index cabc5da..1f1d874 100644
--- a/full/src/test/java/de/ids_mannheim/korap/web/controller/UserGroupControllerAdminTest.java
+++ b/full/src/test/java/de/ids_mannheim/korap/web/controller/UserGroupControllerAdminTest.java
@@ -92,12 +92,14 @@
     @Test
     public void testListWithoutUsername () throws UniformInterfaceException,
             ClientHandlerException, KustvaktException {
-        ClientResponse response = resource().path(API_VERSION).path("group").path("list").header(
-                Attributes.AUTHORIZATION,
-                HttpAuthorizationHandler.createBasicAuthorizationHeaderValue(
-                        adminUsername, "pass"))
-                .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
-                .get(ClientResponse.class);
+        ClientResponse response =
+                resource().path(API_VERSION).path("group").path("list")
+                        .header(Attributes.AUTHORIZATION,
+                                HttpAuthorizationHandler
+                                        .createBasicAuthorizationHeaderValue(
+                                                adminUsername, "pass"))
+                        .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
+                        .get(ClientResponse.class);
 
         assertEquals(Status.OK.getStatusCode(), response.getStatus());
         String entity = response.getEntity(String.class);
@@ -157,7 +159,8 @@
         json.setName(groupName);
         json.setMembers(new String[] { "marlin", "nemo" });
 
-        ClientResponse response = resource().path(API_VERSION).path("group").path("create")
+        ClientResponse response = resource().path(API_VERSION).path("group")
+                .path("create")
                 .type(MediaType.APPLICATION_JSON)
                 .header(Attributes.AUTHORIZATION,
                         HttpAuthorizationHandler
@@ -174,23 +177,22 @@
         node = node.get(0);
         assertEquals(groupName, node.get("name").asText());
 
-        String groupId = node.get("id").asText();
-        testMemberRole("marlin", groupId);
-        testInviteMember(groupId);
-        testDeleteMember(groupId);
-        testDeleteGroup(groupId);
+        testMemberRole("marlin", groupName);
+        testInviteMember(groupName);
+        testDeleteMember(groupName);
+        testDeleteGroup(groupName);
     }
 
-    private void testMemberRole (String memberUsername, String groupId)
+    private void testMemberRole (String memberUsername, String groupName)
             throws UniformInterfaceException, ClientHandlerException,
             KustvaktException {
 
         // accept invitation
         MultivaluedMap<String, String> form = new MultivaluedMapImpl();
-        form.add("groupId", groupId);
+        form.add("groupName", groupName);
 
-        ClientResponse response = resource().path(API_VERSION).path("group").path("subscribe")
-                .type(MediaType.APPLICATION_FORM_URLENCODED)
+        ClientResponse response = resource().path(API_VERSION).path("group")
+                .path(groupName).path("subscribe")
                 .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue("marlin", "pass"))
@@ -198,21 +200,21 @@
 
         assertEquals(Status.OK.getStatusCode(), response.getStatus());
 
-        testAddMemberRoles(groupId, memberUsername);
-        testDeleteMemberRoles(groupId, memberUsername);
+        testAddMemberRoles(groupName, memberUsername);
+        testDeleteMemberRoles(groupName, memberUsername);
     }
 
-    private void testAddMemberRoles (String groupId, String memberUsername)
+    private void testAddMemberRoles (String groupName, String memberUsername)
             throws UniformInterfaceException, ClientHandlerException,
             KustvaktException {
         MultivaluedMap<String, String> map = new MultivaluedMapImpl();
-        map.add("groupId", groupId.toString());
         map.add("memberUsername", memberUsername);
         map.add("roleIds", "1"); // USER_GROUP_ADMIN
         map.add("roleIds", "2"); // USER_GROUP_MEMBER
 
         ClientResponse response =
-                resource().path(API_VERSION).path("group").path("member").path("role").path("add")
+                resource().path(API_VERSION).path("group").path(groupName)
+                        .path("role").path("add")
                         .type(MediaType.APPLICATION_FORM_URLENCODED)
                         .header(Attributes.AUTHORIZATION,
                                 HttpAuthorizationHandler
@@ -223,7 +225,7 @@
 
         assertEquals(Status.OK.getStatusCode(), response.getStatus());
 
-        JsonNode node = retrieveGroup(groupId).at("/members");
+        JsonNode node = retrieveGroup(groupName).at("/members");
         JsonNode member;
         for (int i = 0; i < node.size(); i++) {
             member = node.get(i);
@@ -236,15 +238,14 @@
         }
     }
 
-    private void testDeleteMemberRoles (String groupId, String memberUsername)
+    private void testDeleteMemberRoles (String groupName, String memberUsername)
             throws UniformInterfaceException, ClientHandlerException,
             KustvaktException {
         MultivaluedMap<String, String> map = new MultivaluedMapImpl();
-        map.add("groupId", groupId.toString());
         map.add("memberUsername", memberUsername);
         map.add("roleIds", "1"); // USER_GROUP_ADMIN
 
-        ClientResponse response = resource().path(API_VERSION).path("group").path("member")
+        ClientResponse response = resource().path(API_VERSION).path("group").path(groupName)
                 .path("role").path("delete")
                 .type(MediaType.APPLICATION_FORM_URLENCODED)
                 .header(Attributes.AUTHORIZATION,
@@ -256,7 +257,7 @@
 
         assertEquals(Status.OK.getStatusCode(), response.getStatus());
 
-        JsonNode node = retrieveGroup(groupId).at("/members");
+        JsonNode node = retrieveGroup(groupName).at("/members");
         JsonNode member;
         for (int i = 0; i < node.size(); i++) {
             member = node.get(i);
@@ -267,12 +268,12 @@
         }
     }
 
-    private JsonNode retrieveGroup (String groupId)
+    private JsonNode retrieveGroup (String groupName)
             throws UniformInterfaceException, ClientHandlerException,
             KustvaktException {
-        ClientResponse response = resource().path(API_VERSION).path("group").path(groupId).header(
-                Attributes.AUTHORIZATION,
-                HttpAuthorizationHandler.createBasicAuthorizationHeaderValue(
+        ClientResponse response = resource().path(API_VERSION).path("group").path(groupName)
+                .header(Attributes.AUTHORIZATION,
+                        HttpAuthorizationHandler.createBasicAuthorizationHeaderValue(
                         adminUsername, "pass"))
                 .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
                 .get(ClientResponse.class);
@@ -284,12 +285,12 @@
         return node;
     }
 
-    private void testDeleteGroup (String groupId)
+    private void testDeleteGroup (String groupName)
             throws UniformInterfaceException, ClientHandlerException,
             KustvaktException {
         // delete group
         ClientResponse response =
-                resource().path(API_VERSION).path("group").path("delete").path(groupId)
+                resource().path(API_VERSION).path("group").path(groupName)
                         .header(Attributes.AUTHORIZATION,
                                 HttpAuthorizationHandler
                                         .createBasicAuthorizationHeaderValue(
@@ -304,12 +305,12 @@
         assertEquals(0, node.size());
     }
 
-    private void testDeleteMember (String groupId)
+    private void testDeleteMember (String groupName)
             throws UniformInterfaceException, ClientHandlerException,
             KustvaktException {
         // delete marlin from group
-        ClientResponse response = resource().path(API_VERSION).path("group").path("member")
-                .path("delete").path(groupId).path("marlin")
+        ClientResponse response = resource().path(API_VERSION).path("group")
+                .path(groupName).path("marlin")
                 .header(Attributes.AUTHORIZATION,
                         HttpAuthorizationHandler
                                 .createBasicAuthorizationHeaderValue(
@@ -328,17 +329,16 @@
                 node.at("/members/1/status").asText());
     }
 
-    private void testInviteMember (String groupId)
+    private void testInviteMember (String groupName)
             throws UniformInterfaceException, ClientHandlerException,
             KustvaktException {
         String[] members = new String[] { "darla" };
 
         UserGroupJson userGroup = new UserGroupJson();
         userGroup.setMembers(members);
-        userGroup.setId(Integer.parseInt(groupId));
 
-        ClientResponse response = resource().path(API_VERSION).path("group").path("member")
-                .path("invite").type(MediaType.APPLICATION_JSON)
+        ClientResponse response = resource().path(API_VERSION).path("group")
+                .path(groupName).path("invite").type(MediaType.APPLICATION_JSON)
                 .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
                 .header(Attributes.AUTHORIZATION,
                         HttpAuthorizationHandler
diff --git a/full/src/test/java/de/ids_mannheim/korap/web/controller/UserGroupControllerTest.java b/full/src/test/java/de/ids_mannheim/korap/web/controller/UserGroupControllerTest.java
index 52880e7..d538065 100644
--- a/full/src/test/java/de/ids_mannheim/korap/web/controller/UserGroupControllerTest.java
+++ b/full/src/test/java/de/ids_mannheim/korap/web/controller/UserGroupControllerTest.java
@@ -253,22 +253,22 @@
                 node.at("/members/1/status").asText());
         assertEquals(0, node.at("/members/1/roles").size());
 
-        testInviteMember(groupId);
+        testInviteMember(groupName);
 
-        testDeleteMemberUnauthorized(groupId);
-        testDeleteMember(groupId);
-        testDeleteGroup(groupId);
+        testDeleteMemberUnauthorized(groupName);
+        testDeleteMember(groupName);
+        testDeleteGroup(groupName);
 
-        testSubscribeToDeletedGroup(groupId);
-        testUnsubscribeToDeletedGroup(groupId);
+        testSubscribeToDeletedGroup(groupName);
+        testUnsubscribeToDeletedGroup(groupName);
     }
 
-    private void testDeleteMember (String groupId)
+    private void testDeleteMember (String groupName)
             throws UniformInterfaceException, ClientHandlerException,
             KustvaktException {
         // delete marlin from group
         ClientResponse response = resource().path(API_VERSION).path("group")
-                .path("member").path("delete").path(groupId).path("marlin")
+                .path(groupName).path("marlin")
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue(username, "pass"))
                 .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
@@ -286,12 +286,12 @@
         assertEquals(3, node.get("members").size());
     }
 
-    private void testDeleteMemberUnauthorized (String groupId)
+    private void testDeleteMemberUnauthorized (String groupName)
             throws UniformInterfaceException, ClientHandlerException,
             KustvaktException {
         // nemo is a group member
         ClientResponse response = resource().path(API_VERSION).path("group")
-                .path("member").path("delete").path(groupId).path("marlin")
+                .path(groupName).path("marlin")
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue("nemo", "pass"))
                 .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
@@ -312,9 +312,7 @@
             ClientHandlerException, KustvaktException {
         // dory delete pearl
         ClientResponse response = resource().path(API_VERSION).path("group")
-                .path("member")
-                // dory-group
-                .path("delete").path("2").path("pearl")
+                .path("dory-group").path("pearl")
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue("dory", "pass"))
                 .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
@@ -331,7 +329,7 @@
     public void testDeleteDeletedMember () throws UniformInterfaceException,
             ClientHandlerException, KustvaktException {
         ClientResponse response = resource().path(API_VERSION).path("group")
-                .path("member").path("delete").path("2").path("pearl")
+                .path("dory-group").path("pearl")
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue("dory", "pass"))
                 .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
@@ -348,12 +346,12 @@
         assertEquals("[pearl, dory-group]", node.at("/errors/0/2").asText());
     }
 
-    private void testDeleteGroup (String groupId)
+    private void testDeleteGroup (String groupName)
             throws UniformInterfaceException, ClientHandlerException,
             KustvaktException {
         // delete group
         ClientResponse response = resource().path(API_VERSION).path("group")
-                .path("delete").path(groupId)
+                .path(groupName)
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue(username, "pass"))
                 .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
@@ -388,9 +386,9 @@
     @Test
     public void testDeleteGroupUnauthorized () throws UniformInterfaceException,
             ClientHandlerException, KustvaktException {
-        // dory is a group admin in marlin group
+        // dory is a group admin in marlin-group
         ClientResponse response = resource().path(API_VERSION).path("group")
-                .path("delete").path("1")
+                .path("marlin-group")
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue("dory", "pass"))
                 .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
@@ -410,7 +408,7 @@
     public void testDeleteDeletedGroup () throws UniformInterfaceException,
             ClientHandlerException, KustvaktException {
         ClientResponse response = resource().path(API_VERSION).path("group")
-                .path("delete").path("4")
+                .path("deleted-group")
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue("dory", "pass"))
                 .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
@@ -429,10 +427,10 @@
     @Test
     public void testDeleteGroupOwner () throws UniformInterfaceException,
             ClientHandlerException, KustvaktException {
-        // delete marlin from marlin group
-        // dory is a group admin in marlin group
+        // delete marlin from marlin-group
+        // dory is a group admin in marlin-group
         ClientResponse response = resource().path(API_VERSION).path("group")
-                .path("member").path("delete").path("1").path("marlin")
+                .path("marlin-group").path("marlin")
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue("dory", "pass"))
                 .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
@@ -447,17 +445,16 @@
                 node.at("/errors/0/1").asText());
     }
 
-    private void testInviteMember (String groupId)
+    private void testInviteMember (String groupName)
             throws UniformInterfaceException, ClientHandlerException,
             KustvaktException {
         String[] members = new String[] { "darla" };
 
         UserGroupJson userGroup = new UserGroupJson();
         userGroup.setMembers(members);
-        userGroup.setId(Integer.parseInt(groupId));
 
         ClientResponse response = resource().path(API_VERSION).path("group")
-                .path("member").path("invite").type(MediaType.APPLICATION_JSON)
+                .path(groupName).path("invite").type(MediaType.APPLICATION_JSON)
                 .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue(username, "pass"))
@@ -490,11 +487,9 @@
 
         UserGroupJson userGroup = new UserGroupJson();
         userGroup.setMembers(members);
-        // dory group
-        userGroup.setId(2);
 
         ClientResponse response = resource().path(API_VERSION).path("group")
-                .path("member").path("invite").type(MediaType.APPLICATION_JSON)
+                .path("dory-group").path("invite").type(MediaType.APPLICATION_JSON)
                 .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue("dory", "pass"))
@@ -519,11 +514,9 @@
 
         UserGroupJson userGroup = new UserGroupJson();
         userGroup.setMembers(members);
-        // dory group
-        userGroup.setId(2);
 
         ClientResponse response = resource().path(API_VERSION).path("group")
-                .path("member").path("invite").type(MediaType.APPLICATION_JSON)
+                .path("dory-group").path("invite").type(MediaType.APPLICATION_JSON)
                 .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue("dory", "pass"))
@@ -549,11 +542,9 @@
 
         UserGroupJson userGroup = new UserGroupJson();
         userGroup.setMembers(members);
-        // dory group
-        userGroup.setId(2);
 
         ClientResponse response = resource().path(API_VERSION).path("group")
-                .path("member").path("invite").type(MediaType.APPLICATION_JSON)
+                .path("dory-group").path("invite").type(MediaType.APPLICATION_JSON)
                 .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue("dory", "pass"))
@@ -580,11 +571,9 @@
 
         UserGroupJson userGroup = new UserGroupJson();
         userGroup.setMembers(members);
-        // dory group
-        userGroup.setId(2);
 
         ClientResponse response = resource().path(API_VERSION).path("group")
-                .path("member").path("invite").type(MediaType.APPLICATION_JSON)
+                .path("dory-group").path("invite").type(MediaType.APPLICATION_JSON)
                 .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue("dory", "pass"))
@@ -612,11 +601,9 @@
 
         UserGroupJson userGroup = new UserGroupJson();
         userGroup.setMembers(members);
-        // dory's deleted group
-        userGroup.setId(4);
 
         ClientResponse response = resource().path(API_VERSION).path("group")
-                .path("member").path("invite").type(MediaType.APPLICATION_JSON)
+                .path("deleted-group").path("invite").type(MediaType.APPLICATION_JSON)
                 .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue("dory", "pass"))
@@ -635,15 +622,12 @@
     // marlin has GroupMemberStatus.PENDING in dory-group
     @Test
     public void testSubscribePendingMember () throws KustvaktException {
-        MultivaluedMap<String, String> form = new MultivaluedMapImpl();
-        form.add("groupId", "2");
-
         ClientResponse response = resource().path(API_VERSION).path("group")
-                .path("subscribe").type(MediaType.APPLICATION_FORM_URLENCODED)
+                .path("dory-group").path("subscribe")
                 .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue("marlin", "pass"))
-                .entity(form).post(ClientResponse.class);
+                .post(ClientResponse.class);
 
         assertEquals(Status.OK.getStatusCode(), response.getStatus());
 
@@ -666,8 +650,8 @@
                 group.at("/userRoles/1").asText());
 
         // unsubscribe marlin from dory-group
-        testUnsubscribeActiveMember(form);
-        checkGroupMemberRole("2", "marlin");
+        testUnsubscribeActiveMember("dory-group");
+        checkGroupMemberRole("dory-group", "marlin");
 
         // invite marlin to dory-group to set back the
         // GroupMemberStatus.PENDING
@@ -677,15 +661,12 @@
     // pearl has GroupMemberStatus.DELETED in dory-group
     @Test
     public void testSubscribeDeletedMember () throws KustvaktException {
-        MultivaluedMap<String, String> form = new MultivaluedMapImpl();
-        form.add("groupId", "2");
-
         ClientResponse response = resource().path(API_VERSION).path("group")
-                .path("subscribe").type(MediaType.APPLICATION_FORM_URLENCODED)
+                .path("dory-group").path("subscribe")
                 .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue("pearl", "pass"))
-                .entity(form).post(ClientResponse.class);
+                .post(ClientResponse.class);
         String entity = response.getEntity(String.class);
         JsonNode node = JsonUtils.readTree(entity);
 
@@ -697,34 +678,25 @@
     }
 
     @Test
-    public void testSubscribeMissingGroupId () throws KustvaktException {
+    public void testSubscribeMissingGroupName() throws KustvaktException {
         ClientResponse response = resource().path(API_VERSION).path("group")
                 .path("subscribe")
                 .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue("bruce", "pass"))
                 .post(ClientResponse.class);
-        String entity = response.getEntity(String.class);
-        JsonNode node = JsonUtils.readTree(entity);
-
-        assertEquals(Status.BAD_REQUEST.getStatusCode(), response.getStatus());
-        assertEquals(StatusCodes.MISSING_PARAMETER,
-                node.at("/errors/0/0").asInt());
-        assertEquals("groupId is missing", node.at("/errors/0/1").asText());
-        assertEquals("groupId", node.at("/errors/0/2").asText());
+        assertEquals(Status.METHOD_NOT_ALLOWED.getStatusCode(),
+                response.getStatus());
     }
 
     @Test
     public void testSubscribeNonExistentMember () throws KustvaktException {
-        MultivaluedMap<String, String> form = new MultivaluedMapImpl();
-        form.add("groupId", "2");
-
         ClientResponse response = resource().path(API_VERSION).path("group")
-                .path("subscribe").type(MediaType.APPLICATION_FORM_URLENCODED)
+                .path("dory-group").path("subscribe")
                 .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue("bruce", "pass"))
-                .entity(form).post(ClientResponse.class);
+                .post(ClientResponse.class);
         String entity = response.getEntity(String.class);
         // System.out.println(entity);
         JsonNode node = JsonUtils.readTree(entity);
@@ -738,38 +710,31 @@
 
     @Test
     public void testSubscribeToNonExistentGroup () throws KustvaktException {
-        MultivaluedMap<String, String> form = new MultivaluedMapImpl();
-        form.add("groupId", "100");
-
         ClientResponse response = resource().path(API_VERSION).path("group")
-                .path("subscribe").type(MediaType.APPLICATION_FORM_URLENCODED)
+                .path("non-existent").path("subscribe")
                 .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue("pearl", "pass"))
-                .entity(form).post(ClientResponse.class);
+                .post(ClientResponse.class);
         String entity = response.getEntity(String.class);
-        // System.out.println(entity);
         JsonNode node = JsonUtils.readTree(entity);
 
-        assertEquals(Status.BAD_REQUEST.getStatusCode(), response.getStatus());
-        assertEquals(StatusCodes.GROUP_NOT_FOUND,
+        assertEquals(Status.NOT_FOUND.getStatusCode(), response.getStatus());
+        assertEquals(StatusCodes.NO_RESOURCE_FOUND,
                 node.at("/errors/0/0").asInt());
-        assertEquals("Group with id 100 is not found",
+        assertEquals("Group non-existent is not found",
                 node.at("/errors/0/1").asText());
     }
 
-    private void testSubscribeToDeletedGroup (String groupId)
+    private void testSubscribeToDeletedGroup (String groupName)
             throws UniformInterfaceException, ClientHandlerException,
             KustvaktException {
-        MultivaluedMap<String, String> form = new MultivaluedMapImpl();
-        form.add("groupId", groupId);
-
         ClientResponse response = resource().path(API_VERSION).path("group")
-                .path("subscribe").type(MediaType.APPLICATION_FORM_URLENCODED)
+                .path(groupName).path("subscribe")
                 .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue("nemo", "pass"))
-                .entity(form).post(ClientResponse.class);
+                .post(ClientResponse.class);
 
         assertEquals(Status.BAD_REQUEST.getStatusCode(), response.getStatus());
 
@@ -780,16 +745,15 @@
                 node.at("/errors/0/1").asText());
     }
 
-    private void testUnsubscribeActiveMember (
-            MultivaluedMap<String, String> form)
+    private void testUnsubscribeActiveMember (String groupName)
             throws UniformInterfaceException, ClientHandlerException,
             KustvaktException {
         ClientResponse response = resource().path(API_VERSION).path("group")
-                .path("unsubscribe").type(MediaType.APPLICATION_FORM_URLENCODED)
+                .path(groupName).path("unsubscribe")
                 .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue("marlin", "pass"))
-                .entity(form).post(ClientResponse.class);
+                .delete(ClientResponse.class);
 
         assertEquals(Status.OK.getStatusCode(), response.getStatus());
 
@@ -797,10 +761,10 @@
         assertEquals(1, node.size());
     }
 
-    private void checkGroupMemberRole (String groupId, String deletedMemberName)
+    private void checkGroupMemberRole (String groupName, String deletedMemberName)
             throws KustvaktException {
         ClientResponse response = resource().path(API_VERSION).path("group")
-                .path(groupId)
+                .path(groupName)
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue(admin, "pass"))
                 .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
@@ -825,16 +789,12 @@
             throws UniformInterfaceException, ClientHandlerException,
             KustvaktException {
         // pearl unsubscribes from dory-group
-        MultivaluedMap<String, String> form = new MultivaluedMapImpl();
-        // dory-group
-        form.add("groupId", "2");
-
         ClientResponse response = resource().path(API_VERSION).path("group")
-                .path("unsubscribe").type(MediaType.APPLICATION_FORM_URLENCODED)
+                .path("dory-group").path("unsubscribe")
                 .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue("pearl", "pass"))
-                .entity(form).post(ClientResponse.class);
+                .delete(ClientResponse.class);
 
         String entity = response.getEntity(String.class);
         // System.out.println(entity);
@@ -855,16 +815,12 @@
         JsonNode node = retrieveUserGroups("marlin");
         assertEquals(2, node.size());
 
-        MultivaluedMap<String, String> form = new MultivaluedMapImpl();
-        // dory-group
-        form.add("groupId", "2");
-
         ClientResponse response = resource().path(API_VERSION).path("group")
-                .path("unsubscribe").type(MediaType.APPLICATION_FORM_URLENCODED)
+                .path("dory-group").path("unsubscribe")
                 .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue("marlin", "pass"))
-                .entity(form).post(ClientResponse.class);
+                .delete(ClientResponse.class);
 
         assertEquals(Status.OK.getStatusCode(), response.getStatus());
 
@@ -877,38 +833,25 @@
     }
 
     @Test
-    public void testUnsubscribeMissingGroupId () throws KustvaktException {
-        MultivaluedMap<String, String> form = new MultivaluedMapImpl();
-
+    public void testUnsubscribeMissingGroupName () throws KustvaktException {
         ClientResponse response = resource().path(API_VERSION).path("group")
-                .path("unsubscribe").type(MediaType.APPLICATION_FORM_URLENCODED)
+                .path("unsubscribe")
                 .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue("marlin", "pass"))
-                .entity(form).post(ClientResponse.class);
+                .delete(ClientResponse.class);
 
-        assertEquals(Status.BAD_REQUEST.getStatusCode(), response.getStatus());
-
-        String entity = response.getEntity(String.class);
-        JsonNode node = JsonUtils.readTree(entity);
-
-        assertEquals(StatusCodes.MISSING_PARAMETER,
-                node.at("/errors/0/0").asInt());
-        assertEquals("groupId is missing", node.at("/errors/0/1").asText());
-        assertEquals("groupId", node.at("/errors/0/2").asText());
+        assertEquals(Status.NOT_FOUND.getStatusCode(), response.getStatus());
     }
 
     @Test
     public void testUnsubscribeNonExistentMember () throws KustvaktException {
-        MultivaluedMap<String, String> form = new MultivaluedMapImpl();
-        form.add("groupId", "2");
-
         ClientResponse response = resource().path(API_VERSION).path("group")
-                .path("unsubscribe").type(MediaType.APPLICATION_FORM_URLENCODED)
+                .path("dory-group").path("unsubscribe")
                 .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue("bruce", "pass"))
-                .entity(form).post(ClientResponse.class);
+                .delete(ClientResponse.class);
 
         assertEquals(Status.BAD_REQUEST.getStatusCode(), response.getStatus());
 
@@ -923,39 +866,34 @@
 
     @Test
     public void testUnsubscribeToNonExistentGroup () throws KustvaktException {
-        MultivaluedMap<String, String> form = new MultivaluedMapImpl();
-        form.add("groupId", "100");
-
         ClientResponse response = resource().path(API_VERSION).path("group")
-                .path("unsubscribe").type(MediaType.APPLICATION_FORM_URLENCODED)
+                .path("tralala-group").path("unsubscribe")
                 .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue("pearl", "pass"))
-                .entity(form).post(ClientResponse.class);
+                .delete(ClientResponse.class);
 
-        assertEquals(Status.BAD_REQUEST.getStatusCode(), response.getStatus());
+        assertEquals(Status.NOT_FOUND.getStatusCode(), response.getStatus());
 
         String entity = response.getEntity(String.class);
         JsonNode node = JsonUtils.readTree(entity);
 
-        assertEquals(StatusCodes.GROUP_NOT_FOUND,
+        assertEquals(StatusCodes.NO_RESOURCE_FOUND,
                 node.at("/errors/0/0").asInt());
-        assertEquals("Group with id 100 is not found",
+        assertEquals("Group tralala-group is not found",
                 node.at("/errors/0/1").asText());
     }
 
-    private void testUnsubscribeToDeletedGroup (String groupId)
+    private void testUnsubscribeToDeletedGroup (String groupName)
             throws UniformInterfaceException, ClientHandlerException,
             KustvaktException {
-        MultivaluedMap<String, String> form = new MultivaluedMapImpl();
-        form.add("groupId", groupId);
 
         ClientResponse response = resource().path(API_VERSION).path("group")
-                .path("unsubscribe").type(MediaType.APPLICATION_FORM_URLENCODED)
+                .path(groupName).path("unsubscribe")
                 .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue("nemo", "pass"))
-                .entity(form).post(ClientResponse.class);
+                .delete(ClientResponse.class);
 
         assertEquals(Status.BAD_REQUEST.getStatusCode(), response.getStatus());
 
@@ -970,12 +908,11 @@
     public void testAddSameMemberRole () throws UniformInterfaceException,
             ClientHandlerException, KustvaktException {
         MultivaluedMap<String, String> form = new MultivaluedMapImpl();
-        form.add("groupId", "1");
         form.add("memberUsername", "dory");
         form.add("roleIds", "1");
 
         ClientResponse response = resource().path(API_VERSION).path("group")
-                .path("member").path("role").path("add")
+                .path("marlin-group").path("role").path("add")
                 .type(MediaType.APPLICATION_FORM_URLENCODED)
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue("marlin", "pass"))
@@ -992,12 +929,11 @@
     public void testDeleteAddMemberRole () throws UniformInterfaceException,
             ClientHandlerException, KustvaktException {
         MultivaluedMap<String, String> form = new MultivaluedMapImpl();
-        form.add("groupId", "1");
         form.add("memberUsername", "dory");
         form.add("roleIds", "1");
 
         ClientResponse response = resource().path(API_VERSION).path("group")
-                .path("member").path("role").path("delete")
+                .path("marlin-group").path("role").path("delete")
                 .type(MediaType.APPLICATION_FORM_URLENCODED)
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue("marlin", "pass"))
@@ -1016,15 +952,14 @@
     public void testEditMemberRoleEmpty () throws UniformInterfaceException,
             ClientHandlerException, KustvaktException {
         MultivaluedMap<String, String> form = new MultivaluedMapImpl();
-        form.add("groupId", "1");
         form.add("memberUsername", "dory");
-
+        
         ClientResponse response = resource().path(API_VERSION).path("group")
-                .path("member").path("role").path("edit")
+                .path("marlin-group").path("role").path("edit")
                 .type(MediaType.APPLICATION_FORM_URLENCODED)
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue("marlin", "pass"))
-                .entity(form).post(ClientResponse.class);
+                .post(ClientResponse.class, form);
 
         assertEquals(Status.OK.getStatusCode(), response.getStatus());
 
@@ -1032,17 +967,19 @@
         Set<Role> roles = member.getRoles();
         assertEquals(0, roles.size());
 
-        testEditMemberRole(form);
+        testEditMemberRole();
     }
 
-    private void testEditMemberRole (MultivaluedMap<String, String> form)
+    private void testEditMemberRole ()
             throws UniformInterfaceException, ClientHandlerException,
             KustvaktException {
+        MultivaluedMap<String, String> form = new MultivaluedMapImpl();
+        form.add("memberUsername", "dory");
         form.add("roleIds", "1");
         form.add("roleIds", "3");
 
         ClientResponse response = resource().path(API_VERSION).path("group")
-                .path("member").path("role").path("edit")
+                .path("marlin-group").path("role").path("edit")
                 .type(MediaType.APPLICATION_FORM_URLENCODED)
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue("marlin", "pass"))
diff --git a/full/src/test/java/de/ids_mannheim/korap/web/controller/VirtualCorpusControllerTest.java b/full/src/test/java/de/ids_mannheim/korap/web/controller/VirtualCorpusControllerTest.java
index 297d3ab..13e1ec9 100644
--- a/full/src/test/java/de/ids_mannheim/korap/web/controller/VirtualCorpusControllerTest.java
+++ b/full/src/test/java/de/ids_mannheim/korap/web/controller/VirtualCorpusControllerTest.java
@@ -353,28 +353,28 @@
         assertTrue(node.at("/userGroupName").asText().startsWith("auto"));
         assertEquals(vcName, node.at("/vcName").asText());
 
-        String groupId = node.at("/userGroupId").asText();
+        String groupName = node.at("/userGroupName").asText();
 
         // EM: check if hidden group has been created
-        node = testCheckHiddenGroup(groupId);
+        node = testCheckHiddenGroup(groupName);
         assertEquals("HIDDEN", node.at("/status").asText());
 
         // EM: delete vc
         testDeleteVC(vcName, "VirtualCorpusControllerTest");
 
         // EM: check if the hidden groups are deleted as well
-        node = testCheckHiddenGroup(groupId);
-        assertEquals(StatusCodes.GROUP_NOT_FOUND,
+        node = testCheckHiddenGroup(groupName);
+        assertEquals(StatusCodes.NO_RESOURCE_FOUND,
                 node.at("/errors/0/0").asInt());
-        assertEquals("Group with id " + groupId + " is not found",
+        assertEquals("Group "+ groupName + " is not found",
                 node.at("/errors/0/1").asText());
     }
 
-    private JsonNode testCheckHiddenGroup (String groupId)
+    private JsonNode testCheckHiddenGroup (String groupName)
             throws UniformInterfaceException, ClientHandlerException,
             KustvaktException {
         ClientResponse response = resource().path(API_VERSION).path("group")
-                .path(groupId)
+                .path(groupName)
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue("admin", "pass"))
                 .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
