TiddlyHome RSS feed http://bidix.appspot.com/ The latest news from TiddlyHome en-us Copyright 2008 BidiX 2008-08-21 17:47 2008-08-21 17:47 http://blogs.law.harvard.edu/tech/rss TiddlyHome 2.0 Experimental iTW available at TiddlyHome 2.0 Just as a proof of concept, an iTW is available at <a class="externalLink" href="http://tiddlyhome.appspot.com/BidiX/tiddlywikis/iTW" title="External link to http://tiddlyhome.appspot.com/BidiX/tiddlywikis/iTW">http://tiddlyhome.appspot.com/BidiX/tiddlywikis/iTW</a> . The full TiddlyWiki is available (in Safari) at <a class="externalLink" href="http://tiddlyhome.appspot.com/BidiX/tiddlywikis/iTW.html" title="External link to http://tiddlyhome.appspot.com/BidiX/tiddlywikis/iTW.html">http://tiddlyhome.appspot.com/BidiX/tiddlywikis/iTW.html</a>.<br> Site toRSS http://tiddlyhome2.bidix.info/BidiX/namespaces/TiddlyHome/tiddlers/Experimental%20iTW%20available%20at%20TiddlyHome%202.0.html 2008-07-07 05:58 Data Model <ul><li> <strong>User</strong> is an extension of Google User with a <em>username</em></li><li> <strong>User</strong> owns <strong>Namespaces</strong></li><li> <strong>User</strong> owns <strong>Tiddlywikis</strong></li><li> <strong>Namespace</strong> owns <strong>Tiddlers</strong></li><li> <strong>TiddlyWiki</strong>, in a <strong>Namespace</strong>, references <strong>Tiddlers</strong></li></ul>Some rules :<br><ul><li> only the owner of an entity (<strong>TiddlyWiki</strong>, <strong>Namespace</strong>, <strong>Tiddler</strong>) can edit it</li><li> a <strong>Namespace</strong> (or a <strong>TiddlyWiki</strong>) can be <em>private</em>.</li><li> only the owner of a private <strong>Namespace</strong> (or a <strong>Tiddlywiki</strong>) can see it</li></ul><br><br><br> Documentation Design http://tiddlyhome2.bidix.info/BidiX/namespaces/TiddlyHome/tiddlers/Data%20Model.html 2008-06-24 09:22 TiddlyHome Restful API Following this <a class="externalLink" href="http://bidix.appspot.com/BidiX/namespaces/TiddlyHome/tiddlers/A%20Model%20for%20a%20RESTful%20API.html" title="External link to http://bidix.appspot.com/BidiX/namespaces/TiddlyHome/tiddlers/A%20Model%20for%20a%20RESTful%20API.html">model</a> above the <a class="externalLink" href="http://tiddlyhome.appspot.com/" title="External link to http://tiddlyhome.appspot.com/">TiddlyHome</a> API.<br><br><br><h1> URI Resources</h1><br><h2> User</h2><ul><li> <code>/&lt;username></code><br>The resource <code>&lt;user_id></code> doesn't have is container specified. <em>Need more developments.</em></li></ul><br><h2> Namespace</h2><ul><li> <code>/&lt;username>/namespaces</code><br>Namespace container owns by &lt;username>. </li><li> <code>/&lt;username>/namespaces/&lt;namespace_id></code> <br>&lt;namespace_id> owns by &lt;username>.</li></ul><br><h2> Tiddler</h2><ul><li> <code>/&lt;username>/namespaces/&lt;namespace_id>/tiddlers</code> <br>Tiddler container in &lt;namespace_id> owns by &lt;username>.</li><li> <code>/&lt;username>/namespaces/&lt;namespace_id>/tiddlers/&lt;tiddler_id></code> <br>&lt;tiddler_id> in &lt;namespace_id> owns by &lt;username>.</li></ul><br><h2> Tiddlywiki</h2><ul><li> <code>/&lt;username>/tiddlywikis</code><br>Tiddlywiki container own by &lt;username>. </li><li> <code>/&lt;username>/tiddlywikis/&lt;tiddlywiki_id></code> <br>&lt;tiddlywiki_id> owns by &lt;username>.</li></ul><br><h1> Requests to TiddlyHome Service</h1>Actually <code>PUT</code> is not implemented.<br><br>For now requested content-type (HTTP Request header) are not interpreted. All responses, except when specified, are in <code>Content-type: text/html</code>.<br><br>Return code conform to <a class="externalLink" href="http://bidix.appspot.com/BidiX/namespaces/TiddlyHome/tiddlers/A%20Model%20for%20a%20RESTful%20API" title="External link to http://bidix.appspot.com/BidiX/namespaces/TiddlyHome/tiddlers/A%20Model%20for%20a%20RESTful%20API">model</a>.<br><br><h2> User</h2><ul><li> <code>GET /&lt;username></code> <br>Return username and mail address.<em>Need more developments.</em></li><li> <code>GET www.google.com/accounts/ServiceLogin?...</code> <br>For now available only from a browser. Redirect to the current page once the login (or logout) is done.</li></ul><br><h2> Namespace</h2><ul><li> <code>GET /&lt;username>/namespaces</code> <br>List of Namespace own by &lt;username>.</li><li> <code>POST /&lt;username>/namespaces</code> <br>Create or update namespace with these attributes :<ul><li>name</li><li>access: 'on' | ''</li><li>owner_name:</li><li>previous_name: if different from name, previous name is deleted.</li><li>return_url: response redirect to this url</li></ul></li><li> <code>GET /&lt;username>/namespaces?new</code> <br>Return a form that submit a <code>POST /&lt;username>/namespaces</code>. This form is empty.</li><li> <code>GET /&lt;username>/namespaces/&lt;namespace_id></code> <br>return an HTML page for &lt;namespace_id> details.</li><li> <code>GET /&lt;username>/namespaces/&lt;namespace_id>?edit</code> <br>Return a form that submit a <code>POST /&lt;username>/namespaces</code>. This form is filled with &lt;namespace_id> details.</li><li> <code>DELETE /&lt;username>/namespaces/&lt;namespace_id></code> <br><code>GET /&lt;username>/namespaces/&lt;namespace_id>?delete</code> <br>Delete &lt;namespace_id>.</li></ul><br><h2> Tiddlywiki</h2><ul><li> <code>GET /&lt;username>/tiddlywikis</code> <br>List of Tiddlywiki own by &lt;username>.</li><li> <code>POST /&lt;username>/tiddlywikis</code> <br>Create or update tiddlywiki with these attributes :<ul><li>name</li><li>namespace_name</li><li>access: 'on' | ''</li><li>title</li><li>subtitle</li><li>&lt;tiddler_title>: 'on' | '' (for each tiddler in &lt;namespace_name>)</li><li>previous_name: if different from name, previous name is deleted.</li><li>return_url: response redirect to this url</li></ul></li><li> <code>PUT /&lt;username>/tiddlywikis/&lt;tiddlywiki_id>?put</code> <br><code>POST /&lt;username>/tiddlywikis/&lt;tiddlywiki_id>?put</code> <br><em>Not documented</em></li><li> <code>GET /&lt;username>/tiddlywikis?new</code> <br>Return a form that submit a <code>POST /&lt;username>/tiddlywikis</code>. This form is empty.</li><li> <code>GET /&lt;username>/tiddlywikis/&lt;tiddlywiki_id></code> <br>return an HTML page for &lt;tiddlywiki_id> details.</li><li> <code>GET /&lt;username>/tiddlywikis/&lt;tiddlywiki_id>.html</code> <br>return a <a class="externalLink" href="http://www.tiddlywiki.com/" title="External link to http://www.tiddlywiki.com/">TiddlyWiki</a> page for &lt;tiddlywiki_id>.</li><li> <code>GET /&lt;username>/tiddlywikis/&lt;tiddlywiki_id>.xml</code> <br>return a xml page in RSS format for &lt;tiddlywiki_id>.</li><li> <code>GET /&lt;username>/tiddlywikis/&lt;tiddlywiki_id>?edit</code> <br>Return a form that submit a <code>POST /&lt;username>/tiddlywikis</code>. This form is filled with &lt;tiddlywiki_id> details.</li><li> <code>GET /&lt;username>/tiddlywikis/&lt;tiddlywiki_id>?upload</code> <br>Return a form that upload a <a class="externalLink" href="http://www.tiddlywiki.com/" title="External link to http://www.tiddlywiki.com/">TiddlyWiki</a> a <code>POST /&lt;username>/tiddlywikis/&lt;tiddlywiki_id>?put</code>.</li><li> <code>DELETE /&lt;username>/tiddlywikis/&lt;tiddlywiki_id></code> <br><code>GET /&lt;username>/tiddlywikis/&lt;tiddlywiki_id>?delete</code> <br>Delete &lt;tiddlywiki_id>.</li></ul><br><h2> Tiddler</h2><ul><li> <code>GET /&lt;username>/namespaces/&lt;namespace_id>/tiddlers</code> <br>List of Tiddler in &lt;namespace_id>.</li><li> <code>POST /&lt;username>/namespaces/&lt;namespace_id>/tiddlers</code> <br>Create or update a tiddler with these attributes :<ul><li>title</li><li>tags</li><li>text</li><li>html: wikified text</li><li>previous_title: if different from title, previous title is deleted.</li><li>return_url: response redirect to this url</li></ul></li><li> <code>GET /&lt;username>/namespaces/&lt;namespace_id>/tiddlers?new</code> <br>Return a form that submit a <code>POST /&lt;username>/namespaces/&lt;namespace_id>/tiddlers</code>. This form is empty.</li><li> <code>GET /&lt;username>/namespaces/&lt;namespace_id>/tiddlers/&lt;tiddler_id>.html</code> <br>return an HTML page &lt;tiddler_id> only with html content for publishing (Tiddlyhomes use this for <a class="externalLink" href="http://www.tiddlywiki.com/#HomePage" title="External link to http://www.tiddlywiki.com/#HomePage" refresh="link" tiddlylink="HomePage">HomePage</a> and <a class="externalLink" href="http://www.tiddlywiki.com/#HelpPage" title="External link to http://www.tiddlywiki.com/#HelpPage" refresh="link" tiddlylink="HelpPage">HelpPage</a>).</li><li> <code>GET /&lt;username>/namespaces/&lt;namespace_id>/tiddlers/&lt;tiddler_id>.txt</code> <br>return a text/plain page for &lt;tiddler_id> text.</li><li> <code>GET /&lt;username>/namespaces/&lt;namespace_id>/tiddlers/&lt;tiddler_id>.js</code> <br>return a text/plain page for &lt;tiddler_id> text.</li><li> <code>GET /&lt;username>/namespaces/&lt;namespace_id>/tiddlers/&lt;tiddler_id>.tw</code> <br>return a text/plain page for &lt;tiddler_id> in <a class="externalLink" href="http://www.tiddlywiki.com/" title="External link to http://www.tiddlywiki.com/">TiddlyWiki</a> <a class="externalLink" href="http://www.tiddlywiki.com/#StoreArea" title="External link to http://www.tiddlywiki.com/#StoreArea" refresh="link" tiddlylink="StoreArea">StoreArea</a> format.</li><li> <code>GET /&lt;username>/namespaces/&lt;namespace_id>/tiddlers/&lt;tiddler_id>?edit</code> <br>Return a form that submit a <code>POST /&lt;username>/namespaces/&lt;namespace_id>/tiddlers</code>. This form is filled with &lt;tiddler_id> details.</li><li> <code>DELETE /&lt;username>/namespaces/&lt;namespace_id>/tiddlers/&lt;tiddler_id></code> <br><code>GET /&lt;username>/namespaces/&lt;namespace_id>/tiddlers/&lt;tiddler_id>?delete</code> <br>Delete &lt;tiddler_id>.</li></ul><br> Documentation Design RESTful API http://tiddlyhome2.bidix.info/BidiX/namespaces/TiddlyHome/tiddlers/TiddlyHome%20Restful%20API.html 2008-06-17 05:59 A Model for a RESTful API This article suggests a model for a RESTful API usable in a browser without using AJAX and that manage a suffix to request a particular content-type.<br><br>This model is implemented has a generic extension to Google Engine webapp. See it in action in TiddlyWiki context at <a class="externalLink" href="http://TiddlyHome.appspot.com" title="External link to http://TiddlyHome.appspot.com">TiddlyHome</a><br><br><h1> Resource</h1>The typical <a class="externalLink" href="http://en.wikipedia.org/wiki/URI" title="External link to http://en.wikipedia.org/wiki/URI">URI</a> of a resource is : <br><pre>/&lt;type>s/&lt;id>[.&lt;format>] </pre>like in <code>/tiddlywikis/HowTo.html</code>. <br><br><br>To obtain the list of all resources of a type simply : <br><pre>/&lt;type>s </pre><br><h1> Membership relation </h1>When the resource is linked to an other resource, especially to explain membership, the URI becomes :<br><pre>/&lt;parent_type>s/&lt;parent_id>/&lt;children_type>s/&lt;children_id> </pre> (ex: <code>/tiddlywikis/HowTo/tiddlers/Upload</code> ).<br><br><h1> Basic functions on resource</h1>In <a class="externalLink" href="http://www.tiddlywiki.com/#RESTful" title="External link to http://www.tiddlywiki.com/#RESTful" refresh="link" tiddlylink="RESTful">RESTful</a> API, the <a class="externalLink" href="http:/http://en.wikipedia.org/wiki/CRUD_(acronym)" title="External link to http:/http://en.wikipedia.org/wiki/CRUD_(acronym)">CRUD</a> basic functions on a persistent resource can be accessed using HTTP methods :<br><table class="twtable"><tbody><tr class="evenRow"><th>HTTP Method</th><th>Function</th></tr><tr class="oddRow"><td><code>GET &lt;uri_id></code></td><td align="left">Read &lt;resource_id></td></tr><tr class="evenRow"><td><code>PUT &lt;uri_id></code></td><td align="left">Create or Update &lt;resource_id></td></tr><tr class="oddRow"><td><code>DELETE &lt;uri_id></code></td><td>Delete &lt;resource_id></td></tr><tr class="evenRow"><td><code>POST &lt;a_form></code></td><td align="left">Ask service to Create, Update or Delete some resource using &lt;a_form></td></tr></tbody></table><br><h1> API to manage a resource</h1><table class="twtable"><tbody><tr class="evenRow"><th>API call</th><th>Application function called</th></tr><tr class="oddRow"><td><code>GET /&lt;type>s</code></td><td>Type.list()</td></tr><tr class="evenRow"><td rowspan="2"><code>GET /&lt;type>/&lt;id>[.&lt;format>]</code></td><td>id.display[_in_&lt;format>]()</td></tr><tr class="oddRow"><td>404</td></tr><tr class="evenRow"><td><code>PUT /&lt;type>s/&lt;id></code></td><td>id.put()</td></tr><tr class="oddRow"><td><code>DELETE /&lt;type>s/&lt;id></code></td><td>id.delete()</td></tr><tr class="evenRow"><td><code>POST /&lt;type>s</code></td><td>Type.create_or_update()</td></tr></tbody></table><br><h1> RESTful extensions for browser</h1>Since methods PUT and DELETE can't easily be activated in a browser (except using AJAX). The query_string part of the URL is used to simulate PUT or DELETE. <br>On server, the Handler first changes the query_string in the corresponding method :<br><table class="twtable"><tbody><tr class="evenRow"><th align="left"> URL with query_string</th><th align="left"> API Call</th></tr><tr class="oddRow"><td align="left"><code>GET /&lt;type>s/&lt;id>?delete</code></td><td align="left"><code>DELETE /&lt;type>s/&lt;id></code></td></tr><tr class="evenRow"><td align="left"><code>GET /&lt;type>s/&lt;id>?put</code></td><td align="left"><code>PUT /&lt;type>s/&lt;id></code></td></tr><tr class="oddRow"><td align="left"><code>GET /&lt;type>s?new</code></td><td align="left"><code>GET /&lt;type>s</code> - with an attribut in_form = True</td></tr><tr class="evenRow"><td align="left"><code>GET /&lt;type>s/&lt;id>?edit</code></td><td align="left"><code>GET /&lt;type>s/&lt;id></code> - with an attribut in_form = True</td></tr></tbody></table><br><h1> Specifying Content-type</h1>To easily specify the content-type required, a suffix is added to the resource like : <code>.html</code>, <code>.xml</code>, <code>.txt</code> <code>.js</code> ...<br><br><h1> Return codes</h1>Finally HTTP Status are used in response to HTTP request. Their normalised meaning are used, sometimes with some restrictive sense in the API context.<br><table class="twtable"><tbody><tr class="evenRow"><th>HTTP Code</th><th align="left">HTTP status message</th><th>API Meaning</th></tr><tr class="oddRow"><td align="center">200</td><td align="left">OK</td><td align="left">Ok</td></tr><tr class="evenRow"><td align="center">201</td><td align="left">Created</td><td align="left">New entity created</td></tr><tr class="oddRow"><td align="center">400</td><td>Bad Request</td><td align="left">The URL can't be processed (Type doesn't exist, bad format requested ...)</td></tr><tr class="evenRow"><td align="center">401</td><td>Unauthorized</td><td>The logged user is not authorized to execute this action</td></tr><tr class="oddRow"><td align="center">403</td><td>Forbidden</td><td>Action is not allowed</td></tr><tr class="evenRow"><td align="center">404</td><td>Not Found</td><td>Resource doesn't exist</td></tr><tr class="oddRow"><td align="center">405</td><td>Method not allowed</td><td>This resource doesn't allow this method (operation)</td></tr><tr class="evenRow"><td align="center">406</td><td>Not acceptable</td><td></td></tr></tbody></table><br><br> Documentation Design RESTful API http://tiddlyhome2.bidix.info/BidiX/namespaces/TiddlyHome/tiddlers/A%20Model%20for%20a%20RESTful%20API.html 2008-06-17 05:58