items_create | R Documentation |
A method to create multiple ScienceBase items with a single call and a single HTTP service request. Can be useful for improving performance of creating a large number of items at once.
items_create(parent_id = user_id(), title, ..., info = NULL)
parent_id |
An |
title |
Two or more titles for the new SB items |
... |
Additional parameters are passed on to |
info |
(optional) list of metadata info for the new items. for each item include a named list of variables |
The length of the title
and info
values must be the same
length - however, the parent_id
can be of length 1 or equal to the length
of each of title
and info
parameters
One or more objects of class sbitem
in a list
## Not run:
# helper function to make a random name
aname <- function() paste0(sample(letters, size = 5, replace = TRUE), collapse = "")
# Create some items - by default we use your user ID
items_create(title = c(aname(), aname()))
# add additional items in the info parameter - by default we use your user ID
items_create(title = c(aname(), aname()),
info = list(
list(contacts = list(list(name = "Suzy"))),
list(contacts = list(list(name = "Brandy")))
)
)
# another example with more information - by default we use your user ID
items_create(title = c(aname(), aname()),
info = list(
list(contacts = list(list(name = "Suzy"))),
list(contacts = list(list(name = "Brandy")))
)
)
# Pass an object of class sbitem
(x <- folder_create(user_id(), aname()))
items_create(x, title = c(aname(), aname()))
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.