README.md 1.49 KB
Newer Older
Matija Obreza's avatar
Matija Obreza committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
# Genesys R client

The `genesysr` R package provides functions for authentication with Genesys and functions to fetch accession data from <https://www.genesys-pgr.org> database.

## Installing the development version

```R
devtools::install_git('https://gitlab.croptrust.org/genesys-pgr/genesysr')
```

# Using `genesysr`

1.  Setup and configure
2.  Authenticate
3.  User authentication
4.  Client authentication
5.  Query

## Setup and configuration

```R
library('genesysr')

# www.genesys-pgr.org
genesysr::setup_production()

# or sandbox.genesys-pgr.org
genesysr::setup_sandbox()

# or custom
genesysr::setup(server = "http://localhost:8080",
  client_id = "...", client_secret = "...")
```

## User authentication

The package is configured with default **Genesys R client** credentials that require user authentication:

```R
# Setup
genesysr::setup_production()

# Open Genesys web page in browser and get verifier code
genesysr::user_login()
```

## Client authentication

Accessing Genesys **without user interaction** requires that a client is registered on Genesys with **client credentials** grant. Contact helpdesk@genesys-pgr.org for assistance.

```R
# Setup
library('genesysr')
54
genesysr::setup(server = "https://api.genesys-pgr.org",
Matija Obreza's avatar
Matija Obreza committed
55 56 57 58 59 60 61 62 63 64 65 66 67
  client_id = "someId.....@www.genesys-pgr.org",
  client_secret = "your-private-secret")

# Obtain access tokens
genesysr::client_login()
```

## Query Genesys

```R
filters <- mcpd_filter(ORIGCTY = c("DEU", "SVN"))
accessions <- genesysr::fetch_accessions(filters)
```