Hello,
I have discovered I can enter logbook entries manually or using the API. However, I have not found any way to modify manually/API created logbook entries.
Is it possible?
Hello,
I have discovered I can enter logbook entries manually or using the API. However, I have not found any way to modify manually/API created logbook entries.
Is it possible?
Hello @Eduardo-Casarero,
You should try using the method cmdb.category.read for category "C__CATS__PERSON_ASSIGNED_GROUPS" using the user id.
{
"version": "2.0",
"method": "cmdb.category.read",
"params": {
"objID": 158,
"category": "C__CATS__PERSON_ASSIGNED_GROUPS",
"apikey": "XXX"
},
"id": 1
}
Hello,
I have noticed that IPv4 address is not validated through the API in the same way it is validated in the web.
When created in the web, it is not acceptable to include an address that is not the IP range of the net or that already exits. However, there are no issues in doing so using the API.
I have been able to reproduce this both on i-doit demo and on my i-doit 1.18.2 OPEN installation.
Is there a way to enforce IPv4 address validation through the API?
Thank @Michael-Overkamp!
I confirm that the hotfix solves the issue.
I am currently using i-doit 1.18.2 OPEN and API 1.12.3.
In this setup, there are some API calls that fail and that used to work in my previous i-doit version. They are still working in the i-doit demo.
The API response includes the error: "The provided property is virtual and can not be updated via API. Please provide a valid definition."
I have not been able to find anything in the changelog that suggests why this may happen. I have not found any reference to virtual properties in the Knowledge Base either.
The API call that fails are the following.
{
"version": "2.0",
"method": "cmdb.category.save",
"params": {
"object": 3628,
"category": "C__CATS__FILE_VERSIONS",
"apikey": "XXXXX",
"language": "en",
"data": {
"file_title": "file.txt",
"file_physical": "file.txt",
"file_content":"VGhpcyBpcyBhIHRlc3QgZmlsZS4NClRoaXMgaXMgYSB0ZXN0IGZpbGUuDQpUaGlzIGlzIGEgdGVzdCBmaWxlLg0KVGhpcyBpcyBhIHRlc3QgZmlsZS4NClRoaXMgaXMgYSB0ZXN0IGZpbGUuDQpUaGlzIGlzIGEgdGVzdCBmaWxlLg=="
}
},
"id": 1
}
Error:
{
"id": 1,
"jsonrpc": "2.0",
"error": {
"code": -32603,
"message": "Internal error: There was an validation error",
"data": {
"file_content": "(The provided property is virtual and can not be updated via API. Please provide a valid definition.) "
}
}
}
{
"version": "2.0",
"method": "cmdb.category.save",
"params": {
"apikey": "XXXXX",
"language": "en",
"object": 1334,
"category": "C__CATG__NETWORK_PORT",
"data": {
"title": "eth0",
"port_type": "Ethernet",
"addresses": 209
}
},
"id": 1
}
Error:
{
"id": 1,
"jsonrpc": "2.0",
"error": {
"code": -32603,
"message": "Internal error: There was an validation error",
"data": {
"addresses": "(The provided property is virtual and can not be updated via API. Please provide a valid definition.) "
}
}
}
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
}
I have detected that I am not able to set the version of some applications when assigning them to a device. It does not happen with all of them and I have not been able to reproduce the issue in the demo. Is there any configuration parameter related to this behavior?
Here, I include an example of how I retrieve the application versions and assign one of them to a device. Then, when I retrieve the software assignment of the device the version is empty. It appears in the same way in the web interface. It is treated as if the assigned_version did not exist.
{
"version": "2.0",
"method": "cmdb.category.read",
"params": {
"objID": 1866,
"category": "C__CATG__VERSION",
"apikey": XXXX,
"language": "en"
},
"id": 1
}
{
"id": 1,
"jsonrpc": "2.0",
"result": [
{
"id": "20",
"objID": "1866",
"title": "1.0.0",
"servicepack": "",
"kernel": "",
"patchlevel": "",
"description": ""
}
]
}
{
"version": "2.0",
"method": "cmdb.category.save",
"params": {
"object": 1829,
"category": "C__CATG__APPLICATION",
"data": {
"application": 1866,
"assigned_version":"1.0.0"
},
"apikey": XXXX,
"language": "en"
},
"id": 1
}
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"success": true,
"message": "Category entry successfully saved",
"entry": 194
}
}
{
"version": "2.0",
"method": "cmdb.category.read",
"params": {
"objID": 1829,
"category": "C__CATG__APPLICATION",
"apikey": XXXX,
"language": "en"
},
"id": 1
}
{
"id": 1,
"jsonrpc": "2.0",
"result": [
{
"id": "194",
"objID": "1829",
"application": {
"title": "App2",
"id": "1866",
"connection_id": "322",
"type": "C__OBJTYPE__APPLICATION",
"type_title": "Application",
"sysid": "SYSID_1623405979"
},
"application_type": {
"id": "1",
"title": "Software",
"const": "C__CATG__APPLICATION_TYPE__SOFTWARE",
"title_lang": "LC__CATG__APPLICATION_TYPE__SOFTWARE"
},
"application_priority": null,
"assigned_license": false,
"assigned_license_key": null,
"assigned_database_schema": false,
"assigned_it_service": false,
"assigned_variant": null,
"assigned_version": null,
"bequest_nagios_services": {
"value": "0",
"title": "No"
},
"assigned_databases": null,
"description": ""
}
]
}
Hello,
I would like to create a Host Address through the API that includes DHCP allocation.
I only have been able to create Host Adresseses marked as static. I have no issues setting the assignment I choose in the web interface.
The attribute "ipv4_assignment" only accepts the values in the dialog "IP: Assignment" () but regardless of the value I send, the Host Address is always static.
This is one of my attempts to https://demo.i-doit.com
{
"version": "2.0",
"method": "cmdb.category.save",
"params": {
"object": 1412,
"category": "C__CATG__IP",
"data": {
"net": 20,
"ipv4_assignment": "DHCP"
},
"apikey": "c1ia5q",
"language": "en"
},
"id": 1
}
Thank you @lfischer .
That solved the issue, now the API returns the password decrypted.
Hello,
I would like to use the API to retrieve information about our equipment, including passwords.
Using method cmdb.category.read to get category C__CATG__PASSWD returns a password field that seems to be the password encoded. However, I have not been able to identify the encoding. What kind of encoding is it? How should I decode a password obtained through API?
Hello,
I would like to create a custom category similar to 'software assignment' but also including an attribute that links to a configuration file for every application . As a result, I have tried to create a custom category the includes the same attributes as 'software assignment', plus an extra one to include the relationship to a file.
I do not know how to replicate the attribute that includes the application version.
I have read in the documentation about 'Browser with Subselection'. It does not seems to be the mechanism used in software assignment versions but it seems useful for my case. However, I have not been able to add this kind of attribute to a custom category. Is it possible? Is there a different way to create an attribute that references an attribute of a different object that is also been referenced?
As 'software assignment' backwards the category 'Application -> Installation', it would also be valid for me to replicate this category. In this case, I would need to create an attribute that references another attribute of the same object. I do not know how to do this either.
What is the best solution for this case?
For further reference, is it possible to explore the configuration of existing categories in the same way that object type configurations can be seen in 'Administration -> CMDB settings -> Object type configuration'?