You cannot use the REST API from a web page. It can neither be done securely nor scalably (nor cross-origin for that matter).