#' @title
#' post /search/observationunits
#'
#' @description
#' Submit a search request for Observation Units
#'
#' @param con list; required: TRUE; BrAPI connection object
#' @param germplasmDbIds vector of type character; required: FALSE; The name or synonym of external genebank accession identifiers; default: "", when using multiple values supply as c("value1", "value2").
#' @param locationDbIds vector of type character; required: FALSE; locations these traits were collected; default: "", when using multiple values supply as c("value1", "value2").
#' @param observationLevel character; required: FALSE; The type of the observationUnit. Returns only the observation unit of the specified type; the parent levels ID can be accessed through observationUnit Structure.; default: "".
#' @param observationTimeStampRangeEnd character; required: FALSE; Timestamp range end; default: "".
#' @param observationTimeStampRangeStart character; required: FALSE; Timestamp range start; default: "".
#' @param observationVariableDbIds vector of type character; required: FALSE; The IDs of traits, could be ontology ID, database ID or PUI; default: "", when using multiple values supply as c("value1", "value2").
#' @param page integer; required: FALSE; Which page of the "data" array to return. The page indexing starts at 0 (page=0 will return the first page). Default is 0.
#' @param pageSize integer; required: FALSE; The maximum number of items to return per page of the "data" array. Default is 1000.
#' @param programDbIds vector of type character; required: FALSE; list of programs to search across; default: "", when using multiple values supply as c("value1", "value2").
#' @param seasonDbIds vector of type character; required: FALSE; The year or Phenotyping campaign of a multi-annual study (trees, grape, ...); default: "", when using multiple values supply as c("value1", "value2").
#' @param studyDbIds vector of type character; required: FALSE; The database ID / PK of the studies search parameter; default: "", when using multiple values supply as c("value1", "value2").
#' @param trialDbIds vector of type character; required: FALSE; list of trials to search across; default: "", when using multiple values supply as c("value1", "value2").
#'
#' @details Returns a list of observationUnit with the observed Phenotypes. observationTimeStampRangeStart and observationTimeStampRangeEnd need to be specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) formatting.
#'
#' @return data.frame
#'
#' @author brapir generator package
#'
#' @references \href{https://app.swaggerhub.com/apis/PlantBreedingAPI/BrAPI/1.3#/Observations/post_search_observationunits }{BrAPI SwaggerHub}
#'
#' @family brapi_1.3
#' @family Observations
#' @family Search Services
#'
#' @export
brapi_post_search_observationunits <- function(con = NULL, germplasmDbIds = '', locationDbIds = '', observationLevel = '', observationTimeStampRangeEnd = '', observationTimeStampRangeStart = '', observationVariableDbIds = '', page = 0, pageSize = 1000, programDbIds = '', seasonDbIds = '', studyDbIds = '', trialDbIds = '') {
## Create a list of used arguments
usedArgs <- brapi_usedArgs(origValues = FALSE)
## Check if BrAPI server can be reached given the connection details
brapi_checkCon(con = usedArgs[["con"]], verbose = FALSE)
## Check validity of used and required arguments
brapi_checkArgs(usedArgs, reqArgs = "")
## Obtain the call url
callurl <- brapi_POST_callURL(usedArgs = usedArgs,
callPath = "/search/observationunits",
reqArgs = "",
packageName = "BrAPI",
callVersion = 1.3)
## Build the Body
callbody <- brapi_POST_callBody(usedArgs = usedArgs,
reqArgs = "")
try({
## Make the call and receive the response
resp <- brapi_POST(url = callurl, body = callbody, usedArgs = usedArgs)
## Extract the content from the response object in human readable form
cont <- httr::content(x = resp, as = "text", encoding = "UTF-8")
## Convert the content object into a data.frame
out <- brapi_result2df(cont, usedArgs)
})
## Set class of output
class(out) <- c(class(out), "brapi_post_search_observationunits")
## Show pagination information from metadata
brapi_serverinfo_metadata(cont)
return(out)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.