Skip to content

Commit

Permalink
Match Europeanas 0.10 API new Endpoint
Browse files Browse the repository at this point in the history
Also added "timespan" as a new option
  • Loading branch information
DiegoPino authored Aug 4, 2022
1 parent 080bdb8 commit 0bf7e78
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/Controller/AuthAutocompleteController.php
Original file line number Diff line number Diff line change
Expand Up @@ -682,6 +682,7 @@ protected function europeana($input, $vocab, string $apikey) {
'agent',
'concept',
'place',
'timespan',
])) {
// Drop before trying to hit non existing vocab
$this->messenger()->addError(
Expand All @@ -702,7 +703,7 @@ protected function europeana($input, $vocab, string $apikey) {

$urlindex = "/suggest?text=" . $input . "&type=" . $vocab ."&wskey=". $apikey ;

$baseurl = 'https://www.europeana.eu/api/entities';
$baseurl = 'https://api.europeana.eu/entity';
$remoteUrl = $baseurl . $urlindex;
$options['headers'] = ['Accept' => 'application/ld+json'];
$body = $this->getRemoteJsonData($remoteUrl, $options);
Expand All @@ -720,8 +721,8 @@ protected function europeana($input, $vocab, string $apikey) {
}
],
"total": 10,
"type": "BasicContainer",
"contains": [
"type": "ResultPage",
"items": [
{
"type": "Agent"
"id": "http://data.europeana.eu/agent/base/147466",
Expand All @@ -735,7 +736,7 @@ protected function europeana($input, $vocab, string $apikey) {
]
}
*/
// @NOTE!: This is API V 0.5 Already ill documented and its changing. So review the API every 2-3 months
// @NOTE: This is Entities API is 0.10.3 (December 2021)and it might chang. So review the API every 6 months
if (isset($jsondata['total']) && $jsondata['total'] >= 1 && isset($jsondata['items']) && is_array($jsondata['items'])) {
foreach ($jsondata['items'] as $key => $result) {
$desc = NULL;
Expand Down

0 comments on commit 0bf7e78

Please sign in to comment.