public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        response.setContentType("text/html;charset=utf-8");
        response.setStatus(HttpServletResponse.SC_OK);
        JSONObject result;
        Pattern p = Pattern.compile("/db/api/([\\w]+)/([\\w]+)/");
        Matcher m = p.matcher(request.getRequestURI());
        try {
            if (!m.matches()) {
                response.getWriter().println(badRequest("invalid url").toString());
                return;
            }
            String entity = m.group(1);
            String method = m.group(2);

            Map<String,String> arguments = new HashMap<>();
            StringBuffer body = new StringBuffer();
            String line;

            BufferedReader reader = request.getReader();
            while ((line = reader.readLine()) != null) {
                body.append(line);
            }
            JSONObject bodyJson = new JSONObject(body.toString());

            Iterator<String> iterator = bodyJson.keys();
            while (iterator.hasNext()) {
                String key = iterator.next();

                String value = bodyJson.getString(key);
                arguments.put(key, parseAray(value));
            }

            System.out.println("////");
            System.out.println(entity+" | "+method);
            for(String arg : arguments.values())
                System.out.println(arg);

            result = api.handleApiRequest(entity, method, arguments);
            if(result != null) {
                System.out.println("\\\\");
                System.out.println(result.toString());

                response.getWriter().println(makeUnicodeCharactersEscaped(result.toString()));
            }
            else
                response.getWriter().println(badRequest("api error"));
        } catch (JSONException e) {
            e.printStackTrace();
        }
    }