Commit a485481d authored by Matija Obreza's avatar Matija Obreza

Update R client to talk to Genesys API servers

- https://api.genesys-pgr.org
- https://api.sandbox.genesys-pgr.org
parent 86290cb9
...@@ -21,25 +21,25 @@ ...@@ -21,25 +21,25 @@
#' Setup for Genesys Production #' Setup for Genesys Production
#' #'
#' Use the Genesys R Client with <https://www.genesys-pgr.org> requiring \code{\link{user_login}} #' Use the Genesys R Client with <https://api.genesys-pgr.org> requiring \code{\link{user_login}}
#' #'
#' @export #' @export
setup_production <- function() { setup_production <- function() {
setup(server = "https://www.genesys-pgr.org", client_id = "oHgJR.NjcdJAIB175gBDbuLEK3@www.genesys-pgr.org", client_secret = "public") setup(server = "https://api.genesys-pgr.org", client_id = "oHgJR.NjcdJAIB175gBDbuLEK3@www.genesys-pgr.org", client_secret = "public")
} }
#' Setup for Genesys Sandbox #' Setup for Genesys Sandbox
#' #'
#' Use the Genesys R Client with <https://sandbox.genesys-pgr.org> requiring \code{\link{user_login}} #' Use the Genesys R Client with <https://api.sandbox.genesys-pgr.org> requiring \code{\link{user_login}}
#' #'
#' @export #' @export
setup_sandbox <- function() { setup_sandbox <- function() {
setup(server = "https://sandbox.genesys-pgr.org", client_id = "cCS6e.BAn9u2WkhIwgxBLxOVqZ@sandbox.genesys-pgr.org", client_secret = NULL) setup(server = "https://api.sandbox.genesys-pgr.org", client_id = "cCS6e.BAn9u2WkhIwgxBLxOVqZ@sandbox.genesys-pgr.org", client_secret = NULL)
} }
#' Configure the Genesys environment #' Configure the Genesys environment
#' #'
#' @param server Server base URL (e.g. "https://www.genesys-pgr.org" or "https://sandbox.genesys-pgr.org") #' @param server Server base URL (e.g. "https://api.genesys-pgr.org" or "https://api.sandbox.genesys-pgr.org")
#' @param client_id OAuth client ID #' @param client_id OAuth client ID
#' @param client_secret OAuth client secret #' @param client_secret OAuth client secret
#' #'
......
...@@ -51,7 +51,7 @@ Accessing Genesys **without user interaction** requires that a client is registe ...@@ -51,7 +51,7 @@ Accessing Genesys **without user interaction** requires that a client is registe
```R ```R
# Setup # Setup
library('genesysr') library('genesysr')
genesysr::setup(server = "https://www.genesys-pgr.org", genesysr::setup(server = "https://api.genesys-pgr.org",
client_id = "someId.....@www.genesys-pgr.org", client_id = "someId.....@www.genesys-pgr.org",
client_secret = "your-private-secret") client_secret = "your-private-secret")
......
...@@ -16,6 +16,7 @@ Querying Genesys PGR ...@@ -16,6 +16,7 @@ Querying Genesys PGR
maintained *ex situ* in national, regional and international genebanks around the world. maintained *ex situ* in national, regional and international genebanks around the world.
**genesysr** uses the [Genesys API](https://www.genesys-pgr.org/doc/0/apis) to query Genesys data. **genesysr** uses the [Genesys API](https://www.genesys-pgr.org/doc/0/apis) to query Genesys data.
The API is accessible at https://api.genesys-pgr.org.
Accessing data with **genesysr** is similar to downloading data in CSV or Excel format and loading Accessing data with **genesysr** is similar to downloading data in CSV or Excel format and loading
it into R. it into R.
...@@ -28,7 +29,7 @@ The database is queried by providing a `filter` (see Filters below): ...@@ -28,7 +29,7 @@ The database is queried by providing a `filter` (see Filters below):
``` ```
## Setup: use Genesys Sandbox environment ## Setup: use Genesys Sandbox environment
# genesysr::setup_sandbox() # genesysr::setup_sandbox()
# genesysr::setup_production() # This is initialized by default when loading genesysr # genesysr::setup_production() # This is initialized by default when loading genesysr
# Open a browser: login to Genesys and authorize access # Open a browser: login to Genesys and authorize access
...@@ -44,7 +45,7 @@ itc <- fetch_accessions(list(institute.code = c('BEL084'))) ...@@ -44,7 +45,7 @@ itc <- fetch_accessions(list(institute.code = c('BEL084')))
some <- fetch_accessions(list(institute.code = c('BEL084','COL003'))) some <- fetch_accessions(list(institute.code = c('BEL084','COL003')))
``` ```
**genesysr** provides utility functions to create `filter` objects using [Multi-Crop Passport Descriptors (MCPD)](https://www.genesys-pgr.org/doc/0/basics#mcpd) definitions: **genesysr** provides utility functions to create `filter` objects using [Multi-Crop Passport Descriptors (MCPD)](https://www.genesys-pgr.org/documentation/basics) definitions:
``` ```
# Retrieve data by country of origin (MCPD) # Retrieve data by country of origin (MCPD)
...@@ -63,7 +64,7 @@ musa.flatten <- musa.flatten %>% map_df(bind_rows) ...@@ -63,7 +64,7 @@ musa.flatten <- musa.flatten %>% map_df(bind_rows)
# Filters # Filters
The records returned by Genesys match all filters provided (*AND* operation), while individual filters The records returned by Genesys match all filters provided (*AND* operation), while individual filters
allow for specifying multiple criteria (*OR* operation): allow for specifying multiple criteria (*OR* operation):
```r ```r
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment