# create a new item (works as expected)
test_item <- item_upsert(title="books.json")
# unexpected: the new item has the title "books.json" rather than "sbtools stuff".
item_upsert(test_item, title=NULL, info=list(title = "sbtools stuff"))
# This message was given: "title is NULL - re-using title from input SB item"
# But it's not clear from the message that/why info$title is getting ignored
If you create a new item using
item_upsertwith the title ininforather thantitle, the value ininfo$titlegets silently ignored.After logging in:
Possible approaches to clarify/change this behavior:
item_upsertmore clearly restrictive: either noisily overridetitlewithinfo$titleifinfo$titleexists, or always throw an error iftitleis included ininfo.item_upsertmore flexible: allow for all sorts of item queries, rather than just queries bytitle. All sorts of queries are available through the ScienceBase API for UPSERT (https://my.usgs.gov/confluence/display/sciencebase/ScienceBase+Catalog+Item+REST+Services#ScienceBaseCatalogItemRESTServices-UPSERTRequests). Maybe thetitlearg could be replaced by aquery_listarg with the same definition asquery_listinquery_sb?