Hi,
I’m really new to this whole topic. Never worked with cURL before. So please be patient.
This is my actual code:
$data = array(
'creator' => 'username',
'notificationAddresses' => ["myown@email.com"],
'sendNotification' => true,
'format' => 'SIMPLE_CSV',
'predicate' => array(
'type' => 'and',
'predicates' => array(
array(
'type' => 'equals',
'key' => 'TAXON_KEY',
'value' => '5219683'
),
array(
'type' => 'equals',
'key' => 'HAS_COORDINATE',
'value'=> true
)
)
)
);
$data_string = json_encode($data);
$ch = curl_init('https://api.gbif.org/v1/occurrence/download/request/');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_USERPWD, 'username:password');
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json'
)
);
$result = curl_exec($ch);
var_dump($result);
curl_close($ch);
This is my JSON:
{"creator":"username","notificationAddresses":["my@email.com"],"sendNotification":true,"format":"SIMPLE_CSV","predicate":{"type":"and","predicates":[{"type":"equals","key":"TAXON_KEY","value":"5219683"},{"type":"equals","key":"HAS_COORDINATE","value":true}]}}
But nothing happens. So appenrently I’m doing something wrong here.
Please point me in the right direction.
Thanks.