Cap 2 Designing Restful Services

Model the URIs

The /orders URI represents all the orders in our system. To access an individual order, we will use a pattern: /orders/{id}. The {id} string is a pattern that represents an individual order. It can be any integer value that corresponds to the id property of our Order object

Defining the Data Format

XML is perhaps one of the most popular formats on the Web and can be processed by most modern languages, so let’s choose that. JSON is also a popular format, as it is more condensed and JavaScript can interpret it directly (great for Ajax applications), but let’s stick to XML for now.

Read and Update Format

Il formato xml è un po' differente quando leggiamo o aggiorniamo una risorsa rispetto a quando la creiamo.

Common link element

Each format for Order, Customer, and Product will have a common XML element called link:

<link rel="self" href="http://example.com/..."/>

Con questo link si interagisce
Salvo diversa indicazione, il contenuto di questa pagina è sotto licenza Creative Commons Attribution-ShareAlike 3.0 License