|
|
REST & WOA Wiki > Work in Progress > Atom-based Shopping Cart
Atom-based Shopping CartFrom $1Table of contentsWorkflow
I think that covers the outline workflow of pretty much all checkout in the real world Shopping Cart Media-TypeBelow is a complete shopping cart Atom feed. In the next sections, we're looking at its building blocks. <feed xmlns='http://www.w3.org/2005/Atom' xmlns:cart='http://schemas.acme.corp/cart/2008'>
<id>http://www.acme.corp/carts/bob%40gmail.com/full</id>
<updated>2008-07-11T22:10:30.252Z</updated>
<title type="text">Bob's Shopping Cart</title>
<link rel="self" type="application/atom+xml" href="http://www.acme.corp/carts/bob%40gmail.com/full"/>
<author>
<name>Bob</name>
<email>bob@gmail.com</email>
</author>
<generator version="1.0" uri="http://www.acme.corp/cart">ACME Shopping Cart</generator>
<entry>
<id>http://www.acme.corp/carts/bob%40gmail.com/item1</id>
<published>2008-07-11T22:10:30.257Z</published>
<updated>2008-07-11T21:46:35.000Z</updated>
<title type="text">Rasperry Jello</title>
<link rel="alternate" type="text/html" href="http://www.acme.corp/products/jello"/>
<link rel="self" type="application/atom+xml" href="http://www.acme.corp/carts/bob%40gmail.com/item1"/>
<link rel="edit" type="application/atom+xml" href="http://www.acme.corp/carts/bob%40gmail.com/item1"/>
<cart:quantity value="2"/>
<cart:unit-price value="$0.99"/>
</entry>
<entry>
<id>http://www.acme.corp/carts/bob%40gmail.com/item2</id>
<published>2008-07-11T22:10:30.258Z</published>
<updated>2008-07-11T21:50:15.000Z</updated>
<title type="text">Trident Bubblegum Megapack</title>
<link rel="alternate" type="text/html" href="http://www.acme.corp/products/trident"/>
<link rel="self" type="application/atom+xml" href="http://www.acme.corp/carts/bob%40gmail.com/item2"/>
<link rel="edit" type="application/atom+xml" href="http://www.acme.corp/carts/bob%40gmail.com/item2"/>
<cart:quantity value="1"/>
<cart:unit-price value="$1.99"/>
</entry>
</feed> Items in the shopping cart are captured by Atom entries. <entry xmlns='http://www.w3.org/2005/Atom' xmlns:cart='http://schemas.acme.corp/cart/2008'> <id>http://www.acme.corp/carts/bob%40gmail.com/item1</id> <published>2008-07-11T22:10:30.257Z</published> <updated>2008-07-11T21:46:35.000Z</updated> <title type="text">Rasperry Jello</title> <link rel="alternate" type="text/html" href="http://www.acme.corp/products/jello"/> <link rel="self" type="application/atom+xml" href="http://www.acme.corp/carts/bob%40gmail.com/item1"/> <link rel="edit" type="application/atom+xml" href="http://www.acme.corp/carts/bob%40gmail.com/item1"/> <cart:quantity value="2"/> <cart:unit-price value="$0.99"/> </entry The <title> element contains the name of the itme. The <link rel="alternative"> link points to the item's description page. And the <link rel="edit"> link indicates where a client can submit PUT requests to modify the contents of the item or submit DELETE to remove the item from the shopping cart.
Tags:
|