ZoteroPost {c2z}R Documentation

Post collections and items to a Zotero library

Description

Create or update collections and items in a specified library

Usage

ZoteroPost(
  zotero,
  post.collections = TRUE,
  post.items = TRUE,
  post.attachments = TRUE,
  post.limit = 50,
  force = FALSE,
  silent = FALSE
)

Arguments

zotero

A list with information on the specified Zotero library (e.g., id, API key, collections, and items)

post.collections

Try to copy specified collections, Default: TRUE

post.items

Try to copy specified items?, Default: TRUE

post.attachments

Try to copy specified extras (i.e., attachments and notes)?, Default: TRUE

post.limit

Number of collections/items to post per request (max 50), Default: 50

force

Force is seldom wise, but sometimes..., Default: FALSE

silent

c2z is noisy, tell it to be quiet, Default: FALSE

Details

Please see https://oeysan.github.io/c2z/

Value

A list with information on the specified Zotero library (e.g., posted collections and items)

See Also

select, bind, mutate add_headers, RETRY toJSON, fromJSON as_tibble, add_column stack setNames

Examples


  # Connect to the public group "c2z_delete"
  # NB! This process can be done using only `Zotero` (see README)
  zotero <- Zotero(
    user = FALSE,
    id = "4988497",
    api = "RqlAmlH5l1KPghfCseAq1sQ1"
  )

  # Create a new collection for POST
  zotero$collections <- tibble::tibble(
    key = ZoteroKey(),
    version = 0,
    name = "Post-test",
    parentCollection = "FALSE"
  )

  # Add item to post using `ZoteroAdd` (and `ZoteroDoi`)
  zotero <- ZoteroAdd(
    zotero,
    doi = "10.1126/sciadv.abd1705"
  )

  # Post a DOI to the public group "c2z_delete"
  example <- ZoteroPost(
    zotero,
    post.collections = TRUE,
    post.items = TRUE
  )

  # Delete collections and items using `ZoteroDelete`
  delete.example <- ZoteroDelete(
    zotero,
    delete.collections = TRUE,
    delete.items = TRUE
  )

  # Print index using `ZoteroIndex`
  if (any(nrow(example$items))) {
    ZoteroIndex(example$items) |>
      dplyr::select(name) |>
      print(width = 80)
  }


[Package c2z version 0.2.0 Index]