Get Geo Location

Overview

Service Unique Name GetGeoLocation
Request Method GET

Description

This API provides the list of State & City of a country as available in the logixERP.

Request Body

These are form parameters:

  • countryCode : IN
  • stateCode : DEL

Request Details

Parameter Data Type Required/Optional Description
SecureKey int Required It is a Unique key for accessing the API. For secure key email to support team.
stateCode String Optional State code if mentioned should match with the code as available in the LogixERP. If ‘state’ value is not given then all the states along with cities will be returned.
countryCode String Required It should be two digits’ country code. Reference is given here. https://goo.gl/wgg9s.

Response Format

In a successful response state name, state code and their cities will be returned with name, code and cities(with comma separated) respectively (In JSON format).

ON SUCCESS
{
"message": "State available",
"messageType": "Success",
"states":
[
{
"cities": "Delhi",
"code": "DLI",
"name": "Delhi"
},
{
"cities": "Faridabad",
"code": "HRN",
"name": "Haryana"
}
]
}

ON ERROR
{
"message": "Error_Message",
"messageType" : "Error"
}

Error Message String

Error Messages Description

Sample Code

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;

import java.net.URL;

public class GetGeoLocation {

private static final String USER_AGENT = "Mozilla/5.0";
private static final String API_URL = "https://api.logixplatform.com/Rachna/webservice/v2/GetGeoLocation?secureKey=";
private static final int SECURE_KEY = SECURE KEY;
private static final String COUNTRYCODE = "US";
private static final String STATECODE = null;

private static final String ACCESS_URL = API_URL+SECURE_KEY+"&countryCode="+COUNTRYCODE+"&stateCode="+STATECODE;

public static void main(String[] args) throws IOException {

URL obj = new URL(ACCESS_URL);
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
con.setRequestProperty("User-Agent", USER_AGENT);
int responseCode = con.getResponseCode();
if (responseCode == HttpURLConnection.HTTP_OK) { // success
BufferedReader in = new BufferedReader(new InputStreamReader(
con.getInputStream()));
String inputLine;

StringBuffer response = new StringBuffer();

while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
// print result
System.out.println(response.toString());
} else {
System.out.println("GET request not worked");
}

}

}

import requests

access_url = "https://api.logixplatform.com/Rachna/webservice/v2/GetGeoLocation"
payload = {
'SecureKey':'secure_key',
'countryCode':'US',
'stateCode':None
}

try:
r = requests.get(access_url, params=payload)
print (r.text)
except requests.exceptions.RequestException as err:
print (err)
please wait...