/api
Introduction
MyFlame.at offers it's methods as a simple HTTP-based API for (web-)developers to use. You can access the database within your applications by simply calling the methods from any language or framework which offers a HTTP client.
All methods can be called through GET- or POST-requests. Please note that they are not REST-compliant. GET-requests may have side effects. One example is the submit-method. This method submits a fractal flame to the database.
I recommend to use POST-requests where possible. Especially with methods expecting raw XML as a parameter, you might run into problems when sending a large fractal flame through GET.
Requests
Requests have some common parameters which are accepted for every call. All call-specific parameters are just appended to the base type's parameters:
-
format
A format-string determining the output format for this call's response
-
callback
A string containing the name of the callback function if the format is json - this causes the API to respond with a JSONP-string which enables remote JavaScript calls evading the same-domain-policy
Responses
Responses are JSON-formatted plain text in UTF-8 encoding. Every method has a base response type. The actual response type is encapsulated in the base type:
-
success
A boolean indicating whether the call was processed successfully.
-
message
A string containing the error message if success is "false". If success is "true", this member will not be included in the type (should be treated as "null" or "undefined" by the client)
-
result
The actual response data
JavaScript SDK
You can import the JavaScript SDK for the API by writing the following in the head-tag of your document:
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript" src="http://api.myflame.at/javascript/myflameat.min.js></script>
The first line imports the required jQuery library. You can skip this line if you already imported jQuery (at least version 1.4.2) into your document.
The non-packed version of the API is at http://api.myflame.at/javascript/myflameat.js . You can download and edit this file if you need to make customizations or you can just reference to this file instead if you prefer to use non-packed JavaScripts.
After importing, you can call functions using a simple pattern:
myFlame.[namespace].[method_name]( // note that method names convert to camel case here (by_tag -> byTag)
[required_params_if_any],
{
'param_name': [optional_param], // optional parameters don't need to be specified
...
'success': [success_callback], // if you don't want to set a callback, you don't need to specify it
'error': [error_callback] // the error callback throws an exception by default (if not specified)
}
);
For example, the call to the by_tag-method would look like this:
myFlame.browse.byTag(
['elliptic', 'splits'], // if you only look for one tag, a string is accepted too
{
'mode': 'and',
'success': function(result) {
console.log(result);
}
}
);
Note how the count- and offset-parameters as well as the error-callback are omitted here. These fall back to their defaults as documented on the corresponding documentation pages.
Please also mind that every function accepting a tag_string requires an array of keywords in JavaScript or a single string for a single keyword.
Further assistance
If you have further questions about the API, click one of the help links on top of the page!
