Visit https://kladr-api.ru for more info.
- JDK 1.7
- KLADR API token. You can get it for free here
kladrapi-client is distributed using jitpack.io, thus it is necessary to add jitpack repository to your pom.xml or setting.xml file.
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
<dependencies>
<dependency>
<groupId>com.github.mvpotter</groupId>
<artifactId>kladrapi-client</artifactId>
<version>${kladrapi-client.version}</version>
</dependency>
</dependencies>
Javadoc can be found here.
import com.mvpotter.kladrapi.KladrApiClient;
// If you have free access plan you have to use appropriate URL:
final KladrApiClient freeApiClient = new KladrApiClient(KladrApiClient.FREE_URL, "{ your API token }");
// The short form of the client above
final KladrApiClient anotherFreeApiClient = new KladrApiClient("{ your API token }");
// If you have paid plan, URL is different and client should be created the following way
final KladrApiClient paidApiClient = new KladrApiClient(KladrApiClient.PAID_URL, "{ your API token }");
import com.mvpotter.kladrapi.response.Response;
final Response response = client.search(request);
Every API request object implements com.mvpotter.kladrapi.request.Request
interface,
which have single method Map<String, String> toMap()
that returns all request specific parameters as a map.
Thus, if the client does not have request type for your specific needs you can always implement it yourself.
Of course, contributions are always welcome.
new BuildingRequest("{ street id }", "10");
new CityRequest("Мос");
new DistrinctRequest("Ступинск");
new OneStringRequest("Ленин");
new RegionRequest("Московск");
new StreetRequest("{ cityId }", "Ленин")
new ZipRequest("119027")
new RequestWithTypeCode(new CityRequest("Бутынь"), TypeCode.VILLAGE)
new RequestWithParent(new CityRequest("Бутынь"))
new RequestWithLimit(new CityRequest("Моск"), { limit }, [{ offset }])
new RequestWithRegionId(new OneStringRequest("Моск"), { regionId })
new RequestWithDistrictId(new OneStringRequest("Моск"), { districtId })
new RequestWithCityId(new OneStringRequest("Ленина"), { cityId })