Indice

i-doit Syntax Plugin

Compatibile con DokuWiki

Weatherwax

plugin This plugin provides a basic integration of the i-doit JSON-RPC API client in PHP with DokuWiki.

Ultimo aggiornamento il
2014-11-20
Fornisce
Syntax
Repository
Source

This extension has not been updated in over 2 years. It may no longer be maintained or supported and may have compatibility issues.

Avviso di sicurezza (per favore, leggi linee guida per la sicurezza dei plugin): The syntax block allows to pass an arbitrary JSON request to the remote JSON-RPC url without security checks.

Taggato con api, i-doit, integration

Installation

:!: Requirements: This plugin depends on a functional i-doit setup with a working JSON-RPC API endpoint set up.

Search and install the plugin using the Extension Manager. Refer to Plugins on how to install plugins manually.

Initial API setup

The PHP client API for i-doit requires a manual initialization of the codebase in order to adapt to your installation. To do that, locate the PHP API root contained in the idoit plugin folder (<Dokuwiki Root directory>/lib/plugins/idoit/idoit/php) and execute the following command:

make initialize

See the Client API documentation for detailed instructions.

Syntax / Usage

The plugin adds a protected syntax block <idoitAPI></idoitAPI> which contains a JSON request passed to the API.

<idoitAPI>
{
  "method": "cmdb.object.read",
  "params": { "id": 1234 },
  "filter": [
    { "desc": "SYS-ID", "path": [ "sysid" ] },
    { "desc": "Foo", "path": [ "foo", "bar" ] }
  ]
}
</idoitAPI>

The JSON request must contain the following attributes:

And may contain an optional filter attribute for filtering the result object as an array of the following objects:

A filter { “desc”: “My Hostname”, “path”: [0, “hostaddress”, “ref_title”] } would return the line *'My Hostname myhostname'* for the following API response:

[{
    "hostaddress": {
        id: 128,
        type: "C__OBJTYPE__LAYER3_NET",
        title: "Management",
        ref_title: "myhostname"
    }
},
...
]

For available methods and categories as strings, see the constant definitions in https://bitbucket.org/dstuecken/i-doit-api-clients.

Examples

Retrieving objects by IDs

<idoitAPI>
{
  "method": "cmdb.object.read",
  "params": { "id": 578 }
}
</idoitAPI>

Output <pre> id 578 title NOS sysid SYSID_1404992452 objecttype 5 type_title Server …. updated 2014-10-17 11:53:54 </pre>

Retrieve single attribute pairs

<idoitAPI>
{
  "method": "cmdb.object.read",
  "params": { "id": 578 },
  "filter": [
    { "desc": "SYS-ID", "path": [ "sysid" ] },
    { "desc": "Foo", "path": [ "foo", "bar" ] }
  ]
}
</idoitAPI>

If a filter does not match the response, a warning is instead printed:

Output <pre> SYS-ID SYSID_1404992452 Foo Filter 'Foo' (path foo/bar) does not match response </pre>

Retrieve, Filter values from categories

<idoitAPI>
{
  "method": "cmdb.category.read",
  "params": { "objID": 578, "catgID": "C__CATG__IP" },
  "filter": [
    { "desc": "Hostname", "path": [ "1", "hostname" ] },
    { "desc": "IPv4", "path": [ "1", "hostaddress", "ref_title" ] }
  ]
}
</idoitAPI>

Output <pre> Hostname myhostname.example.com IPv4 123.456.789.0 </pre>

Configuration and Settings

Use the configuration manager to set your API credentials:

Change Log