AnsweredAssumed Answered

PI webAPI and R integration

Question asked by don.guan on May 2, 2018
Latest reply on May 4, 2018 by don.guan

I tried to use the sample code of the PI web API client lib for R (https://github.com/osimloeff/PI-Web-API-Client-R). Please clarify the syntax of the two highlighted lines - the correct way to define the PI AF server and a AF tag.  The error message is "Error: object 'piwebapi' not found". I installed the PI-R webapi package program correctly so I can get the data from your UC Davis data site to R.    

 

piWebApiservice <- piwebapi$new("https://InternalPIserver.xxx.com/piwebapi", TRUE, NULL, NULL, FALSE, FALSE)

BLR.GAS.DP <- piWebApiService$data$getRecordedValues(path =

                                   "af:\\\\Database1\\Totalizers|BLR.GAS.DP",

                                    startTime = "1-mar-2018", endTime = "*",

                                    selectedFields = "items.value;items.timestamp",

                                    maxCount = 50000)

2.    How to set up the Authentication to get data from my PI system? I added the code below at the beginning of my R code, but I still got the same error "Error: object 'piwebapi' not found".

useKerberos <- FALSE

username <- "myusername"

password <- "mypassword"

validateSSL <- TRUE

debug <- TRUE

piWebApiService <- piwebapi$new("https://InternalPIserver.xxx.com/piwebapi", useKerberos, username, password, validateSSL, debug)

 

Thank you.

 

Don

Outcomes