brapi_put_images_imageDbId_imagecontent: put /images/{imageDbId}/imagecontent

View source: R/brapi_put_images_imageDbId_imagecontent.R

brapi_put_images_imageDbId_imagecontentR Documentation

put /images/{imageDbId}/imagecontent

Description

Update an image with the image file content

Usage

brapi_put_images_imageDbId_imagecontent(
  con = NULL,
  imageDbId = "",
  imageFileContent = ""
)

Arguments

con

list; required: TRUE; BrAPI connection object

imageDbId

character; required: TRUE; The unique identifier for a image

imageFileContent

character; required: TRUE; The absolute location of the image file content to be uploaded to the server.

Details

Update an image with the image file content. This function should be paired with the POST /images call, as implemented in the brapi_post_images() function, for full capability.

Value

data.frame

Author(s)

Maikel Verouden

References

BrAPI SwaggerHub

See Also

Other brapi-phenotyping: brapi_get_events(), brapi_get_images_imageDbId(), brapi_get_images(), brapi_get_methods_methodDbId(), brapi_get_methods(), brapi_get_observationlevels(), brapi_get_observations_observationDbId(), brapi_get_observations_table(), brapi_get_observations(), brapi_get_observationunits_observationUnitDbId(), brapi_get_observationunits_table(), brapi_get_observationunits(), brapi_get_ontologies(), brapi_get_scales_scaleDbId(), brapi_get_scales(), brapi_get_search_images_searchResultsDbId(), brapi_get_search_observations_searchResultsDbId(), brapi_get_search_observationunits_searchResultsDbId(), brapi_get_search_variables_searchResultsDbId(), brapi_get_traits_traitDbId(), brapi_get_traits(), brapi_get_variables_observationVariableDbId(), brapi_get_variables(), brapi_post_images(), brapi_post_methods(), brapi_post_observations(), brapi_post_observationunits(), brapi_post_scales(), brapi_post_search_images(), brapi_post_search_observations(), brapi_post_search_observationunits(), brapi_post_search_variables(), brapi_post_traits(), brapi_post_variables(), brapi_put_images_imageDbId(), brapi_put_methods_methodDbId(), brapi_put_observations_observationDbId(), brapi_put_observationunits_observationUnitDbId(), brapi_put_scales_scaleDbId(), brapi_put_traits_traitDbId(), brapi_put_variables_observationVariableDbId()

Other Images: brapi_get_images_imageDbId(), brapi_get_images(), brapi_get_search_images_searchResultsDbId(), brapi_post_images(), brapi_post_search_images(), brapi_put_images_imageDbId()

Examples

## Not run: 
con <- brapi_db()$testserver
con[["token"]] <- "YYYY"

## Create function argument values for brapi_post_images()
additionalInfo <- list(dummyData = "TRUE",
                       example = "post_images")
copyright <- "Copyright 2021 Bob Robertson"
description <- "This is a picture"
descriptiveOntologyTerms <- c("doi:10.1002/0470841559",
                              "Red",
                              "ncbi:0300294")
externalReferences <-
  data.frame(referenceID = c("doi:10.155454/12341234",
                             "http://purl.obolibrary.org/obo/ro.owl",
                             "75a50e76"),
             referenceSource = c("DOI",
                                 "OBO Library",
                                 "Remote Data Collection Upload Tool"))
imageFileName <- "FAIR_data.jpg"
imageFileSize <- 39268
imageHeight <- 407

## Create the imageLocation argument
## Load geojsonR package
library(geojsonR)
## Create a imageLocation list object
## Point geometry
init <- TO_GeoJson$new()
imageLocation <- list()
pointData <- c( 5.663288, # longitude
               51.988720, # lattitude
                     0)   # altitude
imageLocation[["geometry"]] <- init$Point(data = pointData,
                                          stringify = FALSE)
imageLocation[["type"]] <- "Feature"

imageName <- "FAIR Data"
imageTimeStamp <- "2021-10-11T14:11:28.672Z"
imageURL <- "https://wiki.brapi.org/images/tomato"
imageWidth <- 1200
mimeType <- "image/jpg"
observationDbIds <- c("observation1",
                      "observation4")
observationUnitDbId <- "observation_unit1"

## Add new image meta data
out <- brapi_post_images(
  con = con,
  additionalInfo = additionalInfo,
  copyright = copyright,
  description = description,
  descriptiveOntologyTerms = descriptiveOntologyTerms,
  externalReferences = externalReferences,
  imageFileName = imageFileName,
  imageFileSize = imageFileSize,
  imageHeight = imageHeight,
  imageLocation = imageLocation,
  imageName = imageName,
  imageTimeStamp = imageTimeStamp,
  imageURL = imageURL,
  imageWidth = imageWidth,
  mimeType = mimeType,
  observationDbIds = observationDbIds,
  observationUnitDbId = observationUnitDbId)

## Obtain the imageDbId
imageDbId <- unique(out$imageDbId)

## Retrieve information about the new image
brapi_get_images_imageDbId(con = con, imageDbId = imageDbId)

## Update an image with the image file content
imageFileContent <- system.file("extdata",
                                "FAIR_data.jpg",
                                package = "brapirv2")
brapi_put_images_imageDbId_imagecontent(con = con,
                                        imageDbId = imageDbId,
                                        imageFileContent = imageFileContent)

## Check the changes
brapi_get_images_imageDbId(con = con, imageDbId = imageDbId)

## End(Not run)


mverouden/brapir-v2 documentation built on April 22, 2022, 9:24 a.m.