synRestPutAsync | R Documentation |
Sends an HTTP PUT request to the Synapse server.
synRestPutAsync(uri, body=NULL, endpoint=NULL, headers=NULL, retry_policy=list(), requests_session_async_synapse=NULL)
uri |
URI on which get is performed |
body |
The payload to be delivered |
endpoint |
Server endpoint. Defaults to repoEndpoint |
headers |
Dictionary of headers to use |
retry_policy |
A retry policy that matches the arguments of synapseclient.core.retry.with_retry_time_based_async. |
requests_session_async_synapse |
The async client to use when making this specific call. |
... |
Any other arguments taken by a request method |
JSON encoding of response
## Not run:
library(jsonlite)
# create payload
request <- list(includeEntity = TRUE)
body <- toJSON(request, auto_unbox = TRUE)
# a helper function to run async function
run_coroutine <- function(coroutine) {
asyncio <- import("asyncio")
result <- asyncio$run(coroutine)
return(result)
}
# run the coroutine to get the entity bundle
entity_bundle <- run_coroutine(synRestPostAsync(uri="/entity/entity_id/bundle2",body=body))
# update a field on the entity
entity_bundle$entity$description <- "NEW_DESCRIPTION"
# update the entity back to Synapse
request <- list(entity = entity_bundle$entity)
body <- toJSON(request, auto_unbox = TRUE)
updated_entity_bundle = run_coroutine(synRestPutAsync(uri=paste0("/entity/",entity_bundle$entity$id,"/bundle2"), body=body))
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.