Documentation‎ > ‎

API basics


Creating Keys

The S3DB API was built with the purpose of enabling queries on the data without leaving the programming enviroments where it's analysis takes place. Format of the query result can either be tab delimited, html table, etc (see formats section) and the output can be displayed in any browser. To use the S3DB API (S3QL) create a key through the interface or by calling the apilogin function:

http://localhost/s3db/apilogin.php?username=hdeus&password=xxxxxxxxx&format=html

This query returns a key, which is temporary and becomes a surrogate for the user who created it. You can also any of the keys you specified in the webInterface.

Any query can then be formulated using the URI of the local S3DB and calling the file S3QL.php

http://localhost/s3db/S3QL.php?key=ffas4qJsd3dj3



Performing Queries

The S3DB API protocol (S3QL) was designed to be as close to regular SQL as possible. In order to make use of the S3DB API for performing a query, the following elements are required:

  • the URL where S3DB is installed (if in a local computer, this would be something like http://localhost/s3db)
  • a key created through the interface (My Account -> Access keys)

1. Build a query using the XML template:

Basic Select Query

<?xml version="1.0"?>
<S3QL>
<key>...</key>
<select> ... </select>
<from> ... </from>
<where>
<project_id>...</project_id>
</where>
</S3QL>
2. Call the query using the URL + S3QL.php

http://localhost/s3db/S3QL.php?query=<S3QL><key>sCIUdwfWY3ihujX</key><select>*</select><from>rules</from><where><project_id>5</project_id></where></S3QL>

OR
Call the query from a remote online xml file:

http://localhost/s3db/S3QL.php?query=http://myserver/query.xml


3. Choose the format in which the output should be returned and add it as an extra argument:
Ex:

Accepted formats include:
  • xml
  • rdf
  • html
  • tab
  • json
  • php


Syntax and Libraries

See also the API Syntax section and the Libraries for S3DB section for live examples and code.


ą
Lena Deus,
Jun 4, 2008, 7:55 AM
Comments