A demo project showing how to use the pelias-client-library to call the Mapzen Pelias Search API
The below example shows how to call the Pelias Search API - this same code is in the PeliasClientDemo
class in this project:
String apiKey = "search-YOUR_KEY_HERE";
String text = "London";
SearchResponse response = new SearchRequest.Builder(apiKey, text).build().call();
System.out.println(response.toString());
You'll need JDK 7 or higher.
This project was created in IntelliJ. You can also compile it from the command line using Maven.
To get started with this project, use a Git client to clone this repository to your local computer. Then, in IntelliJ import the project as a Maven project.
Managed via Maven:
- Pelias Client Library - For calling the Mapzen Pelias Search API.
- IntelliJ - Clean and build the project
- Maven -
mvn install
Using the pelias-client-library library in your application
To add the pelias-client-library to your project using Maven, add the following to your pom.xml
file:
<dependencies>
<!-- Pelias Client Library -->
<dependency>
<groupId>edu.usf.cutr.pelias</groupId>
<artifactId>pelias-client-library</artifactId>
<version>1.0.0</version>
<type>pom</type>
</dependency>
</dependencies>
If you're using Gradle and Android Studio, here's what your build.gradle
should look like:
...
repositories {
jcenter()
}
android {
...
// http://stackoverflow.com/questions/20673625/gradle-0-7-0-duplicate-files-during-packaging-of-apk
packagingOptions {
exclude 'META-INF/LICENSE'
exclude 'META-INF/NOTICE'
exclude 'META-INF/services/com.fasterxml.jackson.core.JsonFactory'
exclude 'META-INF/services/com.fasterxml.jackson.core.ObjectCodec'
}
...
dependencies {
...
// Pelias Client library
compile 'edu.usf.cutr.pelias:pelias-client-library:1.0.0'
}