webCOMAND

COMAND JavaScript API

The COMAND JavaScript API provides access to Bases and Web Services from JavaScript code.

For help getting started, see the JavaScript API Tutorial.

Set Up

To access the JavaScript API, add the following line before the </body> tag in your HTML code, where <account> is the name of your webCOMAND account.  If hosting webCOMAND on another server, the first part of the URL should be replaced as appropriate.

<script src="https://<account>.webcomand.com/ws/js/comand.js"></script>

Once the API is loaded, its methods, properties and additional libraries are exposed via the window.comand object.

Example

The following example web page uses the JavaScript API to retrieve and display a list of contacts.

<html>
<head>
    <title>Contacts</title>
</head>
<body>
<h1>Contacts</h1>
<script src="https://<account>.webcomand.com/ws/js/comand.js"></script>
<!-- include your JavaScript(s) that use the API here, or... -->
<script>
    // write your inline code here, like:
    var repo = comand.repo({token: '<token>'});
    var contacts = repo.get('FROM Contact ORDER BY LastName, FirstName');
    document.writeln('<ul>'); 
    contacts.forEach(function(contact) {
        document.writeln('<li>' + contact.FullName + '<li>');
    });
    document.writeln('</ul>');
</script>
</body>
</html>

Classes

The following libraries can be loaded to access their corresponding JavaScript classes.

  • comand.js - API entry point to connect to, query and update COMAND repositories.
  • color.js - HTML/CSS color manipulation helper.
  • events.js - Simple event handler that uses the subscribe/trigger pattern.
  • format.js - Format numbers, dates, times, etc.
  • loader.js - Load COMAND, package and app configuration files from the server.
  • mvc.js - JavaScript MVC Framework
  • queue.js - Queue AJAX requests that will run in serial.
  • timer.js - Time processes and display their duration.
  • web_socket.js - Send and receive real-time messages and repository object updates.
  • webcomand.js - Used by webCOMAND Apps to load and interact with webCOMAND and webCOMAND Components.
    • alert.js - Alert bar for on-page user notification, COMAND event log display and debugging.
    • chart.js - Chart View.
    • dashboard.js - Display and modify a user's webCOMAND dashboard within your app.
    • dialog.js - Modal Dialogs.
    • form.js - Form View
    • grid.js - Grid View
    • launcher.js - Launch webCOMAND apps from within your app.
    • list.js - List View
    • login.js - Display the webCOMAND login and login as a webCOMAND user.
    • map.js - Map View
    • quick_links.js - Display and modify a user's webCOMAND quick links within your app.
    • slideout.js - Slideout panels from the left/right edge of an area.
    • tree.js - Tree View
    • view_panel - Incorporate a panel that can change views, as seen in the Content Manager, into your app.