webCOMAND

Web Services

This tutorial builds on the Content Types tutorial to illustrate how to get, put and delete objects in a COMAND repository from remote code and productions.

Video

Watch the video above, or follow the step-by-step instructions below.

Getting Started

In order to access and update a COMAND repository from remote code, the Web Services Login Policy must be installed and a valid User Token must be added.

Install Web Services Login Policy

The Web Services Login Policy must be installed before a User can be assigned access to Web Services and associated with a User Token.

  1. Launch Content Manager App.
  2. In the folder tree on the left, click the System folder.
  3. Click import in the toolbar at the top of the right panel.
  4. Enter the URL: file:///var/www/webcomand/packages/io_comand_webservice/install/login.js
  5. Click Import

Add a User and User Token

Once the Web Services Login Policy is installed, a User and User Token can be created to provide controlled access to the repository.

  1. Launch Users App.
  2. Add a new User with the authorizations required to access and update content as needed.
    • Click the Add button in the top-left.
    • Enter a username like "ws_user".
    • Enter your email address.
    • Click the Authorizations tab.
    • Associate a User Role with this User or assign Content Access and Privileges individually.  In either case, make sure the user has at least the following authorizations.
      • Content Access: Read access to the root folder.
      • Content Access: View and any other desired authorizations per content type within the root folder.  For example, provide View and Edit access to Help Doc URL content.  Check Inherit to apply your selections to the content type in all readable subfolders as well as content not in a folder.
      • Privileges: COMAND Web Services > Call > Capabilities, Get, Put and/or Delete.
  3. Add a User Token for the new user.
    • Click the related button to open the Related sidebar.
    • Click User Token
    • Click Add
    • Make a note of the Token
    • Click Approve

Get Web Service

The Get Web Service is used to query a repository and access content.  You can use the API App or Postman to easily test the Get Web Service.

  1. Launch the API App.
  2. Click New Tab and select Web Service > Get
  3. Enter a cQuery or the OID or UUID of an object.  For example, "FROM HelpDocURL".
  4. Select the Token created in the previous section.
  5. Click Process

The response JSON will be displayed to the right.

Put Web Service

The Put Web Service is used to add and update content to a repository.  You can use the API App or Postman to easily test the Put Web Service.

  1. Launch the API App.
  2. Click New Tab and select Web Service > Put
  3. Enter cJSON into the Data field.  For example:
    {
        "type": "COMAND",
        "version": "1.0",
        "contents": {
            "Type": "HelpDocURL",
            "Title": "webCOMAND Web Services",
            "URL": "https://www.webcomand.com/docs/api/web_services/"
        }
    }
    
  4. Select the Token created in the previous section.
  5. Click Options and enter the Parent "/System".
  6. Click Process

The response JSON will be displayed to the right.  Make a note of the OID of the new Help Doc URL.

For more information, see Put Web Service.