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")
