code: @Override
      @Path("/{roleName}")
      @ApiOperation(value="Retrieve a role or all roles",
          notes="If roleName is not present, returns all roles.",
          response=Role.class, responseContainer="List")
      public JSONObject get(String path, Map<String,String> headers) throws ServiceException, JSONException {
          UserServices userServices = ServiceLocator.getUserServices();
          Map<String,String> parameters = getParameters(headers);
          try {
              String roleName = parameters.get("name");
              if (roleName == null) // use request path
                  roleName = getSegment(path, 1);
              if (roleName != null) {
                  Role role = userServices.getRole(roleName);
                  if (role == null)
                      throw new ServiceException(HTTP_404_NOT_FOUND, "Role not found: " + roleName);
                  return role.getJson();
              }
              else {
                  return userServices.getRoles().getJson();
              }
          }
          catch (DataAccessException ex) {
              throw new ServiceException(ex.getMessage(), ex);
          }
      }
docs: Retrieve a user role or the list of all roles.