[API-users] Downloads API predicate format

Bart Aelterman bart.aelterman at gmail.com
Tue Mar 28 15:14:11 CEST 2017


Thanks Peter,

Yes, I was authenticated. Thanks also for your (off the record) hint to pygbif.
<https://github.com/sckott/pygbif>
That makes a nice abstraction of the API and with that I'm able to request
a download from my python code:

from pygbif import occurrences

user = 'me'
email = 'me at myself.be'
pwd = 'pwd'

dataset_ids = [
    'key1',
    'key2'
]
queries = ['datasetKey = {}'.format(x) for x in dataset_ids]
results = occurrences.download(queries, user=user, pwd=pwd, email=email,
pred_type='or')

Regards,

Bart

2017-03-28 13:44 GMT+02:00 Peter Desmet <peter.desmet.work at gmail.com>:

> Hi Bart,
>
> Did you authenticate your request?
>
> Peter
>
> On 28 March 2017 at 13:25, Bart Aelterman <bart.aelterman at gmail.com>
> wrote:
> > Hi all,
> >
> > I am trying to create a downloads file using the GBIF Occurrence Download
> > API, but I'm not getting the expected result. I want to pass in a dataset
> > key from which I want all occurrences.
> >
> > The predicate I defined is this one:
> >
> > {
> >   "creator": "bartaelterman",
> >   "notification_address": ["bart.aelterman at gmail.com"],
> >   "predicate": {
> >     "value": "7d5a76b9-819f-4fb8-aab0-664d4089aa54",
> >     "key": "DATASET_KEY",
> >     "type": "equals"
> >   }
> > }
> >
> > I've also set the following headers:
> >
> > Content-Type:'application/json,
> > Accept: application/json
> >
> > Yet, I get a 500 response from the API. Am I doing something wrong in my
> > predicate definition?
> >
> > Thanks,
> >
> > Bart
> >
> >
> > _______________________________________________
> > API-users mailing list
> > API-users at lists.gbif.org
> > https://lists.gbif.org/mailman/listinfo/api-users
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.gbif.org/pipermail/api-users/attachments/20170328/ae2321cb/attachment.html>


More information about the API-users mailing list