Skip to content

Commit

Permalink
Merge pull request #143 from esmero/ISSUE-142
Browse files Browse the repository at this point in the history
ISSUE-142: Fixes Europeana API to version 0.10.3
  • Loading branch information
DiegoPino authored Aug 12, 2022
2 parents afc0d2b + f81d051 commit 6e345cf
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@ $settings['webform_strawberryfield.europeana_entity_apikey'] = 'thekey';

Save and clear caches.

In its current state the Europeana Entity API (Alpha 0.5) uses a static APIKEY (not the same as other APIs) and can be found at https://pro.europeana.eu/page/entity#suggest
In its current state the Europeana Entity API (Alpha 0.10.3) as of December 2021 uses a static APIKEY (not the same as other APIs) and can be requested at https://pro.europeana.eu/page/get-api

If using https://github.com/esmero/archipelago-deployment this is not needed and will be provided by the deployment.
If using https://github.com/esmero/archipelago-deployment this is not needed and a stub one be provided by the deployment.
Please read the Terms of Use: https://www.europeana.eu/en/rights/api-terms-of-use

## Help

Expand Down
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 6e345cf

Please sign in to comment.