3 Replies Latest reply on Jan 11, 2018 7:59 PM by rschmitz

    PI Web API WebId encoding




      First of all, the PI Web API is splendid and a real time saver of our team!  However, we often have to do multiple queries to get the necessary WebIds that we need.


      How can we encode the WebId ourselves using guid and/or paths as specified in the documentation?


      It would be beneficial to be able to do this to avoid querying the API for this information before one is able to construct the query one is really interested in.


      Also, as a suggestion for the future, it would be super if it would be possible to include the WebId as a parameter for AF Notifications.



        • Re: PI Web API WebId encoding
          Roger Palmen

          Reading this post: Re: WebID for same tags in two different systems

          It seems that:

          WebID’s are coded based on an AF objects GUID and it’s path. GUID’s change when an object becomes deleted and re-created

          Not sure about the 'new' WebID introduced in 2017R2 though.


          Knowing the WebID is only possible when either 1) you know the asset structure you need to query or 2) you either determine the WebID based on 1 or retrieve it using the WebAPI and store it locally.


          In the case of 1) you could use a batch call to get your data without the need to know your WebID on the caller side.

          In the case of 2) this moves the entire problem just one step down the line: how to determine and/or store the WebID?


          So i don't really see a big issue in the WebID. In most of my applications i either retrieve the IDs on initialization and subsequently don't need to ask, or i use a batch call and don't even look at the WebID

            • Re: PI Web API WebId encoding

              Thanks for your reply!


              Thats fine, we do use both batch call's and storage of WebID's, but we would still like to know how we could encode a WebId from the path and guid. A simple base64 encoding didn't do the trick


              From the webid-type help for 2017R2: "Some of the WebID 2.0 formats can be generated in client application code rather than querying PI Web API for them. If this is necessary in your application, please contact Technical Support for more information."



              1 of 1 people found this helpful
                • Re: PI Web API WebId encoding

                  Hi Torstein,


                  I took a look into this and it appears the documentation for the generating 2.0 WebIds is still in review and didn't make into this past release cycle with the release of Web API 2017 R2 as was originally expected (which is why you see that line in the help documentation). It's likely we'll have the information for you in the near future, but at the moment we don't have the documentation you're looking for.




                  2 of 2 people found this helpful