My Project
Aug. 12th, 2011 05:23 pmI've been hired to build a website. It will contain a form through which users can submit a description of a web services API which conforms to constraints of REST. Users can define a set of HTTP request messages, and the structure of JSON response messages. (Just JSON. He specifically said I don't have to care about XML at this stage.) I'm supposed to define a database schema that encompasses as many APIs as possible that a client could ask for, so long as it falls within those constraints.
I have two weeks to get this done. The design and user interface is trivial. Learning the web framework and writing the code will take an intermediate amount of time. The majority of the time I expect to spend educating myself about REST enough to include enough in the database schema. For a couple of years I have been reading brief articles and Wikipedia entries about web APIs and REST, but have no experience using either of them in any capacity.
My employer advised me to do a Google Images search on "REST API" and look at the UML diagrams there; but I don't know how to interpret the boxes and arrows, and most of the terms are jargon which I don't know.
I've been searching around various Google hits on the relevant search terms, but is there some kind of comprehensive catalog of what can go into a RESTful web-services API?
I have two weeks to get this done. The design and user interface is trivial. Learning the web framework and writing the code will take an intermediate amount of time. The majority of the time I expect to spend educating myself about REST enough to include enough in the database schema. For a couple of years I have been reading brief articles and Wikipedia entries about web APIs and REST, but have no experience using either of them in any capacity.
My employer advised me to do a Google Images search on "REST API" and look at the UML diagrams there; but I don't know how to interpret the boxes and arrows, and most of the terms are jargon which I don't know.
I've been searching around various Google hits on the relevant search terms, but is there some kind of comprehensive catalog of what can go into a RESTful web-services API?
no subject
Date: 2011-08-12 09:41 pm (UTC)no subject
Date: 2011-08-13 02:21 pm (UTC)no subject
Date: 2011-08-15 02:25 pm (UTC)You technically can call SOAP web services with a GET, and those services are perfectly free to change whatever data they feel like. Having a GET that changes any data is a huge no-no in REST.
no subject
Date: 2011-08-13 01:36 am (UTC)no subject
Date: 2011-08-15 02:38 pm (UTC)For a GET, the message is just the URL, and the whole operation is supposed to look basically like it's a static web site, and the data you're looking for just happens to live at that location. Performing a GET should have no consequences, and you should not have any qualms about just tossing the URL into a web browser to have a look.
A PUT is the converse of a get, and ideally, the same URL could be used for reading and writing. For an example, you could do a GET on http://example.org/customers/1234, and the response would be a document containing the customer information for customer #1234. You make a couple modifications and PUT the edited version back to the same URL, and then a later GET would retrieve your version. PUTs are supposed to be idempotent (no change in results if you run it twice) -- if you post the same customer information again, it should already match what's there, so there would be no change.
A POST is the only one that's essentially (at the application level, not HTTP) just passing a message to the server. You'd do that for events, and for things that are just too hard to make idempotent.