7 Replies Latest reply on Nov 24, 2015 3:24 PM by dng

    Using CreateSearchByAttribute with the PI Web API

    PanuHorsmalahti

      Hi, I'm trying to use the CreateSearchByAttribute API, but I'm getting an error on the response:

      Errors: [ 'Invalid request content: Unknown or invalid WebID format: \'D0HGUm_lNI5ESd_B4zdPevxAKN_OaAbCmU2vqgqcsP9JUAUlNQLUFGXEFOR0xPIEFNRVJJQ0FO\'.' ] } ]

       

      It appears that the PI Web API is not quite parsing my JSON payload.

       

      My request is as follows:

      body: '{

      "SearchRoot":"D0HGUm_lNI5ESd_B4zdPevxAKN_OaAbCmU2vqgqcsP9JUAUlNQLUFGXEFOR0xPIEFNRVJJQ0FO",

      "ElementTemplate":"T0HGUm_lNI5ESd_B4zdPevxAYRjekeumBE2qLSkrvxudIwUlNQLUFGXEFOR0xPIEFNRVJJQ0FOXEVMRU1FTlRURU1QTEFURVNbRklMVEVSLURPV05USU1FXQ",

      "ValueQueries":[{"AttributeName":"FaultID","AttributeValue":101,"SearchOperator":"Equal"}]

      }',

      _header: 'POST /piwebapi/eventframes/searchbyattribute HTTP/1.1\r\nhost: 10.x.x.x\r\nauthorization: Basic <removed>=\r\naccept: application/json\r\ncontent-type: application/json\r\ncontent-length: 323\r\nConnection: close\r\n\r\n',