Update many SB items with new metadata

Share:

Description

A method to update multiple ScienceBase items with a single call and a single HTTP service request. Can be useful for improving performance of updating a large number of items at once.

Usage

1
items_update(sb_id, info, ..., session = current_session())

Arguments

sb_id

An sbitem object or a character ScienceBase ID corresponding to the item

info

list of metadata info (key-value pairs) to change on the item

...

Additional parameters are passed on to PUT

session

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

Details

If length of sb_id > 1, then length of info input must be the same

Value

One or more objects of class sbitem in a list

Examples

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

res <- items_create(user_id(), title = c(aname(), aname())) 
out <- items_update(res, info = list( list(title = aname()), list(title = aname()) ) )
vapply(out, "[[", "", "title")

## End(Not run)

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