Skip to content

Instantly share code, notes, and snippets.

@rutgervanwaveren
Created November 15, 2012 15:34
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/4079215 to your computer and use it in GitHub Desktop.
Save rutgervanwaveren/4079215 to your computer and use it in GitHub Desktop.
Silk API
# create new page (or adjust existing page) called 'test'
$ curl https://api.silkapp.com/v1.4.0/site/uri/yoursite.silkapp.com/page/test
-d '<article>...</article>'
-b 'silk_sid=...'
-X PUT
-H 'Content-Type: application/xml'
$ curl https://api.silkapp.com/v1.4.0/site/uri/world.silkapp.com/query
-d 'from all documents where http://world.silkapp.com/tag/Population%20Growth
and (document has type http://world.silkapp.com/tag/Country)
and http://world.silkapp.com/tag/Population%20Growth less than "0"
select
document name
and http://world.silkapp.com/tag/Population%20Growth'
-X POST
# Get information about a site for a specific user
$ curl https://api.silkapp.com/v1.4.0/site/uri/world.silkapp.com/
-b 'silk_sid=...'
# Update the name or description of a site
$ curl https://api.silkapp.com/v1.4.0/site/uri/yoursite.silkapp.com/
-b 'silk_sid=...'
-d '<site><name>The name</name><description>The description</description></site>'
-X PUT
-H 'Content-type: application/xml'
# Get the page 'Ghana' from the site world.silkapp.com
$ curl https://api.silkapp.com/v1.4.0/site/uri/world.silkapp.com/page/Ghana
# Get information about the site world.silkapp.com in XML (default response)
$ curl https://api.silkapp.com/v1.4.0/site/uri/world.silkapp.com/
# Get information about the site world.silkapp.com in JSON
$ curl https://api.silkapp.com/v1.4.0/site/uri/world.silkapp.com/?type=json
# Get the taglist for a public site
$ curl https://api.silkapp.com/v1.4.0/site/uri/yoursite.silkapp.com/taglist
# Get the taglist for a public or private site (with authentication)
$ curl https://api.silkapp.com/v1.4.0/site/uri/yoursite.silkapp.com/taglist
-b 'silk_sid=...'
# get information about the current user
$ curl https://api.silkapp.com/v1.4.0/user/current
-b 'silk_sid=...'
# get permissions for the current user
$ curl https://api.silkapp.com/v1.4.0/user/current/permission
-b 'silk_sid=...'
# Log in
$ curl https://api.silkapp.com/v1.4.0/user/signin
-d "<signin><email>yourEmail</email><password>yourPassword</password></signin>"
-H "Content-Type: application/xml"
-X POST
-i
<!-- XML response from /permissions for a public site -->
<list>
...
<permission>
<account>
<anonymous/>
</account>
<repository>yoursite.silkapp.com</repository>
<canRead>true</canRead>
<canWrite>false</canWrite>
<isAdmin>false</isAdmin>
</permission>
...
</list>
<!-- XML response from /permissions for a site that can be edited by every logged in user -->
<list>
...
<permission>
<account>
<authenticated/>
</account>
<repository>yoursite.silkapp.com</repository>
<canRead>true</canRead>
<canWrite>true</canWrite>
<isAdmin>false</isAdmin>
</permission>
...
</list>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment