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 } -
[SOLVED]
@Michael-Huhn this seems to work.However you discovered that, because for me it's not very intuitive to "search =<int>" when it's more like a "search where in <text>".
Thanks a lot.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login