[webui][api] Refactoring. GET and POST now working via JSON. Object oriented code now in place too.