MSA Scanner Geocoding API ile adresleri koordinata, koordinatları da adrese çevirebilirsiniz. Aşağıda JS API, PHP API, endpoint örnekleri ve API key başvuru bağlantıları yer almaktadır.
MSA Scanner API kullanabilmek için önce bir API key almanız gerekir. Başvurunuz onaylandıktan sonra size özel bir anahtar ile aşağıdaki endpoint’leri kullanabilirsiniz.
Bir şehir, adres veya konum bilgisini koordinata çevirmek için kullanılır.
key : API anahtarınızq : Arama sorgusuGET /api/geocode.php?key=YOUR_API_KEY&q=Istanbul
{
"success": true,
"endpoint": "geocode",
"provider": "msascanner-geocoder",
"query": "Istanbul",
"count": 2,
"total_results": 2,
"results": [
{
"formatted": "Istanbul, Turkey",
"lat": 41.006381,
"lng": 28.9758715,
"country": "Turkey",
"country_code": "tr",
"state": "Istanbul",
"city": "Istanbul",
"postcode": "34122",
"confidence": 3
}
]
}
Latitude ve longitude bilgisine göre adres veya konum detayı döndürür.
key : API anahtarınızlat : Enlemlon : BoylamGET /api/reverse.php?key=YOUR_API_KEY&lat=40.1828&lon=29.0673
{
"success": true,
"endpoint": "reverse",
"provider": "msascanner-geocoder",
"lat": "40.1828",
"lon": "29.0673",
"count": 1,
"total_results": 1,
"results": [
{
"formatted": "İnönü Caddesi, 16010 Osmangazi, Turkey",
"lat": 40.1827361,
"lng": 29.0672803,
"country": "Turkey",
"country_code": "tr",
"state": "Bursa",
"city": "Osmangazi",
"district": "Hocaalizade Mahallesi",
"suburb": "Kayıhan",
"road": "İnönü Caddesi",
"postcode": "16010",
"confidence": 9
}
]
}
fetch("https://msascanner.com/api/geocode.php?key=YOUR_API_KEY&q=Istanbul")
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error(error));
fetch("https://msascanner.com/api/reverse.php?key=YOUR_API_KEY&lat=40.1828&lon=29.0673")
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error(error));
Ayrı sayfa: documentation-of-js-api.php
<?php
$url = "https://msascanner.com/api/geocode.php?key=YOUR_API_KEY&q=" . urlencode("Istanbul");
$response = file_get_contents($url);
$data = json_decode($response, true);
print_r($data);
?>
<?php $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "https://msascanner.com/api/reverse.php?key=YOUR_API_KEY&lat=40.1828&lon=29.0673"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $result = curl_exec($ch); curl_close($ch); echo $result; ?>
Ayrı sayfa: documentation-of-php-api.php
| HTTP Kod | Anlamı |
|---|---|
| 400 | Eksik veya hatalı parametre |
| 403 | Geçersiz API key |
| 429 | Günlük kullanım limiti aşıldı |
| 500 | Sunucu hatası |
| 502 | Geocoding sağlayıcı hatası |