Getting Started with the REST API
Requirements
- Java 8
- GGS distribution (ggs-dist-{version}.zip)
- Once unzipped, you'll need the GGS SDK CLI located in "{directory}/ggs-dist-{version}/cli"
- Dataset(s) in the Spectrum data format (*.spd)
- Server capable of deploying and running a .war file (i.e., Tomcat)
Placeholders
The following conventions are used as placeholders for some common items:- {directory} Any directory where you would like to install the resources for the SDK.
- {version} The version of the GGS SDK such as 3.0.0.
- {spd} Dataset in the Spectrum data format. For example, KGD082019.spd.
- {tomcat} - installed Tomcat location. For example, apache-tomcat-8.5.30.
Configure using the GGS CLI
- Create a location where datasets will be installed.
- Windows:
mkdir {directory}/data
- Linux:
mkdir
-p {directory}/data
- Windows:
- Run the GGS CLI. The command below starts the CLI in interactive mode. Note: The GGS CLI can be run in interactive or batch mode. [About the CLI Batch Process.]
- Windows:
cd
{directory}/ggs
-dist
-{version}/
cli
cli
.cmd
- Linux:
cd {directory}/ggs-dist-{version}/cli cli.sh
- Windows:
- Locate .spd file(s) and extract the dataset(s). [About the Extract
command.]
extract --s "{spd}" --d "{directory}/data"
- Configure data for the SDK, based on the dataset location, by running this command from
within the interactive CLI. [About the Configure
command.]
configure --s "{directory}/data" --d "{directory}/ggs-dist-{version}/resources/config"
Deploy REST API to Tomcat
Note: The
{tomcat}/webapps/Geocode
directory must be empty before
proceeding with this command. [About the Deploy
command.]deploy --c "/ggs-dist-{version}/resources" --m "WAR_EXTRACTED" --d "{tomcat}/webapps/Geocode" --l "{tomcat}/logs"
Start the Server
- From the tomcat directory
cd {tomcat}/bin
- Windows:
startup.bat
- Linux:
./startup.sh
- Windows:
Sample Application
As you explore the REST services, you may find it helpful to use the Global Geocoding API Sample. This is an interactive web application that demonstrates the geocoding API. The URL is relative to any context of the server, depending on where the war is deployed. URL: http://{server}:{port}/{:context}/sample/index.html
For example, to see typeahead functionality, click the Interactive Geocode tab in the sample application.
Note: Prior to using the sample application, if you haven't completed the steps above, you must
first install and configure your geocoding datasets using the GGS CLI.