An open API service indexing awesome lists of open source software.

https://github.com/zeehio/mendeleyr

R Package that interfaces with Mendeley's API. Not official, not complete, not very supported (limited time). Patches welcome.
https://github.com/zeehio/mendeleyr

bibtex mendeley r

Last synced: 6 months ago
JSON representation

R Package that interfaces with Mendeley's API. Not official, not complete, not very supported (limited time). Patches welcome.

Awesome Lists containing this project

README

          

---
title: "mendeleyr"
author: "Sergio Oller"
date: "`r Sys.Date()`"
output: rmarkdown::github_document
---

mendeleyr provides a subset of the Mendeley API through R.

[![Build Status](https://travis-ci.org/zeehio/mendeleyr.svg?branch=master)](https://travis-ci.org/zeehio/mendeleyr)
[![codecov.io](https://codecov.io/github/zeehio/mendeleyr/coverage.svg?branch=master)](https://codecov.io/github/zeehio/mendeleyr)

## Browse source code

Checkout the code and browse it at
[http://github.com/zeehio/mendeleyr](http://github.com/zeehio/mendeleyr).

## How to install mendeleyr:

### Package installation

* To install the latest development version:

```
devtools::install_github("zeehio/mendeleyr")
```

## Quick start:

### Setup:

Mendeley's API is based on oAuth2. This means that `mendeleyr` should be registered
as an application in [http://dev.mendeley.com/myapps.html] and receive a `client_id`
and a `client_secret`. As `mendeleyr` is open source, the package can't provide
a secret so it is required that the `mendeleyr` user registers its own app.

This is a one-time step, and it is very easy. `mdl_conf_new()` provides detailed
instructions on how to do that:

```{r, error=TRUE}
library(mendeleyr)
mdl_conf_new()
```

Once you have registered you app, you will be able to save the mendeley parameters
to a file, by default it is saved as `.mendeley_conf.json` in the current directory.

```{r, eval=FALSE}
mdl_conf_save(client_id = "given-by-mendeley", client_secret = "given-by-mendeley",
where = ".mendeley_conf.json")
```

Mendeley knows now that you are using `mendeleyr`. The final step is to grant
`mendeleyr` access to your account. The first time you run this, you will need
to login to Mendeley through the browser. Afterwards a token will be saved
so you don't have to login every time.

```{r, eval = FALSE}
token <- mdl_token(".mendeley_conf.json")
```

### Using mendeleyr

#### Export mendeley folders to a bibtex file:

```{r, eval = FALSE}
all_my_folders <- mdl_folders(token)
mdl_to_bibtex(token, folder_name = "my_folder", bibfile = "my_folder.bib")
```

If the folder belongs to a group:

```{r, eval = FALSE}
mdl_to_bibtex(token, folder_name = "shared_folder", group_name = "my_group",
bibfile = "shared_folder.bib")
```

#### List all documents in a folder:

```{r, eval = FALSE}
my_docs <- mdl_documents(token, folder_name = "my_folder")
```

#### Download a file:

```{r, eval = FALSE}
my_docs <- mdl_documents(token, folder_name = "my_folder")
all_files <- mdl_files(token, document_id = my_docs$id[1])
mdl_download_file(token, all_files[1,])
```