i-doit enables external access to the IT documentation via an application programming interface (API). With the API data can be read, created, updated and deleted. Thus the API offers similar functions like the Web GUI but the additional benefit is that you can automate them without any problems.
Technical Background
The API of i-doit provides typical CRUD functionalities. With this, files can be
- Created
- Read
- Updated and
- Deleted.
For this, a client (for example, in the form of a script) sends a request to the server (i-doit) in order to execute a method on the server. This approach is called Remote Procedure Call (RPC). The result of the method is returned to the client as a response. In this communication the API of i-doit is based on the JSON-RPC protocol, version 2.0. HTTP is used as higher protocol and the JavaScript Object Notation (JSON) is used as exchange format. A request is send to the server in the JSON format per HTTP POST. The response is also made in JSON format.
API queries can take place in an asynchronous way without losing the relation between requests and responses. The utilized programming language can be chosen freely.
API instead of database
It's strongly recommended to prefer the API to database manipulations at all times. SQL statements bypass all sorts of internal processes. If a data record is manipulated via SQL per INSERT, UPDATE
or DELETE
, this could risk data integrity and could even disable i-doit.
Download
In the customer portal you can download the API for the pro version as add-on for free. Users of the open version can also download it for free via i-doit.org. The installation is in line with the same principles of other i-doit add-ons.
Configuration
The API is configured via the Web GUI of i-doit and can be found at Administration → Interfaces / external data → JSON-RPC API
.
Info
Removing HTML tags from description fields is only possible at i-doit version 1.15.2 with API version 1.11.3 installed.
Please note that the logging of API requests will create a file in the install path of i-doit at log/
for each request. This may lead to increased requirements of memory space in case the API is used intensively.
Access
You can access the API of i-doit by activating a special URL. Add src/jsonrpc.php
to the basic URL:
https://demo.i-doit.com/src/jsonrpc.php
Authentication and Authorization
You need an API key so that requests will be processed by the API. Additionally, you can activate the function that a dedicated user account is activated for log-in. Permissions for this account can be set as usual. Otherwise all permissions are available through the API. Another advantage is the fact that a dedicated user can be set per third-party system/ script; this makes it easier to keep track of the data flow.
It may prove useful to use the API method idoit.login
for a single authentication if a lot of requests (meaning thousands) are sent from a client. Otherwise it is possible that too many sessions are created in a very small time frame but are not terminated. This could result in the fact that i-doit stops working until the sessions have been terminated.
Methods
Please see this article for detailled information about each method.
Method | Description |
---|---|
idoit.addons | Display installed i-doit add-ons |
idoit.constants | Query constants |
idoit.license | Display licensed objects and add-ons |
idoit.login | Login |
idoit.logout | Logout |
idoit.search | Search in i-doit |
idoit.version | Display the version of i-doit |
cmdb.category.read | Create a category entry |
cmdb.category.update | Update a category entry |
cmdb.category.delete | Delete a category entry |
cmdb.category.quickpurge | Quickpurge a category entry |
cmdb.category.purge | Purge a category entry |
cmdb.category.recycle | Recycle a category entry |
cmdb.category.archive | Archive a category entry |
cmdb.category.get_category_info | Documentation follows |
cmdb.category.save | Create/Update a category entry |
cmdb.category.create | Create a category entry (deprecated) |
cmdb.category.get_category_id | Documentation follows |
cmdb.category.getCategoryProcessor | Documentation follows |
cmdb.category.validateRequest | Documentation follows |
cmdb.category.get_category_suffix | Documentation follows |
cmdb.category.validateSetRequest | Documentation follows |
cmdb.category_info | Read the attributes of a category |
cmdb.condition.read | Documentation follows |
cmdb.contact.read | Documentation follows |
cmdb.dialog.read | Read the values of a dialogue field |
cmdb.dialog.create | Create the values of a dialogue field |
cmdb.dialog.update | Update the values of a dialogue field |
cmdb.dialog.delete | Delete the values of a dialogue field |
cmdb.dialog.dialog_routine | Documentation follows |
cmdb.filter.read | Documentation follows |
cmdb.filter.getUpdatedIPs | Documentation follows |
cmdb.filter.getValidObjects | Documentation follows |
cmdb.impact.read | Recursive query of all object relations |
cmdb.location_tree.read | Read location path |
cmdb.logbook.read | Read logbook entry |
cmdb.logbook.create | Create logbook entry |
cmdb.object.read | Read an object |
cmdb.object.create | Create an object |
cmdb.object.update | Update an object |
cmdb.object.quickpurge | Quickpurge an object |
cmdb.object.recycle | Recycle an object |
cmdb.object.archive | Archive an object |
cmdb.object.delete | Delete an object |
cmdb.object.purge | Purge an object |
cmdb.object.markAsMassChangeTemplate | Documentation follows |
cmdb.object.markAsTemplate | Documentation follows |
cmdb.object_type_groups.read | Read which object types are assigned to which object type groups |
cmdb.object_type_categories.read | Read which categories are configured to which object types |
cmdb.object_types.read | Query object types |
cmdb.objects.read | Read object |
cmdb.objects.getCategoryData | Documentation follows |
cmdb.objects.getCategoryConstantsByObjectTypeId | Documentation follows |
cmdb.objects_by_relation.read | Read objects by relation type |
cmdb.reports.read | Execute a report |
cmdb.reports.remove_id | Documentation follows |
cmdb.status.read | Documentation follows |
cmdb.status.save | Documentation follows |
cmdb.status.delete | Documentation follows |
cmdb.workstation_components.read | Documentation follows |
console.commands.listCommands | Documentation follows |
console.auth.cleanup | Documentation follows |
console.document.compile | Documentation follows |
console.dynamicgroups.sync | Documentation follows |
console.import.csv | Documentation follows |
console.ldap.sync | Documentation follows |
console,logbook.archive | Documentation follows |
console.notifications,send | Documentation follows |
console.report.export | Documentation follows |
console.search.query | Documentation follows |
console.settings.all | Documentation follows |
console.system.autoincrement | Documentation follows |
Example
With a simple example we create a new object of the type Server
with the object title "My little server" via the API.
Request to server:
{ "jsonrpc" : "2.0" , "method" : "cmdb.object.create" , "params" : { "type" : "C__OBJTYPE__SERVER" , "title" : "My little server" , "apikey" : "c1ia5q" }, "id" : 1 } |
Via cURL you can send this request for test purposes:
curl \ --data '{"jsonrpc":"2.0","method":"cmdb.object.create","params":{"type":"C__OBJTYPE__SERVER","title":"My little server","apikey":"c1ia5q"},"id":1}' \ --header "Content-Type: application/json" \ |
Server response:
{ "jsonrpc" : "2.0" , "result" : { "id" : "3351" , "message" : "Object was successfully created" , "success" : true }, "id" : 1 } |
Categories in the IT Documentation
A helpful listing of all categories and attributes used in i-doit is provided by a special URL:
For example, this listing shows you which name is used to access categories and attributes and which data types are expected by these attributes.
Clients and Libraries
There are numerous projects and products applying the API by i-doit. We would like to introduce some clients and libraries:
Name | Website | Programming language | License |
---|---|---|---|
Idoit.API.Client | https://github.com/OKT90/Idoit.API.Client | C# | MIT |
i-doit API client | https://github.com/bheisig/i-doit-api-client-php | PHP | AGPLv3 |
i-doit CLI | https://github.com/bheisig/i-doit-cli | PHP | AGPLv3 |
i-doit-go-api | https://github.com/cseeger-epages/i-doit-go-api | Go | GPLv3 |
Feedback
Should a client or a library be missing in this article, we appreciate a short message to feedback@i-doit.com.
Documentation for Download
You can download a documentation maintained by the developers as PDF file. (out-dated)
Releases
Version | Date | Changelog |
---|---|---|
1.11.1 | 2020-04-09 | [Bug] Updates via the API (save method) sets arbitrary entries in the Virtual Host category |
1.11 | 2020-03-23 | [Bug] Do not connect root location while creating cluster membership |
1.10.4 | 2019-09-02 | [Improvement] Add RPC to handle the CMDB status |
1.10.3 | 2019-05-06 | [Bug] Assignment of devices to segments in slots not possible |
1.10.2 | 2019-04-01 | [Bug] cmdb.category.read: Read entries by state "normal" unless otherwise noted |
1.10.1 | 2019-01-23 | [Bug] Authentication with LDAP not possible |
1.10 | 2018-12-17 | [Improvement] Enable validation of API requests via expert setting |
1.9.1 | 2018-04-16 | [Bug] cmdb.reports.read throws SQL error for variable reports [Bug] Method cmdb.reports throws PHP warning [Bug] After creating an object, a reindex is substantial to find an object via the search [Bug] Unable to create entries in category C__CATS__ORGANIZATION_CONTACT_ASSIGNMENT [Bug] API ignores language parameter |
1.9 | 2018-01-23 | [Improvement] Searching for objects by attributes and values [Improvement] Enforce user rights for API calls [Improvement] Create object via "cmdb.object.create" with optional template [Bug] Unable to upload file [Bug] Logbook title is empty when saving a custom category [Bug] User-defined dialog plus contents select via API [Bug] Unable to read passwords [Bug] Method 'cmdb.object.create' creates object id's partly as string, partly as integer [Bug] Database error when trying to delete an object, which does not exist anymore, via the API [Bug] Dialog Plus fields that have a dependency on another attribute have not been created. |
1.8.1 | 2017-03-02 | [Bug] Self-defined Dialog+ fields won't be displayed after creating them [Bug] Created dialog entries receive status 1 instead of 2 (normal) [Bug] cmdb.object.delete ignores parameter "status" [Bug] cmdb.category.create throws database error for category "model" |
Since version 1.8.1 the API is released as an add-on. Pre-releases were bundled with i-doit.