Quiz
- Can REST APIs and Ajax be used together or are they separate?
Hmm. They are different ideas, but closely associated. Ajax is the technology of a web browser talking to a server. Ajax request use HTTP methods, like GET, POST, PUT, DELETE and so forth.
REST is a somewhat standardized way of using those HTTP methods in a useful and comprehensible way. It's like a set of conventions about how to use HTTP methods and various back-ends.
- I understand the concepts from this reading, but I don't really understand the reason for why REST API is called that (Representational State Transfer). Can you explain it?
A fair question, but maybe hard to answer. I'll try. Consider Coffeerun as an example. The state of the app at any one time is the set of all the pending orders. We need to represent that state, which we did with a dictionary (JS object literal).
We want to be able to transfer that state representation between the browser and the cloud server. REST is a set of METHODs and URL naming conventions that allow us to do that.
- Can we go over the catAPI example again? Whenever I tried to look at the cat API links from the reading it would just take me to the Yahoo home page.
They may have taken it down, which would be a shame. Sorry about that.