Upsert an SB item

Description

Either creates or updates (if item already exists)

Usage

1
2
item_upsert(parent_id = user_id(), title = NULL, ..., info = NULL,
  session = current_session())

Arguments

parent_id

An sbitem object or character ScienceBase ID corresponding to the parent item (folder)

title

The title of the new SB item

...

Additional parameters are passed on to GET, POST, HEAD, PUT, or DELETE

info

(optional) list of metadata info for the new item

session

Session object from authenticate_sb. Defaults to anonymous or last authenticated session

Value

An object of class sbitem

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
## Not run: 
# helper function to make a random name
aname <- function() paste0(sample(letters, size = 5, replace = TRUE), collapse = "")

# Create an item - by default we use your user ID
(x <- item_upsert(title = aname()))

# Call item_upsert again, updates this time
item_upsert(x, info = list(
		contacts = list(list(name = "Suzy"))
	)
)

## End(Not run)

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.