Hello,
I'm exploring different ways of exporting and importing data from i-doit.
I've seen the XML import option. Is it also possible to export data as XML?
Hello,
I'm exploring different ways of exporting and importing data from i-doit.
I've seen the XML import option. Is it also possible to export data as XML?
In this topic, it is explained how to manage tags using the API. The limitations in the use of tags I mention in my previous post do not exist.
However, I am still wondering about the consequences of using tags vs object groups.
Thanks @michael-overkamp!
I had not undestood that multiselect is a Dialog+, I thought it was a different kind of attribute.
Thanks @michael-overkamp!
It works fine.
Yes, I was using the ID of the license object.
It works fine with the license entry ID.
Thank you!
Hello @philipp-hörselmann,
I am using i-doit Version 1.16 OPEN with API add-on version 1.12.1.
I have also tested this on https://demo.i-doit.com/ with the same result.
Best regards
Hello,
I have not been able to assign a license to an application when creating a software assignment category. I have detected that title-based assignment is not supported and id-based assignment returns an error.
My attempt in i-doit demo:
{
"version": "2.0",
"method": "cmdb.category.save",
"params": {
"object": 1412,
"category": "C__CATG__APPLICATION",
"data": {
"application": 477,
"assigned_version": 22,
"assigned_license": 2988
},
"apikey": "c1ia5q",
"language": "en"
},
"id": 1
}
{
"id": 1,
"jsonrpc": "2.0",
"error": {
"code": -32603,
"message": "Internal error: An database error occurred that indicates that you provided an Id which does not exist. \n Please check all properties which are referencing an entry for validity: FOREIGN KEY (`isys_catg_application_list__isys_cats_lic_list__id`) REFERENCES `isys_cats_lic_)",
"data": {
"mysqlErrorCode": 1452,
"mysqlErrorMessage": "Database error : Query error: 'INSERT INTO isys_catg_application_list SET\n\t\t\tisys_catg_application_list__isys_connection__id = 5180,\n\t\t\tisys_catg_application_list__isys_obj__id = 1412,\n\t\t\tisys_catg_application_list__description = '',\n\t\t\tisys_catg_application_list__status = 2,\n\t\t\tisys_catg_application_list__isys_cats_app_variant_list__id = NULL,\n\t\t\tisys_catg_application_list__isys_cats_lic_list__id = 2988,\n\t\t\tisys_catg_application_list__bequest_nagios_services = 0,\n\t\t\tisys_catg_application_list__isys_catg_application_type__id = 1,\n\t\t\tisys_catg_application_list__isys_catg_application_priority__id = NULL,\n\t\t\tisys_catg_application_list__isys_catg_version_list__id = 22;':\nCannot add or update a child row: a foreign key constraint fails (`idoit_demo_data_pro`.`isys_catg_application_list`, CONSTRAINT `isys_catg_application_list_ibfk_7` FOREIGN KEY (`isys_catg_application_list__isys_cats_lic_list__id`) REFERENCES `isys_cats_lic_)\n"
}
}
}
The same query works fine when "assigned_license" is removed. This license assignment can be done on the web without issues.
Hello,
I'm testing the use of tags. I have created a different topic to ask about the purpose of tags but I believe it is worthy to ask separately about the use of tags through the API.
As tags are attributes of the General category, I would expect to retrieve tags using cmdb.object.read. However, it is not the case. I would also expect to be able to assign tags to an object using cmdb.object.create. It hasn't worked for me either.
I have considered that the issue may be related to the fact that tags is a multiselect attribute. So, I have checked another multiselect attribute (fiber_wave_lengths of category Cabling-> Connectors). The values can be retrieved as expected with cmdb.category.read but title-based creation is not allowed and the only way I have found to retrieve the id of the possible values for the attribute is to read them from an object where it has previously been manually assigned. This is not convenient.
Questions:
Is it possible to work with tags using the API? What am I doing wrong?
Is it possible to retrieve the list of values that can be assigned to a multiselect attribute?
My attempts:
I have created an object in the i-doit demo and manually assigned a tag
Trying to read the tags with cmdb.object.read:
{
"version": "2.0",
"method": "cmdb.object.read",
"params": {
"objID": 5385,
"apikey": "c1ia5q",
"language": "en"
},
"id": 1
}
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"id": 5385,
"title": "Host 1",
"sysid": "CLOUD_0005385",
"objecttype": 39,
"type_title": "Host",
"type_icon": "images/icons/silk/server.png",
"status": 2,
"cmdb_status": 6,
"cmdb_status_title": "in operation",
"created": "2021-06-17 09:51:47",
"updated": "2021-06-17 09:52:47",
"image": "https://demo.i-doit.com/images/objecttypes/server.png"
}
}
Trying to create an object with an existing tag.
{
"version": "2.0",
"method": "cmdb.object.create",
"params": {
"type": "C__OBJTYPE__HOST",
"title": "Host 2",
"tag": "asdasd",
"apikey": "c1ia5q",
"language": "en"
},
"id": 1
}
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"id": 5391,
"message": "Object was successfully created",
"success": true
}
}
Checking the object created in the web
Hello,
I need to organize some of my objects in groups and I am wondering what are the consequences of using tags and object groups. Object management through API is important in my case.
As far as I understand, object groups seem easier to manage. As they are objects, they can be created, modified and have objects assigned through the API. Moreover, obtaining the list of objects in a group is also straightforward.
On the other hand, tags are not objects but attributes of the General category. Tags are not returned by cmdb.object.read and as far as I have tested, they cannot be assigned in cmdb.object.create. The list of objects in a tag can be retrieved using idoit.search and filtering the results that do belong to the tag.
Are there any other consequences of using one or the other?
Have tags a different purpose than grouping objects under a certain category?
Hello @lfischer,
You're right. It fails when there exists another software with a version with the same name.
It only works for the first application where a version name is defined.
I can also confirm that issue is not only for numeric values, names as the one you suggest also fail.
As an alternative, what does work is to include the version id in the query, instead of the version title. In the case described in my first post, the following query works fine:
{
"version": "2.0",
"method": "cmdb.category.save",
"params": {
"object": 1829,
"category": "C__CATG__APPLICATION",
"data": {
"application": 1866,
"assigned_version":20
},
"apikey": XXXX,
"language": "en"
},
"id": 1
}