Skip to content
Nicklas Börjesson edited this page May 12, 2016 · 9 revisions

The Base API of Optimal Framework contains of authentication, plugin management and access to the node tree. It receives and returns json data.

Broker

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

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 event to the log.

##get_broker_environment Returns a structure with the environment of the broker(will move to the admin plugin)

#Node The node has an 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

Clone this wiki locally