MentDB, The digital brain.  About us Home

Back / Clients

Connect with the Editor
Global execution - Execute a script with the REST API (method = POST|GET|PUSH|DELETE)
Java API
Web Socket API

Connect with the Editor

MentDB_Editor/osx-linux(windows)/bin/editor.sh(bat)

host: localhost
port: 9999
user: admin
password: pwd

Connect with 'admin' user, and type stop {id} to stop the server (Only user in 'system' group).

               

Global execution - Execute a script with the REST API (method = POST|GET|PUSH|DELETE)

https://localhost:9999/api/dir/dir/name?x-token=&x-user=&x-password=&x-script=&var1=&var2=


The user and the script must be into the same group, and the user must be in the 'api-rest' group.

Java API

public static void main(String[] args) {

    //Initialization
    MentDBConnector connector = null;

    //Try to connect and execute MQL queries
    try {

      //Server connection (9998 is the database port)
      connector = new MentDBConnector("localhost", 9998, 10000, 10000);

      //User connection
      if (connector.connect("admin", "pwd")) {

        //Display connection information
        System.out.println(connector.serverConnectionState);
        System.out.println(connector.clientConnectionState);

        try {
          
          //Execute a MQL query
          System.out.println(connector.execute("who"));

          //Execute another MQL query
          System.out.println(connector.execute("sessions"));

        } catch (Exception e) {

          //Exception
          System.out.println(e.getMessage());

        }

      } else {

        //Display connection information
        System.out.println(connector.serverConnectionState);
        System.out.println(connector.clientConnectionState);

      }

    } catch (Exception e) {

      //A connection error was generated
      System.out.println(e.getMessage());

    } finally {

      try {

        //Close the connector
        connector.close();

      } catch (Exception e) {

      }

    }

  }

Web Socket API

See the file 'MentDB_Server/liza/index.html'.




© 2012 - 2018 - Innov-AI.