Our web service API.
CCRX Molecule | |
Preference Dialog | |
Comments | CCRX (Common Code Request and Exchange) molecule provides the following important Web Service that a user can take advantage of to offer file/folder based applications and services to other members. |
Properties | |
type | string, ( r ) |
pref.name | string, ( r ) |
currentUser | string, ( r ) |
Functions | |
attach | |
detach | |
delete | |
rename | |
clone | |
serialize | |
query | |
askUserForData | |
askUserToSaveData |
CCRX (Common Code Request and Exchange) molecule provides the following important Web Service that a user can take advantage of to offer file/folder based applications and services to other members.
Get current user’s name. This service lets you know who is using your application. (see currentUser)
Request data from current user. This service opens a vault explorer dialog and ask current user to select a file. Upon user’s approval, the content of the file is passed to the requesting application’s callback function. The user can cancel the request and dismiss the dialog. In that case, no data is transfered. (see askUserForData)
Save data to file. This service opens a vault explorer dialog and ask current user to select a folder and provide a file name. Upon user’s approval, the implementer’s callback is queried repeatedly for data until an empty string is encountered. The data is then saved to the named file in current user’s vault. The user can cancel the request and dismiss the dialog. In that case, no data is transfered. (see askUserToSaveData)
Query public repository for data. This service allows implementers to make filtered query to our public repository. (see query)
string, ( r )
The scriptable name for this molecule. This name can be set using rename function dynamically.
query(filter, callback);
This function queries the repository for previously published objects (applications, formations, droplets, blueprints) using the given filter and passes back the result to the callback function given either as a script molecule or a document-level function.
filter | (object) a set of key/value pairs. |
callback | (mixed) a script molecule or a document-level function. |
Possible keys are,
name | Name of the published object. |
publisher | Nickname of the publisher. |
desc | partial description text. |
comm | partial comment text. |
category | The category of the object. |
tag | Search by tag. |
implements | The blueprint IDs that the object implements. |
attrb | Search by attribute. |
filter | Search by type (application, formation, droplet, or blueprint). |
guid | Search by the unique ID of an object. |
start | Returns the object starting from the given index. Default 0. |
count | The number of objects to return. |
orderby | Order of the result using one of the values below. Default is the latest first. |
At the completion of the query, the callback function is passed the result in the input parameter params and params.result contains the records as an array of object. (e.g. var record = params.result[2]; ).
Each record has the following properties,
name | Name of the published object. |
time | Unix time this object was published. |
quid | Object’s unique ID. |
nickname | Nickname of the publisher. |
owner | Owner of the object. |
category | The category of the object. |
type | Object type (application, formation, droplet, or blueprint). |
implements | The blueprint IDs that this object implements. |
description | Full description of the object. |
comments | Full comments of the object. |
unitid | The unique ID of the parent object that this object belongs to. (a droplet’s parent formation ID.) |
cost | The cost of this object. |
tags | The tags associated with this object. |
embedURL | The URL that this object, in raw JSON string, is located and can be embedded into another project. |
N/A
askUserForData(callback);
Open the Vault Explorer dialog (see vaultExplorerOpen) and ask the current user to select a file from his/her vault. The file content is returned to the given javascript callback function as input parameter params.
callback | (mixed) a script molecule or a document-level function. |
N/A
askUserToSaveData(file_extension, size, callback);
Similar to askUserForData but ask the current user to select a folder and specify a file name so that the caller of this function can save data into a file in user’s vault. (see vaultExplorerSave)
Once the user selects a folder and a file name, the callback function is repeatedly called to obtain return value as content. The implementer can return an empty string to designate the end. The data is forcefully truncated to the size specified.
file_extension | (string) a preferred extension of the file name. |
size | (int) the Byte size of the content to be saved. |
callback | (mixed) a script molecule or a document-level function. |
N/A