Using cmdb.condition.read to search for tags
-
I'm currently working on a Powershell module to map i-doit objects to PS objects easier.
It shoudl offer to be able to search for objects containing a tag.How to setup a condition to find an object containing a tag?
This one gets 0 results
"conditions": [
{
"comparison": "=",
"property": "C__CATG__GLOBAL-type",
"value": "C__OBJTYPE__SERVER"
},
{
"comparison": "=",
"property": "C__CATG__GLOBAL-tag",
"value": "MyTag"
}
]This one returns all server objects
"conditions": [
{
"comparison": "=",
"property": "C__CATG__GLOBAL-type",
"value": "C__OBJTYPE__SERVER"
},
{
"comparison": "like",
"property": "C__CATG__GLOBAL-tag",
"value": "MyTag"
}
]Any ideas?
Thank you in advance -
This post is deleted! -
@laurawoods Greatly appreciate your hint!
My stupid, I used "*" and not thinking, that it gets 1:1 into a SQL Statement.
Thanks a lot! -
@laurawoods
Searching with "%" seems not to work as you expect. I only do get meaningful results using "*".But you are 100% correct: Tags can not be searching using the 'condition'-API request.
Once again it was a pain to find this out (due to your reply) - this should be clearly stated by the documentation (which IMHO is a pain too - at least the one onloine on https://kb.i-doit.com/ ).As a workaround I will use the old idot.search. This one is able to find tags.
The results must be filtered for the key * > Tags.
But that's much faster as other things I tried.Thanks and have a good day,
Wolfgang -
ich habe mir das mal angesehen und wenn ich die ID des Tags nutze erhalte ich ein Ergebnis.
{ "version": "2.0", "method": "cmdb.condition.read", "params": { "conditions": [ { "property": "C__CATG__GLOBAL-tag", "comparison": "=", "value": 3 } ], "apikey": "ritschipandi", "language": "en" }, "id": 1 }