Try it NowFeaturesSource CodeDocs

The NetworkMapsLib Library.

NetworkMaps Library.
To make it easier to use the API, NetworkMaps comes with a library written in JavaScript which will make it easier for you to start automating the creation of network diagrams. The library is found on the root directory of the repository: networkmapslib.js
The reference documentation for this library can be found here: NetworkMaps Library Documentation.
To use the library, you usually follow these steps:
  1. Import the library.
    const NetworkMapsLib = require('./networkmapslib');
  2. Create a NetworkMapsLib object.
    let nml = new NetworkMapsLib(USE_SSL,
                                    verify_cert: VERIFY_CERT,
                                    session_id: SESSION_ID
    • USE_SSL: boolean defining if the connection will use http or https.
    • SERVER: IP address or hostname of the server.
    • PORT: port where the server is listening.
    • VERIFY_CERT: (optional) boolean defining if we will verify validity of the servers certificate.
    • SESSION_ID: (optional) if we already have an established session, we can provide it here. This way, if this session is already authenticated, we won't have to.
    • CALLBACK: function that will be called when the connection to the user endpoint is established. This function will not have any parameter.
    • CLOSE_CALLBACK: function that will be called when the connection to the user endpoint is broken. This might happen if for example, the server breaks or is restarted.
  3. Verify if the connection is authenticated. If not, authenticate us.
    if(!nml.authenticated) {
        // The session is not authenticated. let's authenticate ourselves
        console.log("Session not authenticated. Authenticating...");
        nml.login(USERNAME, PASSWORD, (error) => {
            if(error) {
                console.log("Authentication error: " + error);
            else {
                console.log("Session authenticated: " + nml.conn.session_id);
    else {
        // Session is authenticated.
  4. At this point, we have a working connection to the user endpoint. From here, we can list available diagrams, create new ones, delete them, or manage their permissions.
  5. Let's create a diagram.
    console.log("Creating diagram...");
    nml.add_diagram("Diagram Name", (error, uuid) => {
        if(error) {
            console.log("Error creating diagram: " + error);
        // Diagram has been created, do something with it
        do_something_with_diagram(nml, uuid);
  6. Next, to edit the diagram, we will connect to the diagram endpoint (the connection will use the same session id we used or created on the connection to the user endpoint). When connected, we will receive a Diagram object on which we can do different calls to edit it.
    nml.setup_diagram_ws(uuid, (error, diagram) => {
        if(error) {
            console.log("Error connecting to new diagram.")
        console.log("Connected to diagram.");