webCOMAND

comand.repo()

Returns an object that can be used to make web service requests to the repository.

It is critical to restrict user accounts associated with tokens embedded in JavaScript code to only be able to access content and perform operations available to the public.  This is because anyone can easily obtain the token from web browser developer tools or by sniffing internet traffic, and then used to perform their own custom requests to retrieve any content available to that user account.

Prototype

repo repo(object options = {})

Parameters

  • options - An object with the following optional property/value pairs.
    • token - The authorization token to make requests to the server.

Return

Returns a repo, or false on failure.

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/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>