Previous Topic

Next Topic

Book Contents

Book Index

ConfigTree JSON-RPC API

This document is a guide to using the JSON-RPC protocol to provide management of the configurations in the ConfigTree over an HTTP connection.

The ConfigTree Servlet maps the JSON-RPC methods to the Java methods of the ConfigTree API to carry out the RPC requests. It accepts HTTP parameters and returns JSON objects.

The ConfigTree JSON-RPC service is different than the other pure JSON-RPC services: it is HTTP servlet that returns JSON object but accepts HTTP GET parameters rather than JSON objects. Please see the examples below.

ConfigTree Functions

The following table contains the relevant JSON-RPC functions the ConfigTree module provides for configuration management:

Method

Return Value

Parameters

Parameter Description

configtree/importZip

"OK" if all specified configurations from the ZIP file (containing several configurable types) were accepted, or
an array of JSON Status Objects corresponding to the success of each importing operation.

  • format
  • config_n
  • file

The request should be sent as multipart/form-data.

  • format - The format of the file - "XML" or "BIN".
  • config_n - The name of the n-th configurable type to be imported.
  • file - The actual ZIP file data.

configtree/exportZip

Zipped data stream with the selected configurable types in the specified format.

  • format
  • type_n
  • type_n
  • type_n - The name of the n-th configurable type to be included in the ZIP.

configtree/importConfig

A JSON Status Object corresponding to the success of the importing operation of the single configurable type.

  • type
  • format
  • path
  • importAsRoot
  • file

The request should be sent as multipart/form-data.

  • type - The name of the configurable object.
  • format - The format of the file - "XML" or "BIN".
  • path - The path to the parent node of the one to be imported.
  • importAsRoot - If set to "true" overwrites existing node config. Otherwise overwrites and updates.
  • file - The actual configuration data.

configtree/exportConfig

The configuration data stream in the specified format.

  • path
  • type
  • format
  • path - The path of the exported node (if not Root).
  • type - The name of the configurable object.
  • format - The format of the file - "XML" or "BIN".

configtree/getConfigurableTypes

A string array of names of configurable types.

-

-

configtree/getConfig

A JSON Config Object defining the configuration node's children and their properties.

  • type
  • depth
  • path
  • type - The name of the configurable object.
  • depth - The depth of the resulted config node. Optional parameter. The default value is '-1' which returns the entire config node.
  • path - The path to the node whose children are requested.

configtree/setConfig

A JSON Status Object corresponding to success, failure, or error details.

  • type
  • path
  • node
  • type - The name of the configurable object.
  • path - The path to the node whose properties are to be altered.
  • node - The new properties to be assigned to the node in JSON format.

configtree/setMap

A JSON Status Object corresponding to success, failure, or error details.

  • type
  • path
  • node
  • type - The name of the configurable object.
  • path - The path to the node containing the property of type map to be altered.
  • node - The new properties to be assigned to the node in JSON format. The same JSON description as returned by the getConfig method.

Common Objects Definitions

The following table contains definitions of the JavaScript objects involved in the JSON-RPC methods for configurations management.

Object

Key

Value

Status

  • State
  • ConfigType
  • State - An integer indicating the status as follows:
    • "0" indicates failed status
    • "1" indicates success
    • "2" is a constant defining not supported status returned when the setConfig is not supported or permitted
    • "3" indicates a warning
  • ConfigType - The name of the configurable type.

Examples

This section provides few examples of how the ConfigTree Module supports remote communication over JSON-RPC.