Skip to content

Params that can do single query vs. many #200

@sckott

Description

@sckott

Right now, there are some params that you can pass in many values to in a vector or list and internally we do a request for each value. However, for some params GBIF API allows setting the parameter > once, so e.g. can do http://api.gbif.org/v1/occurrence/search?datasetKey=50c9509d-22c7-4a22-a47d-8c48425ef4a7&datasetKey=7b5d6a48-f762-11e1-a439-00145eb45e9a

But that returns results all combined into one result set, so no way to separate out results based on input values. Though surely some use cases don't care about separating out results to match the input values.

One way to do it could be

  1. pass in values as a vector foo = c('a', 'b'), and we do separate request for each value, translating to a request to http://api.gbif.org/v1/occurrence/search?foo=a and a request to http://api.gbif.org/v1/occurrence/search?foo=b
  2. pass in values comma separated in a character string foo = 'a,b', and we do a single request for both values, translating to http://api.gbif.org/v1/occurrence/search?foo=a&foo=b

Right now the 1st works, and 2nd errors

occ_data(datasetKey="50c9509d-22c7-4a22-a47d-8c48425ef4a7,7b5d6a48-f762-11e1-a439-00145eb45e9a", limit=20)
#> Error: Invalid UUID string: 50c9509d-22c7-4a22-a47d-8c48425ef4a7,7b5d6a48-f762-11e1-a439-00145eb45e9a 

could implement 2nd option, i don't think that would break any code

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions