Skip to content

Instantly share code, notes, and snippets.

@rutgervanwaveren
Created November 19, 2012 14:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save rutgervanwaveren/4110871 to your computer and use it in GitHub Desktop.
Save rutgervanwaveren/4110871 to your computer and use it in GitHub Desktop.
Silk API (4)
<!-- page structure showing the title (line 7) and subtitle (line 8) -->
<article>
<section class="body">
<div class="layout meta"> <!-- left column -->
<div class="block header text" data-component-uri="http://silkapp.com/component/block/text">
<h1>Title</h1>
<p>Subtitle</p>
</div>
</div>
<div class="layout content">.. this is the right column ..</div>
</section>
</article>
<!-- page structure showing text (line 24) in the right column -->
<article>
<section class="body">
<div class="layout meta">.. left column ..</div>
<div class="layout content"> <!-- right column -->
<div class="block text" data-component-uri="http://silkapp.com/component/block/text">
<p>text here</p>
</div>
</div>
</section>
</article>
<!-- include an image component in your page (basic) -->
<article>
...
<div data-component-uri="http://silkapp.com/component/block/image" class="block">
<a data-tag-uri="http://yoursite.silkapp.com/tag/image">
<img src="http://..." />
</a>
</div>
...
</article>
<!-- include an image component with height and width -->
<article>
...
<div data-component-uri="http://silkapp.com/component/block/image" class="block">
<a data-tag-uri="http://yoursite.silkapp.com/tag/image">
<img src="http://..."
data-width="500"
data-height="500"
data-left="0"
data-top="0"
data-zoom="75" /> <!-- this is a percentage -->
</a>
</div>
...
</article>
<!-- add media to a page, example of a vimeo video -->
<article>
...
<div class="block" data-component-uri="http://silkapp.com/component/block/widget">
<div data-component-uri="http://typlab.com/2012/components/urlpreview">
<url t="s">http://vimeo.com/41212671</url>
<embedlydata t="s">
{"html": "<iframe src=\"http://player.vimeo.com/video/41212671\" width=\"560\" height=\"315\"
frameborder=\"0\" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>"}
</embedlydata>
</div>
</div>
...
</article>
<!-- structure of the output of a query -->
<table data-slice="0,99,14">
<thead>
<tr>
<th data-normalized-textual="14 1.0" data-normalized-geo="14 1.0" data-normalized-total="14 1.0">
<div>Document</div>
</th>
...
</tr>
</thead>
<tbody>
<tr>
<td>
<a data-normalized-textual="1.0, haiti" data-normalized-geo="1.0,{&quot;lat&quot;:18.971187,&quot;lng&quot;:-72.285215,&quot;addressTypes&quot;:[&quot;country&quot;,&quot;political&quot;]}" href="/page/Haiti" class="node">Haiti</a>
</td>
...
</tr>
...
</tbody>
</table>
# sample query: list all countries in the Caribbean
from all documents
where
http://world.silkapp.com/tag/Region
and (document has type http://world.silkapp.com/tag/Country)
and (http://world.silkapp.com/tag/Region is "Caribbean")
select
document name
and http://world.silkapp.com/tag/Region
slice from 0 to 99
# sample query: list all countries in the Caribbean
$ curl https://api.silkapp.com/v1.4.0/site/uri/world.silkapp.com/query
-d 'from all documents where http://world.silkapp.com/tag/Region and (document has type http://world.silkapp.com/tag/Country) and (http://world.silkapp.com/tag/Region is "Caribbean") select document name and http://world.silkapp.com/tag/Region slice from 0 to 99'
-X POST
<!-- A part of the taglist showing the <enum> element. An example from world.silkapp.com -->
<tag uri="http://world.silkapp.com/tag/Government%20type">
...
<enum>
<tag count="65">republic</tag>
<tag count="16">parliamentary democracy</tag>
<tag count="14">constitutional monarchy</tag>
...
</enum>
...
</tag>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment