library(phisWSClientR)
Ask permission to request to the web service:
# If you want to access to the public web service connect(apiID="ws_public")
# If you want to access to a private web service, you have to insert the address of the WS and the port connect(apiID="ws_private",url = "147.99.7.5:8080/phenomeapi/resources/")
aToken will be used in all the requests to the web service.
aToken<-getToken("guestphis@supagro.inra.fr","guestphis")
getProjects(aToken$data)$data getExperiments(aToken$data,projectName = "XYZ")
The user can define a variable with the experiment URI provided by the result of getExperiments() function that can be used in the call of each functions useful to retrieve the data:
myExp<-getExperiments(aToken$data,projectName = "XYZ")$data$experimentURI print(myExp)
Different categories of variables are available in the phenomeapi web service:
vars <- getVariablesByCategory(aToken$data ,category = "environment",experimentURI = myExp) # Only the first rows of the data.frame containing the 'environment' variables... head(vars$data)
# first rows of 'imagery' variables head(getVariablesByCategory(aToken$data,category ="imagery",experimentURI=myExp)$data)
# first rows of 'watering' variables head(getVariablesByCategory(aToken$data,category ="watering",experimentURI=myExp)$data)
# first we count the number of observation in the dataset tpCount<-getImagesAnalysis(token=aToken$data, experimentURI=myExp, variablesName = list("plantHeight"), labelView ="side0", verbose=FALSE)$totalCount # we retrieve this number with $totalcount # In this example, we set the pageSize to 10 for speed purpose but in real example, please use tpCount requetManip<-getImagesAnalysis(token=aToken$data, experimentURI=myExp, variablesName = list("plantHeight"), labelView ="side0", pageSize=10)$data head(requetManip) # getPlants function allows the user to retrieve all the information for all the plants of an experiment # In this example, we set the pageSize to 10 for speed purpose but in real example, please use tpCount idManip<-getPlants(token=aToken$data, experimentURI=myExp, pageSize=10)$data head(idManip)
try the following code and explore the dataset
myFacility<-"http://www.phenome-fppn.fr/m3p/es2" tpCount<-getEnvironment(token = aToken$data , experimentURI = myExp, facility=myFacility, variables = "air humidity_weather station_percentage")$totalCount #--- Air humidity # we retrieve this number with $totalcount # In this example, we set the pageSize to 10 for speed purpose but in real example, please use tpCount myMeteoHumidity<-getEnvironment(token = aToken$data,experimentURI=myExp, facility=myFacility, variables="air humidity_weather station_percentage", pageSize=10)$data
try the following code and explore the dataset
tpCount<-getWatering(token=aToken$data,experimentURI=myExp, variablesName = list("weightAfter"), verbose=FALSE)$totalCount # we retrieve this number with $totalcount # In this example, we set the pageSize to 10 for speed purpose but in real example, please use tpCount requetIrrig<-getWatering(token=aToken$data,experimentURI=myExp, variablesName = list("weightAfter"), pageSize=10)$data
sessionInfo()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.