Skip to content

Commit 57b5dfe

Browse files
author
fmielke
committed
GeoAutoCompletion (GAC) v2 API
The GeoAutoCompletion (GAC) v2 API replaces the deprecated Region auto completion API.
1 parent 96b2692 commit 57b5dfe

File tree

3 files changed

+44
-13
lines changed

3 files changed

+44
-13
lines changed

Immocaster/Immobilienscout/Rest.php

+18-6
Original file line numberDiff line numberDiff line change
@@ -444,16 +444,28 @@ private function _getAttachment($aArgs)
444444
}
445445

446446
/**
447-
* Abfrage der Geo-Informationen per Stadtname, oder
448-
* per Anfangsbuchstaben einer Region.
449-
*
447+
* Abfrage von Geo-Objekten anhand eines Inputs
448+
*
449+
* @param array $aArgs
450+
* @return mixed
451+
*/
452+
private function _getGeoAutocompletionSuggestion($aArgs)
453+
{
454+
$aRequired = array('i','country');
455+
$req = $this->doRequest('gis/v2.0/geoautocomplete/'.$aArgs['country'],$aArgs,$aRequired,__FUNCTION__);
456+
return parent::getContent($req);
457+
}
458+
459+
/**
460+
* Abfrage von Geo-Objekten anhand einer Geo-Entity-ID
461+
*
450462
* @param array $aArgs
451463
* @return mixed
452464
*/
453-
private function _getRegions($aArgs)
465+
private function _getGeoAutocompletionEntity($aArgs)
454466
{
455-
$aRequired = array('q');
456-
$req = $this->doRequest('search/v1.0/region',$aArgs,$aRequired,__FUNCTION__);
467+
$aRequired = array('id','country');
468+
$req = $this->doRequest('gis/v2.0/geoautocomplete/'.$aArgs['country'].'/entity/'.$aArgs['id'],$aArgs,$aRequired,__FUNCTION__);
457469
return parent::getContent($req);
458470
}
459471

README.txt

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Immocaster PHP SDK v1.1.82
1+
Immocaster PHP SDK v1.1.83
22
==========================
33
Author: Norman Braun (http://www.medienopfer98.de)
44
Copyright: Immobilien Scout GmbH
@@ -9,6 +9,9 @@ Das PHP SDK von ImmobilienScout24 steht unter der FreeBSD Lizenz zur Verfügung
99
History
1010
=======
1111

12+
SDK Version 1.1.83
13+
- The GeoAutoCompletion (GAC) v2 API ersetzt die als DEPRECATED markierte Region auto completion API. Migrationshilfe: https://api.immobilienscout24.de/our-apis/gis/migrate-regionautocompletionv1-to-geoautocompletionv2.html
14+
1215
SDK Version 1.1.82
1316
- Nutzen der mysqli, anstatt der veralteten mysql Funktionen. Powered by kalunari.
1417

index.php

+22-6
Original file line numberDiff line numberDiff line change
@@ -103,17 +103,33 @@
103103
<?php
104104

105105
/**
106-
* Regionen ermitteln.
106+
* Geodaten (Suggestion) ermitteln.
107+
*/
108+
echo '<h2>GIS - GeoAutoCompletion (GAC) v2 API Suggestion Ressource</h2><br>
109+
API Dokumentation: https://api.immobilienscout24.de/our-apis/gis/geoautocompletion-v2.html#suggestion';
110+
$aParameter = array('country'=>'DEU', // DEU or AUT
111+
'i'=>'Berlin', // input search query
112+
'l'=>'10', // optional, limit max. 50
113+
't'=>'ALL'); // optional, entity types
114+
$res = $oImmocaster->getGeoAutocompletionSuggestion($aParameter);
115+
echo '<div class="codebox"><textarea>'.$res.'</textarea></div>';
116+
117+
/**
118+
* Geodaten (Entity) ermitteln.
107119
*/
108-
echo '<h2>Regionen ermitteln</h2>';
109-
$aParameter = array('q'=>'Ber');
110-
$res = $oImmocaster->getRegions($aParameter);
120+
echo '<h2>GIS - GeoAutocCmpletion (GAC) v2 API Entity Ressource</h2><br>
121+
API Dokumentation: https://api.immobilienscout24.de/our-apis/gis/geoautocompletion-v2.html#entity';
122+
$aParameter = array('country'=>'DEU', // DEU or AUT
123+
'id'=>'1276003001', // The ID of the entity. You get IDs in the result of the suggestion resource.
124+
'g'=>'WGS84'); // optional, GeoCodingType: One of None, GeoId, Lambert, WGS84 (optional)
125+
$res = $oImmocaster->getGeoAutocompletionEntity($aParameter);
111126
echo '<div class="codebox"><textarea>'.$res.'</textarea></div>';
112127

113128
/**
114-
* Geodaten ermitteln.
129+
* Geodaten (Geohierarchy) ermitteln.
115130
*/
116-
echo '<h2>GIS - Geo Service</h2>';
131+
echo '<h2>GIS - Geohierarchy</h2><br>
132+
API Dokumentation: https://api.immobilienscout24.de/our-apis/gis/geohierarchy.html';
117133
$aParameter = array('country-id'=>276,'region-id'=>2,'list'=>true);
118134
$res = $oImmocaster->geoService($aParameter);
119135
echo '<div class="codebox"><textarea>'.$res.'</textarea></div>';

0 commit comments

Comments
 (0)