<?xml version="1.0" encoding="UTF-8"?>
<!-- edited with XMLSPY v5 rel. 3 U (http://www.xmlspy.com)
     by Daniel M Kohn (private) -->

<!DOCTYPE rfc SYSTEM "rfc2629.dtd" [
    <!ENTITY rfc2119 PUBLIC '' 
      'reference.RFC.2119.xml'>
]>

<?xml-stylesheet type='text/xsl' href='rfc2629.xml' ?>   

<?rfc toc="yes" ?>
<?rfc symrefs="yes" ?>
<?rfc sortrefs="yes"?>
<?rfc iprnotified="yes" ?>
<?rfc strict="yes" ?>

<rfc category="std" ipr="full2026" docName="draft-gregorio-01.html">
    <front>
        <title>The EchoAPI</title>
        <author initials='J.C.' surname="Gregorio" fullname='Joe Gregorio'>
            <organization>BitWorking, Inc</organization>
	        <address>
		<postal>
		    <street>1002 Heathwood Dairy Rd.</street>
		    <city>Apex</city> <region>NC</region> <code>27502</code>
		    <country>US</country>
		</postal>
		<phone>+1 919 272 3764</phone>
		<email>joe@bitworking.com</email>
		<uri>http://bitworking.com/</uri>
                </address>
        </author>
        <date day="5" month="July" year="2003"/>
        <abstract><t>This memo presents a technique for 
using XML (Extensible Markup Language) and HTTP (HyperText Transport Protocol)
to edit content. </t></abstract>
    </front>

    <middle>

        <section title="Introduction">

           <t>EchoAPI is an application level protocol for publishing, and editing web resources. 
              EchoAPI unifies many disparate publishing mechanisms into a single, simple, 
              extensible protocol. The protocol at its core is the HTTP transport of an XML payload. 
           </t>
       </section>

       <section title="Terminology">
            <t>The key words "MUST", "MUST NOT", "REQUIRED", "SHALL",
            "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY",the 
            and "OPTIONAL" in this document are to be interpreted as
            described in RFC2119.</t>
       </section>

       <section title="Scope">
            <t>This document covers the editing of content of a periodically updating website using the 
               HTTP and XML. Many of the XML payloads are in Echo format, which will not be documented here.
            </t>
            <t>This specification will mirror some of the functionality of the <eref target="http://www.blogger.com/developers/api/documentation20.html">Blogger 2.0 API</eref>, which
               includes support for the <eref target="http://scripts.incutio.com/xmlrpc/introspection.html">Server Introspection API</eref>.
            </t>
       </section>

       <section title="The EchoAPI Model">
          <section title="Introspection">
            <t>When editing the content of the website http://example.org/reilly, the first thing to do is find out the 
               servers capabilites. Each server may only implement a subset of this specification, and the 'introspection' file
               lists all the functions that each site supports. This mirrors the <eref target="http://scripts.incutio.com/xmlrpc/introspection.html">Server Introspection API</eref>
               used by the Blogger 2.0 API. 
            </t>

            <figure title="Introspection">
                 <artwork><![CDATA[
<?xml version="1.0" encoding='iso-8859-1'?>
<introspection> 
  <edit-entry>http://example.org/reilly/</edit-entry>
  <user-prefs>http://example.org/reilly/prefs</user-prefs>
</introspection>  ]]></artwork>
            </figure>

            <figure title="Introspection">
                 <preamble>This site furnishes only a minimal set of functionality. A more full featured site might return:</preamble>
                 <artwork><![CDATA[
<?xml version="1.0" encoding='iso-8859-1'?>
<introspection> 
  <edit-entry>http://example.org/reilly/</edit-entry>
  <user-prefs>http://example.org/reilly/prefs</user-prefs>
  <edit-template>http://example.org/reilly/templates</edit-template>
  <categories>http://example.org/reilly/categories</categories>
</introspection>                  ]]></artwork>
            </figure>

	     <t>Where to store the introspection file on the web and how to make the URI of the introspection file easy to find will be discussed later.
             </t>

             <t>This particular introspection file for http://example.org/rielly tells us 
	        that the EchoAPI implementation supports both the 'edit-entry' and the 'user-prefs'
                interfaces, and it also specifies the URIs to use for each of these interfaces. </t>
	     <t>Note that the example URIs given are not normative, nor are
                there any constraints on the 
                URIs that can be specified. The 'edit-entry' URI could just have easily been: </t>

             <figure title="Introspection - Alternate URI 2">
                 <artwork><![CDATA[
http://dev.example.net/api?userid=reilly&amp;action=edit]]></artwork>
             </figure>

	     </section>
             <section title="Creating a new Entry">
               <t>HTTP POST is used for content creation. The new content is formatted as an Echo Entry and then POST'd to the URI given in the 'edit-entry' element of 
                  the introspection file.</t>
               <figure title="Create New Entry">
               <preamble>To create a new Entry on the site the client connects to port 80 on http://example.org and sends:</preamble>
                 <artwork><![CDATA[
POST /reilly HTTP/1.1
Content-Type: application/not-echo+xml

<?xml version="1.0" encoding='iso-8859-1'?>
<entry> 
    <title>My First Entry</title> 
    <subtitle>In which a newbie learns to blog...</subtitle> 
    <summary>A very boring entry...</summary> 
 
    <author> 
      <name>Bob B. Bobbington</name> 
      <homepage>http://bob.name/</homepage> 
      <weblog>http://bob.blog/</weblog> 
    </author> 

    <issued>2003-02-05T12:29:29</issued> 
 
    <content type="application/xhtml+xml" xml:lang="en-us"> 
      <p xmlns="...">Hello, <em>weblog</em> world! 2 &lt; 4!</p> 
    </content>  
</entry> ]]></artwork>
                 <postamble>This would create a new weblog Entry with the title "My First Entry". </postamble>
             </figure>


	     <figure>
               <preamble>Assuming everything goes well and the Entry is created, the response might look like:</preamble>
                 <artwork><![CDATA[
HTTP/1.1 201 Created
Content-Type: application/not-echo+xml

<?xml version="1.0" encoding='iso-8859-1'?>
<entry> 
    <title>My First Entry</title> 
    <subtitle>In which a newbie learns to blog...</subtitle> 
    <summary>A very boring entry...</summary> 
 
    <author> 
      <name>Bob B. Bobbington</name> 
      <homepage>http://bob.name/</homepage> 
      <weblog>http://bob.blog/</weblog> 
    </author> 

    <issued>2003-02-05T12:29:29</issued> 
    <created>2003-02-05T14:10:58Z</created> 
    <modified>2003-02-05T14:10:58Z</modified> 
    
    <link>http://example.org/reilly/2003/02/05#My_First_Entry</link>
    <id>urn:example.org:reilly:1</id>
 
    <content type="application/xhtml+xml" xml:lang="en-us"> 
      <p xmlns="...">Hello, <em>weblog</em> world! 2 &lt; 4!</p> 
    </content>  
</entry> ]]></artwork>
                 <postamble>Information has been added to the Entry, including the 'link', 'id', 'created' and 'modified' elements.</postamble>
             </figure>


             <t>@@ Editors Note: Beware the Echo syntax is still in flux and the above example is not normative. @@</t>
           </section><!-- Creating a new Entry  -->
           <section title="Editing an entry">
	     <t>Editing an Entry is the same as creating one, the difference is that the Entry you POST already
                has 'id' filled in. HTTP POST the modified Echo Entry to the same URI used to create an entry, the 
                URI stored in the 'create-entry' element of the introspection file.
             </t>


	     <figure>
               <preamble>If we update our content element and POST it, the transaction looks like:</preamble>
                 <artwork><![CDATA[
POST /reilly HTTP/1.1
Content-Type: application/not-echo+xml

<?xml version="1.0" encoding='iso-8859-1'?>
<entry> 
    <title>My First Entry</title> 
    <subtitle>In which a newbie learns to blog...</subtitle> 
    <summary>A very boring entry...</summary> 
 
    <author> 
      <name>Bob B. Bobbington</name> 
      <homepage>http://bob.name/</homepage> 
      <weblog>http://bob.blog/</weblog> 
    </author> 

    <issued>2003-02-05T12:29:29</issued> 
    <created>2003-02-05T14:10:58Z</created> 
    <modified>2003-02-05T14:10:58Z</modified> 
    
    <link>http://example.org/reilly/2003/02/05#My_First_Entry</link>
    <id>urn:example.org:reilly:1</id>
 
    <content type="application/xhtml+xml" xml:lang="en-us"> 
      <p xmlns="...">A big hello to the 
         <em>weblog</em> world! 2 &lt; 4!</p> 
    </content>  
</entry> ]]></artwork>
                 <postamble>The server knows this is an update instead of creation from the existence of the 'id' element.</postamble>
             </figure>

	     <figure>
               <preamble>The response from the server is the same, on success returning a filled in Entry:</preamble>
                 <artwork><![CDATA[
HTTP/1.1 200 Ok
Content-Type: application/not-echo+xml


<?xml version="1.0" encoding='iso-8859-1'?>
<entry> 
    <title>My First Entry</title> 
    <subtitle>In which a newbie learns to blog...</subtitle> 
    <summary>A very boring entry...</summary> 
 
    <author> 
      <name>Bob B. Bobbington</name> 
      <homepage>http://bob.name/</homepage> 
      <weblog>http://bob.blog/</weblog> 
    </author> 

    <issued>2003-02-05T12:29:29</issued> 
    <created>2003-02-05T14:10:58Z</created> 
    <modified>2003-02-05T14:20:03Z</modified> 
    
    <link>http://example.org/reilly/2003/02/05#My_First_Entry</link>
    <id>urn:example.org:reilly:1</id>
 
    <content type="application/xhtml+xml" xml:lang="en-us"> 
      <p xmlns="...">A big hello to the 
            <em>weblog</em> world! 2 &lt; 4!</p> 
    </content>  
</entry> ]]></artwork>
                 <postamble>The 'content' element now reflects the updated content, and the 'modifed' element has
		    been updated to reflect when the change was made.</postamble>
             </figure>
 
             <t>How to retrieve the Echo formatted Entry is not covered at this time.</t>

           </section>
           <section title="Deleting an entry">
             <t>Deleting an Entry also uses the same 'edit-entry' URI. </t>

	     <figure>
               <preamble>You POST to the 'edit-entry' URI the body:</preamble>
                 <artwork><![CDATA[
POST /reilly HTTP/1.1
Content-Type: text/xml

<?xml version="1.0" encoding='iso-8859-1'?>
<delete id="urn:example.org:reilly:1" /> ]]></artwork>
                 <postamble>The POST handler on the server side uses the value of the 'id' attribute to determine which 
		    Entry to delete.</postamble>
             </figure>
 
	     <figure>
               <preamble>The response from the server upon a successful deletion is:</preamble>
                 <artwork><![CDATA[
HTTP/1.1 200 Ok ]]></artwork>
             </figure>

           </section>
           <section title="Editing User Prefs">
             <t>The preferences for the user are edited through the URI supplied in the 'user-prefs' element of 
                the introspection file. To retrieve the current user preferences issue and HTTP GET on the URI.</t>

             <figure title="GET User Preferences">
               <preamble>For our website at http://example.org/reilly, the request would look like: </preamble>
                 <artwork><![CDATA[
GET /reilly/prefs HTTP/1.1]]></artwork>
                 <postamble>This would return a list of user configuration parameters and their values.</postamble>
             </figure>

             <figure title="GET User Preferences Response">
               <preamble>The reponse would look like: </preamble>
                 <artwork><![CDATA[
HTTP/1.1 200 OK
Content-Type: text/xml
 
<?xml version="1.0" encoding='iso-8859-1'?>
<userprefs xmlns="http://www.purl.org/EchoAPI/UserPrefs/">
   <name>Reilly</name>
   <id>1234</id>
   <email>reilly@example.org</email>
</userprefs>       ]]></artwork>
                 <postamble>The values can then be updated, and doing an HTTP POST of the updated file back to the 'user-prefs' URI
will update the user preferences.</postamble>
             </figure>
















             <figure title="SET User Preferences">
               <preamble>For example, if we update our email address, from reilly@example.org to mr_reilly@example.org, 
                 we would then POST back to the 'user-prefs' URI: </preamble>
                 <artwork><![CDATA[
POST /reilly/prefs HTTP/1.1
Content-Type: text/xml
 
<?xml version="1.0" encoding='iso-8859-1'?>
<userprefs xmlns="http://www.purl.org/EchoAPI/UserPrefs/">
   <name>Reilly</name>
   <id>1234</id>
   <email>mr_reilly@example.org</email>
</userprefs>]]></artwork>
                 <postamble>Assuming the update goes successfully, the updated user preferences will be returned in the response.</postamble>
             </figure>

             <figure title="SET User Preferences Response">
               <preamble>The reponse would look like: </preamble>
                 <artwork><![CDATA[
HTTP/1.1 200 OK
Content-Type: text/xml
 
<?xml version="1.0" encoding='iso-8859-1'?>
<userprefs xmlns="http://www.purl.org/EchoAPI/UserPrefs/">
   <name>Reilly</name>
   <id>1234</id>
   <email>my_reilly@example.org</email>
</userprefs>       ]]></artwork>
             </figure>

           </section>

           <section title="Adding Comments">
	     <t>This part of the EchoAPI does not use the URIs listed in the 'introspection' file.</t>
             <t>There are different interfaces now circulating for an <eref target="http://www.movabletype.org/docs/mtmanual_trackback.html">TrackBack</eref>, Ping-Back, Post-It. 
	       All of these are a way of commenting on an item. The only thing missing from the mix is a way to do 
	       "comments" themselves. This section of the specification is intended to be a roll-up of all 
	       the above specifications and to cover comments as well.</t>
             <t>Creating a comment is similar to creating an Entry, that is, you HTTP POST an Entry to a URI. 
	       For now we will defer discussing how to obtain the corrent URI to POST to. </t>
             <figure title="Create New Comment">
               <preamble>For example, if  "http://example.org/reilly/1" is the URI that accepts comments
	         for the first Entry on the website http://example.org/reilly, then the client would open port 80 on example.org
		 and send:</preamble>
               <artwork><![CDATA[
POST /reilly/1 HTTP/1.1
Content-Type: text/xml

<entry> 
  <title>My Comment</title> 
  <author> 
    <name>Fred F. Fobbington</name> 
    <homepage>http://fred.name/</homepage> 
    <weblog>http://fred.blog/</weblog> 
  </author> 
  <issued>2003-02-05T12:29:29</issued> 
  <content type="application/xhtml+xml" xml:lang="en-us"> 
    <p xmlns="...">Welcome to the neighborhood!</p> 
  </content>  
</entry> ]]></artwork>
                 <postamble>This would create a new comment/trackback for the first Entry on "http://example.org/reilly".</postamble>
             </figure>

             <figure title="Create New Comment Response">
               <preamble>The response to this POST, assuming everything went without error, is a filled in
	         Echo Entry, and would look like this:</preamble>
               <artwork><![CDATA[
HTTP/1.1 201 Created
Content-Type: application/not-echo+xml

<entry> 
  <title>My Comment</title> 
  <author> 
    <name>Fred F. Fobbington</name> 
    <homepage>http://fred.name/</homepage> 
    <weblog>http://fred.blog/</weblog> 
  </author> 
  <issued>2003-02-05T12:29:29</issued> 
  <created>2003-02-05T14:20:12Z</created> 
  <modified>2003-02-05T14:20:12Z</modified> 
    
  <link>http://example.org/reilly/2003/02/05#comment1</link>
  <id>urn:example.org:reilly:1:1</id>
 
  <content type="application/xhtml+xml" xml:lang="en-us"> 
    <p xmlns="...">Welcome to the neighborhood!</p> 
  </content>  
</entry> ]]></artwork>
                 <postamble>This would create a new comment/trackback for the first Entry on "http://example.org/reilly".</postamble>
             </figure>

             <section title="Comment Auto-Discovery">
               <t>Two mechanisms are available for discovering the URI that you would use to create a comment.
                  The first is a way to put that information in HTML, the second is a way to embed that information in an Echo feed.</t>
                 <section title="HTML Auto-Discovery">
                   <t>The &lt;link> element has been successful in finding RSS feeds and is appropriate to 
		     use here for discovering the "commentURI" in HTML pages. The <eref target="http://www.w3.org/TR/html401/struct/links.html#edef-LINK">&lt;link></eref> tag goes in the &lt;head> section 
		     of an HTML page and is used to indicate a document relationship. For a similar example of using the link tag 
		     to discover a URI, refer to the usage of 
		     of the link tag for <eref target="http://diveintomark.org/archives/2002/05/30/rss_autodiscovery.html">RSS Auto-Discovery</eref>.
		     In this case the form of the link tag used to indicate the location of the comment URI is:</t>

                   <figure title="Create New Comment">
                       <artwork><![CDATA[
<link rel="service.comment" type="application/not-echo+xml" 
      href="url goes here" title="EchoComment">]]></artwork>
                   </figure>

                   <t>Where href should be set to the URI that accepts POSTs for comments. Applications looking for a URI to post comments
		     to  need to parse out the 
		     headers of the web page and look for a link tag that has a relation rel of "comment" and a mime-type of "application/not-echo+xml".
		     </t>
                 </section>
                 <section title="Echo Feed Auto-Discovery">
                   <t>There is an item level element named 'comment' in Echo
that is used to provide the location of the "commentURI" endpoint to aggregator software. This is providing the same information as the link tag does in HTML. 
@@ No example yet. Needs to be specified. @@
</t>
                 </section>
             </section>
           </section>
           <section title="Introspection Discovery">
	 </section>
      </section>

      <section title="Functional Specification">
           <section title="Formats">
               <t>@@ TBD @@ More formal specification of all the XML formats used in this protocol.</t>
           </section>
           <section title="Actions">
               <t>@@ TBD @@ A more formal specification of all the actions.</t>
               <section title="Create Entry"><t>None.</t></section>
               <section title="Edit Entry"><t>None.</t></section>
               <section title="Delete Entry"><t>None.</t></section>
               <section title="Get List of Entries"><t>None.</t></section>
               <section title="Get User Info"><t>None.</t></section>
               <section title="Set User Info"><t>None.</t></section>
               <section title="Get Categories"><t>None.</t></section>
               <section title="Set Categories"><t>None.</t></section>
           <section title="Result Codes">
               <t>@@TBD@@  Mostly 200 for normal responses, seems that 30X codes for redirects are
                  useful but might make implementations a little harder to implement. @@Ref CommentAPI problems returning a 303 vs 200@@</t>
           </section>
           <section title="Content">
               <t>@@TBD@@ How does an Echo document change when used in these different contexts? Which parts that 
are required when found in a feed become optional when used in creating an Entry?</t>
           </section>
           </section>
        </section>

        <section title="Security Considerations">
        <t>@@TBD@@ Talk here about using HTTP basic and digest authentication.</t>
        <t>@@TBD@@ Talk here about denial of service attacks using large XML files, or the billion laughs DTD attack.</t>
        </section>
        <section title="Revision History">
	  <list>
	     <t>5Jul2003 - Renamed from EchoAPI.html to follow the more commonly used format: draft-gregorio-NN.html. Renamed all 
                references to URL to URI. Broke out introspection into it's own section. Added the Revision History section.
                Added more to the warning that the example URIs are not normative.
             </t>
	  </list>
        </section>
    </middle>

    <back>
        <references>&rfc2119;</references>
    </back>

</rfc>






