Squizee Tech Solutions || Geolocation API Documentation
Overview
Squizee Tech Solutions provides two key location-based APIs:
- Geolocation API: Retrieves geolocation details based on the user's IP address.
- Reverse Geolocation API: Retrieves address details based on geographic coordinates (latitude and longitude).
These APIs allow developers to easily integrate location-based functionality into their applications.
Live Test the Geolocation and Reverse Geolocation API
Test the Geolocation and Reverse Geolocation APIs live directly on this page. You can test your IP-based location or convert specific latitude and longitude coordinates to address information.
Geolocation Test (IP-Based)
Click the button below to get your current geolocation based on your IP address without user permission.
Reverse Geolocation Test (Latitude and Longitude)
Enter latitude and longitude below to get the corresponding location.
1. Geolocation API
Endpoint
- URL:
https://ipz.squizee.in/ - Method: GET
- Response Format: JSON
Description: The Geolocation API returns the geolocation information associated with the user's IP address. This includes the country, region, city, latitude, longitude, and timezone. Additional details such as user-agent, referrer, and client device type are also included to enrich the response.
Sample Request
GET https://ipz.squizee.in/
Sample Response
{
"ip": "113.21.75.141",
"requestMethod": "GET",
"userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36",
"referrer": "https://www.squizee.in/",
"preferredLanguage": "en-US",
"serverSoftware": "LiteSpeed",
"serverProtocol": "HTTP/1.1",
"serverName": "ipz.squizee.in",
"clientDevice": "Windows PC",
"browser": "Google Chrome",
"os": "Windows",
"clientLanguage": "en-US",
"clientPlugins": "*/*",
"remotePort": "3134",
"serverPort": "443",
"httpStatusCode": 200,
"provider": "WISH NET - Broadband ISP",
"country": "India",
"region": "West Bengal",
"city": "Kolkata",
"zipCode": "700001",
"latitude": 22.518,
"longitude": 88.3832,
"timezone": "Asia/Kolkata",
"offset": "+05:30",
"currentTimestamp": "2024-12-12 18:12:37",
"device": "Windows PC"
}
Response Fields:
- ip: IP address of the client.
- requestMethod: HTTP method used for the request.
- userAgent: The user's browser and operating system details.
- referrer: The referring URL that initiated the request.
- preferredLanguage: The client's preferred language.
- serverSoftware: The software running on the server (e.g., LiteSpeed).
- clientDevice: The client's device type (e.g., Windows PC).
- browser: The browser the client is using (e.g., Google Chrome).
- os: The operating system of the client (e.g., Windows).
- country: The country of the client.
- region: The region of the client.
- city: The city of the client.
- latitude: Latitude of the client's location.
- longitude: Longitude of the client's location.
- timezone: Timezone of the client.
- currentTimestamp: Timestamp of the geolocation request.
- device: The device used by the client.
3. Integration with Excel and Google Sheets
You can easily integrate the Geolocation and Reverse Geolocation APIs into your Excel or Google Sheets for seamless data retrieval.
Excel Integration (Using Power Query)
To use the Geolocation API in Excel, follow these steps:
- Open Excel and go to the Data tab.
- Select Get Data > From Other Sources > From Web.
- Enter the Geolocation API URL
https://ipz.squizee.in/and click OK. - The API response will be displayed in the Power Query editor. Click Close & Load to load it into your worksheet.
Excel Integration (Using VBA)
Alternatively, you can use VBA (Visual Basic for Applications) to make an API request in Excel and retrieve the geolocation data:
- Open Excel and press Alt + F11 to open the VBA editor.
- Click Insert > Module to create a new module.
- Paste the following code in the module:
- Save and run the macro. The JSON response from the API will be displayed in cell A1.
Sub GetGeolocationData()
Dim http As Object
Dim URL As String
Set http = CreateObject("MSXML2.XMLHTTP")
URL = "https://ipz.squizee.in/" ' Replace with your API URL
http.Open "GET", URL, False
http.Send
' Parse the JSON response
Dim response As String
response = http.responseText
' Output response to a cell
Sheets("Sheet1").Range("A1").Value = response
End Sub
Google Sheets Integration (Using Google Apps Script)
To use the Geolocation API in Google Sheets, follow these steps:
- Open your Google Sheet and go to Extensions > Apps Script.
- Replace the default code with the following to call the API:
- Save the script and run it. The results will be populated in the sheet.
function getGeolocationData() {
var url = "https://ipz.squizee.in/"; // Geolocation API URL
var response = UrlFetchApp.fetch(url);
var json = JSON.parse(response.getContentText());
// Output some fields to the sheet
var sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
sheet.getRange('A1').setValue(json.ip);
sheet.getRange('A2').setValue(json.country);
sheet.getRange('A3').setValue(json.city);
}
2. Reverse Geolocation API
Endpoint
- URL:
https://location.squizee.in/{lat},{lon} - Method: GET
- Response Format: JSON
Description: Retrieves address details based on the latitude and longitude values.
Sample Request
GET https://location.squizee.in/22.078218038874983,87.2878884615242
Sample Response
{
"address": "Keshiary, Paschim Medinipur, West Bengal, India",
"lat": "22.078218038874983",
"lon": "87.2878884615242"
}
Error Response (Invalid Coordinates)
{
"error": "Invalid latitude or longitude values.",
"lat": "not provided",
"lon": "not provided"
}
Integration Examples
JavaScript Example (Using Fetch)
function fetchGeolocation() {
fetch('https://ipz.squizee.in/')
.then(response => response.json())
.then(data => {
console.log('Geolocation Data:', data);
})
.catch(error => {
console.error('Error fetching geolocation:', error);
});
}
// Call the function to fetch geolocation data
fetchGeolocation();
Python Example (Using Requests)
import requests
def get_geolocation():
try:
response = requests.get('https://ipz.squizee.in/')
response.raise_for_status() # Will raise an exception for HTTP errors
data = response.json()
print('Geolocation Data:', data)
except requests.exceptions.RequestException as e:
print(f'Error fetching geolocation: {e}')
# Call the function to fetch geolocation data
get_geolocation()
cURL Example
# To fetch geolocation data via cURL:
curl -X GET https://ipz.squizee.in/ -H "Content-Type: application/json"
PHP Example (Using cURL)
< ?php
// PHP example using cURL to fetch geolocation data
function getGeolocation() {
$url = 'https://ipz.squizee.in/';
$ch = curl_init($url);
// Set cURL options
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json'
));
// Execute cURL request and get the response
$response = curl_exec($ch);
// Check for errors
if(curl_errno($ch)) {
echo 'Error: ' . curl_error($ch);
} else {
// Convert JSON response to an array
$data = json_decode($response, true);
echo 'Geolocation Data: ';
echo 'IP: ' . $data['ip'] . ' ';
echo 'Country: ' . $data['country'] . ' ';
echo 'City: ' . $data['city'] . ' ';
echo 'Latitude: ' . $data['latitude'] . ' ';
echo 'Longitude: ' . $data['longitude'] . ' ';
}
// Close cURL session
curl_close($ch);
}
// Call the function to fetch geolocation data
getGeolocation();
?>
4. Reverse Geolocation API Integration
In addition to the regular Geolocation API, you can integrate the **Reverse Geolocation API** to convert latitude and longitude into human-readable location data (such as address, city, country, etc.). Below are the steps for integrating the Reverse Geolocation API into Excel and Google Sheets.
Excel Integration (Using Power Query)
To use the **Reverse Geolocation API** in Excel, follow these steps:
- Open Excel and go to the Data tab.
- Select Get Data > From Other Sources > From Web.
- Enter the Reverse Geolocation API URL with your desired latitude and longitude values:
- For Reverse Geolocation:
https://location.squizee.in/{lat},{lon}replace {lat} and {lon} with actual latitude and longitude, e.g.,https://location.squizee.in/22.078218,87.287888
.
- For Reverse Geolocation:
- Click OK. The API response will be displayed in the Power Query editor. Click Close & Load to load it into your worksheet.
Excel Integration (Using VBA)
Alternatively, you can use VBA (Visual Basic for Applications) to call the **Reverse Geolocation API** in Excel and retrieve location data:
- Open Excel and press Alt + F11 to open the VBA editor.
- Click Insert > Module to create a new module.
- Paste the following code in the module:
- Save and run the macro. The JSON response from the **Reverse Geolocation API** will be displayed in cell A1 in your Excel sheet.
Sub GetReverseGeolocationData()
Dim http As Object
Dim URL As String
Set http = CreateObject("MSXML2.XMLHTTP")
' Replace lat and lon with actual values
URL = "https://location.squizee.in/22.078218,87.287888" ' Reverse Geolocation API URL
http.Open "GET", URL, False
http.Send
' Output response to a cell
Sheets("Sheet1").Range("A1").Value = http.responseText
End Sub
Google Sheets Integration (Using Google Apps Script)
To use the **Reverse Geolocation API** in Google Sheets, follow these steps:
- Open your Google Sheet and go to Extensions > Apps Script.
- Replace the default code with the following to call the **Reverse Geolocation API**:
- Save the script and run it. The **Reverse Geolocation API** results, such as the address, city, country, latitude, and longitude, will be populated in cells A1, A2, A3.
function getReverseGeolocationData() {
var lat = "22.078218038874983"; // Latitude for Reverse Geolocation
var lon = "87.2878884615242"; // Longitude for Reverse Geolocation
var url = "https://location.squizee.in/" + lat + "," + lon; // Reverse Geolocation API URL
var response = UrlFetchApp.fetch(url);
var json = JSON.parse(response.getContentText());
// Output address to the sheet
var sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
sheet.getRange('A1').setValue(json.address); // Set the full address
sheet.getRange('A2').setValue(json.lat); // Set the latitude
sheet.getRange('A3').setValue(json.lon); // Set the longitude
}
Contact Us
If you have any questions, please reach out to us at support@squizee.in.