10 Replies Latest reply on Aug 30, 2016 1:15 AM by Eugene Lee

    Search attributes by name under a given element

    BoSun

      Given attribues names and an element path(not immediate parent of those attributes), is it possible to make one call for all webids of those input attributes?  Those input attributes are not under one category. 

       

      If not possible, what's the best way to do it.  I'm trying to reduce the calls to the server. 

       

      Thanks a lot!

        • Re: Search attributes by name under a given element
          Eugene Lee

          Hi Bo Sun,

           

          You can make one batch call like this.

          {
            "1": {
              "Method": "GET",
              "Resource": "https://yourservername/piwebapi/elements?path=yourpath&selectedFields=WebId"
            },
            "2": {
             "Method": "GET",
              "Resource": "https://yourservername/piwebapi/elements/{0}/elementattributes?attributeNameFilter=yourattributename&searchFullHierarchy=true&selectedFields=Items.WebId;Items.Path",
              "Parameters": [
                "$.1.Content.WebId"
              ],
              "ParentIds": [
                "1"
              ]
            }
          }
          

           

          Replace yourservername, yourattributename and yourpath with values that are relevant to your environment.

           

          Sample response:

           

          {
            "1": {
              "Status": 200,
              "Headers": {
                "Content-Type": "application/json; charset=utf-8",
                "Content-Length": "108"
              },
              "Content": {
                "WebId": "E0jRPBv3e6V0--bnqvQvMfqwbjN3kwzA5RGURggAJwnDDARVVHRU5FV0VCXFRFU1RcRVVHRU5FV0VCIE1PRFVMRURCXE9TSQ"
              }
            },
            "2": {
              "Status": 200,
              "Headers": {
                "Content-Type": "application/json; charset=utf-8",
                "Content-Length": "476"
              },
              "Content": {
                "Items": [
                  {
                    "WebId": "A0EjRPBv3e6V0--bnqvQvMfqwbjN3kwzA5RGURggAJwnDDAQW_Ja8SejEea-5bszx6QMwRVVHRU5FV0VCXFRFU1RcRVVHRU5FV0VCIE1PRFVMRURCXE9TSXxBVFRSSUJVVEUx",
                    "Path": "\\\\EUGENE\\test\\root\\OSI|Attribute1"
                  },
                  {
                    "WebId": "A0EjRPBv3e6V0--bnqvQvMfqwcTN3kwzA5RGURggAJwnDDA0Axxt_UOUkmqGOz2Drny1gRVVHRU5FV0VCXFRFU1RcRVVHRU5FV0VCIE1PRFVMRURCXE9TSVxBQ0VDTEFTU0xJQlJBUklFU3xBVFRSSUJVVEUx",
                    "Path": "\\\\EUGENE\\test\\root\\OSI\\ACEClassLibraries|Attribute1"
                  }
                ]
              }
            }
          }
          
          3 of 3 people found this helpful