what is a rest api and how does it work