-
Notifications
You must be signed in to change notification settings - Fork 0
API
The Base API of Optimal Framework contains of authentication, plugin management and access to the node tree. It receives and returns json data.
Note: It is likely that you also use the admin-ui plugin, its API is defined here
The broker is the main server side script of OF. It presents the following API for peers that wish to connect to it. ##register All other functions except status needs a set session_id cookie (is set here)
To register as a peer, or basically log in, this function is called. It takes a JSON structure that adheres to the register schema.
An example would be:
{
"credentials": {
"usernamePassword": {
"username": "test_user",
"password": "test_password"
}
},
"environment": get_environment_data(),
"peerType": "admin",
"address": null
};
The get_environment_data() call is just a function that return general information about the operating environment of the peer. If it is a browser peer it perhaps is information on the browser version and so on, if it is a Python-based it may be globals and Python versions. An example: https://github.com/OptimalBPM/of-admin/blob/master/ui/scripts/autologin.ts#L50
As result the information for the relevant peer node is returned and a session cookie is set.
The base peer follows this schema: https://github.com/OptimalBPM/of/blob/master/schemas/node_peer.json
##socket
Takes no parameters, but upgrades the connection to a web socket connection.
##status Takes no parameters, returns the text "up".
##write_to_log
Writes an supplied event to the log.
#Node This is the interface to the node tree of the Optimal Framework. The node tree holds all settings and entities of the Optimal Framework. https://github.com/OptimalBPM/of/blob/master/broker/cherrypy_api/node.py
Takes a node-compatible descendant and stores it into the database. If _id is not set, it will create a new one(MongoDB objectId) and return that _id. If set, it will overwrite an existing node and return that _id.
If the user does not have the "admin_everything"-right or belong to any groups that that have write permission on a specific object, an error is raised.
##find Takes an OF-condition(basically a MongoDB filter) and queries the node collection for that value. Will only search in the "node" collection and return matching nodes that the groups the user belongs to have read permission for.
##lookup Like find, but returns a list of value-name objects for use in drop downs.
##remove Removes the node with the specified id, given appropriate permissions apply.
##load_node Returns the node with the specified id, given appropriate permissions apply.
##load_children Returns the node with the specified id, given appropriate permissions apply.
##history Returns the history of the node with the specified id, given appropriate permissions apply.
##get_schemas Returns a list of all defined schemas of the Optimal Framework and loaded plugins.