[webui][api] refactoring to make the code more object oriented
[webui][api] Refactoring. GET and POST now working via JSON. Object oriented code now in place too.
[api][webui] GET request for project/package/request now being made from the controller itself
[webui][api] DRYed up [webui] and fixed a bug in [api] for request
[webui][api] Added error handling and DRYed up code.