Difference between revisions of "XML Format"

From the Directed Edge Developer Base
Jump to: navigation, search
(XML Header)
(describe item element)
Line 31: Line 31:
  
 
Nothing too exotic here for the moment.  This wraps up all of the stuff that you'll send our receive for the moment.  Version is always ''0.1'' for the moment because, well, we're too lazy to bump the version.  (Though we'll do better versioning once we're out of beta.)
 
Nothing too exotic here for the moment.  This wraps up all of the stuff that you'll send our receive for the moment.  Version is always ''0.1'' for the moment because, well, we're too lazy to bump the version.  (Though we'll do better versioning once we're out of beta.)
 +
 +
== item element ==
 +
 +
An item is the container for all of the stuff in our database.  Exactly what items are is explained in [[API Concepts]].
 +
 +
=== id attribute ===
 +
 +
Every item ''must'' have an id attribute.  That's the handle that we use to refer to the item everywhere.  If you want to update or delete the item, you refer to it by its ''id''.  You can use any scheme that you want to for creating item identifiers, so long as they're unique.  Often something like ''type''_''number'' is convenient.
 +
 +
== tag element ==
 +
 +
== property element ==
 +
 +
== link element ==

Revision as of 05:49, 20 May 2009

So, keeping in mind all of the basic structures from API Concepts, here's what they look like in XML.

First example

<?xml version="1.0" encoding="UTF-8"?>
<directededge version="0.1">
 <item id='user_1'>
  <link>product_1</link>
  <tag>customer</tag>
  <property name='last name'>Schmidt</property>
  <property name='first name'>Bob</property>
 </item>
 <item id='product_1'>
  <tag>product</tag>
  <property name='artist'>Beatles</property>
  <property name='name'>White Album</property>
 </item>
</directededge>

Here we've got a customer, named Bob Schmidt that's connected to an album called The White Album by Beatles. So we've got two items and one link. Let's start breaking this down a little.

XML header

<?xml version="1.0" encoding="UTF-8"?>

Good old garden variety Wikipedia:XML XML header. We prefer UTF-8, but we shouldn't blow up if you send us other stuff.

directededge element

<directededge version="0.1">

Nothing too exotic here for the moment. This wraps up all of the stuff that you'll send our receive for the moment. Version is always 0.1 for the moment because, well, we're too lazy to bump the version. (Though we'll do better versioning once we're out of beta.)

item element

An item is the container for all of the stuff in our database. Exactly what items are is explained in API Concepts.

id attribute

Every item must have an id attribute. That's the handle that we use to refer to the item everywhere. If you want to update or delete the item, you refer to it by its id. You can use any scheme that you want to for creating item identifiers, so long as they're unique. Often something like type_number is convenient.

tag element

property element

link element