Permalink
Browse files

add a page with API documentation

  • Loading branch information...
1 parent 7734ce0 commit 0069787520b78a4bc1404d7d2738a542b53ec821 @cygri committed May 6, 2011
Showing with 27 additions and 0 deletions.
  1. +3 −0 index.php
  2. +8 −0 lib/site.class.php
  3. +1 −0 templates/page-about.php
  4. +15 −0 templates/page-api.php
View
@@ -39,6 +39,9 @@
} else if ($q = $request->matches('/^about\/google$/')) {
$request->enforce_get();
$site->action_about_google();
+} else if ($q = $request->matches('/^about\/api$/')) {
+ $request->enforce_get();
+ $site->action_about_api();
} else if ($q = $request->matches("/^popular(\/all)?(\.$extensions_regex)?$/")) {
$request->enforce_get();
$site->action_popular(!empty($q[1]), @$q[3] . @$q[6], !empty($q[4]) || !empty($q[5]));
View
@@ -154,6 +154,14 @@ function action_about_formats() {
$this->response->render("page-formats", $options);
}
+ function action_about_api() {
+ $options = array(
+ "title" => "namespace lookup api",
+ "links" => $this->get_default_links(),
+ );
+ $this->response->render("page-api", $options);
+ }
+
function action_about_google() {
$options = array(
"title" => "google subscription",
View
@@ -11,6 +11,7 @@
<h2>Further documentation</h2>
<ul>
<li><a href="about/formats">List of all supported output formats</a></li>
+ <li><a href="about/api">Namespace lookup API</a></li>
<li><a href="reverse">Reverse lookup API</a></li>
<li><a href="about/google">Google custom search result subscription</a></li>
</ul>
View
@@ -0,0 +1,15 @@
+ <div class="page-about">
+ <h1>namespace lookup API</h1>
+ <p>A namespace lookup finds the namespace URI for a given prefix. You can perform lookups by entering a prefix into the box on the start page, or by using the <em>namespace lookup API</em>.</p>
+ <p><strong>Query URL:</strong><br />
+ <?php echo $base; ?><em>{prefix}</em>.file.<em>{format}</em></p>
+ <p><strong>Parameters:</strong><br />
+ <code>{prefix}</code> &#8211; prefix to be expanded<br />
+ <code>{format}</code> &#8211; any of the <a href="about/formats">supported formats</a></p>
+ <p><strong>Examples:</strong><br /><small>
+ <a href="foaf.file.txt"><?php echo $base; ?>foaf.file.txt</a><br />
+ <a href="gr.file.json"><?php echo $base; ?>gr.file.json</a><br />
+ <a href="dcat.file.vann"><?php echo $base; ?>dcat.file.vann</a><br />
+ </small></p>
+ <p>“Bulk lookup” of many prefixes in a single request is not supported. Please download the <a href="popular/all">entire namespace data</a> and perform bulk operations locally.</p>
+ </div>

0 comments on commit 0069787

Please sign in to comment.