7 Replies Latest reply on Apr 24, 2017 2:54 PM by gregor

    PI Web API Search Query Tagnames with Spaces

    MaxStrueverWipro

      Hello,

      So I'm having trouble using the search / query function in the PI Web API when it comes to tagnames with spaces.

      Say I am trying to retrieve a tag with the name

      OPCint1Device Status

      if I search for that with the GET query

      https://myPIserver.com/piwebapi/search/query?scope=pi:mypiserver&count=40&q=name:OPCint1Device%20Status
      it returns tons of tags. at first this was confusing but then looking at the manual for it, PI Web API  anything with a space in the q= part of the query will be treated as an OR search. so OPCint1Device Status is searching for

      anything that matches name=OPCint1Device OR anything that matches "Status" ... so, lots of other tags that have Status in the name

      the space character is not mentioned in the help page as a character that needs to be escaped with a \, but it also doesn't mention how to handle spaces in the name or other query field

      I've tried the following, with no luck

      • name:OPCint1Device\ Status
        • this returned lots of tags again, so still doing OR
      • name:OPCint1Device?Status
        • this returned 0 tags, does ? wildcard  only match alphanumeric characters and not spaces? this is different than say a ? in a tag search in ProcessBook
      • (name:OPCint1Device Status)
        • returned lots of tags
      • name:"OPCint1Device Status"
        • returned lots of tags
      • "name:OPCint1Device Status"
        • returned 0 tags
      • name:'OPCint1Device Status'
        • returned 0 tags
      • 'name:OPCint1Device Status'
        • returned 0 tags
      • name:OPCint1DeviceStatus
        • returned 0 tags

       

       

      using PI Web API 2015 R2