Community
    • Categories
    • Recent
    • Popular
    • Users
    • Search
    • Register
    • Login

    Using cmdb.condition.read to search for tags

    Scheduled Pinned Locked Moved Development
    6 Posts 2 Posters 402 Views 1 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • W Offline
      WolfgangW
      last edited by

      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

      1 Reply Last reply Reply Quote 0
      • W Offline
        WolfgangW
        last edited by

        This post is deleted!
        1 Reply Last reply Reply Quote 0
        • W Offline
          WolfgangW
          last edited by

          @laurawoods Greatly appreciate your hint!
          My stupid, I used "*" and not thinking, that it gets 1:1 into a SQL Statement.
          Thanks a lot!

          1 Reply Last reply Reply Quote 0
          • W Offline
            WolfgangW
            last edited by

            @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

            Michael HuhnM 1 Reply Last reply Reply Quote 0
            • Michael HuhnM Offline
              Michael Huhn @WolfgangW
              last edited by

              undefined @WolfgangW

              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
              }
              1 Reply Last reply Reply Quote 0
              • W Offline
                WolfgangW
                last edited by

                [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.

                1 Reply Last reply Reply Quote 0

                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
                • First post
                  Last post