Import BibReferences

Import Bibliography using the OpenDataBio R package
#your connection
library(opendatabio)
base_url="http://localhost/opendatabio/api"
token =YOUR TOKEN HEREcfg = odb_config(base_url=base_url, token = token)
odb_test(cfg)

#read the bibliographic references in R
library(rbibutils)
bibs = readBib(file="yourFileWithReferences.bib")
formatbib <- function(x) {
  con <- textConnection("bibref", "w")
  writeBib(x,con=con)
  bibref = paste(bibref,collapse = " ")
  close(con)
  return(bibref)
}

#prepare to import to odb
bibtexts = sapply(bibs,formatbib)
data = data.frame(bibtex=bibtexts,standardize=1,stringsAsFactors = F)

#importa
jobid = odb_import_bibreferences(data,odb_cfg = cfg)
#waiting for completion
odb_get_jobs(params=list(id=jobid$id),odb_cfg = cfg)
#get the import log
dt = odb_get_affected_ids(job_id=jobid$id,odb_cfg = cfg)