Geocoding API: Geocode Service JSON POST Request & Response - geo_addressing_sdk - 5.0

Geo Addressing SDK Developer Guide

Product type
Software
Portfolio
Locate
Product family
Geo Addressing
Product
Geo Addressing SDK
Version
5.0
Language
English
Product name
Geo Addressing SDK
Title
Geo Addressing SDK Developer Guide
Copyright
2023
First publish date
2007
Last updated
2025-01-05
Published on
2025-01-15T17:06:35.074000

JSON POST Request

Using the Geocoding API, the following is an example of a JSON POST request for the Geocode Service. In this example, the address point interpolation feature is enabled in customPreferences.


POST http://myserver:8080/Geocode/rest/GeocodeService/geocode.json HTTP/1.1
{
   "type": "ADDRESS",
   "preferences": {
      "returnAllCandidateInfo": null,
      "fallbackToGeographic": null,
      "fallbackToPostal": null,
      "maxReturnedCandidates": null,
      "distance": null,
      "streetOffset": null,
      "cornerOffset": null,
      "matchMode": null,
      "clientLocale": null,
      "clientCoordSysName": null,
      "distanceUnits": null,
      "streetOffsetUnits": null,
      "cornerOffsetUnits": null,
      "mustMatchFields": {
         "matchOnAddressNumber": false,
         "matchOnPostCode1": false,
         "matchOnPostCode2": false,
         "matchOnAreaName1": false,
         "matchOnAreaName2": false,
         "matchOnAreaName3": false,
         "matchOnAreaName4": false,
         "matchOnAllStreetFields": false,
         "matchOnStreetName": false,
         "matchOnStreetType": false,
         "matchOnStreetDirectional": false,
         "matchOnPlaceName": false,
         "matchOnInputFields": false
      },
      "returnFieldsDescriptor": null,
      "customPreferences": {
         "USE_ADDRESS_POINT_INTERPOLATION": "true"
      },
      "preferredDictionaryOrders": null
   },
   "addresses": [
      {
         "mainAddressLine": "21 Byng Ave, toronto ON M9W 2M5",
         "addressLastLine": null,
         "placeName": null,
         "areaName1": null,
         "areaName2": null,
         "areaName3": null,
         "areaName4": null,
         "postCode1": null,
         "postCode2": null,
         "country": "CAN",
         "addressNumber": null,
         "streetName": null,
         "unitType": null,
         "unitValue": null,
         "customFields": null
      }
   ]
}         

POST http://myserver:8080/rest/GlobalGeocode/geocode.json HTTP/1.1
{
   "type": "ADDRESS",
   "preferences": {
      "returnAllCandidateInfo": null,
      "fallbackToGeographic": null,
      "fallbackToPostal": null,
      "maxReturnedCandidates": null,
      "distance": null,
      "streetOffset": null,
      "cornerOffset": null,
      "matchMode": null,
      "clientLocale": null,
      "clientCoordSysName": null,
      "distanceUnits": null,
      "streetOffsetUnits": null,
      "cornerOffsetUnits": null,
      "mustMatchFields": {
         "matchOnAddressNumber": false,
         "matchOnPostCode1": false,
         "matchOnPostCode2": false,
         "matchOnAreaName1": false,
         "matchOnAreaName2": false,
         "matchOnAreaName3": false,
         "matchOnAreaName4": false,
         "matchOnAllStreetFields": false,
         "matchOnStreetName": false,
         "matchOnStreetType": false,
         "matchOnStreetDirectional": false,
         "matchOnPlaceName": false,
         "matchOnInputFields": false
      },
      "returnFieldsDescriptor": null,
      "customPreferences": {
         "USE_ADDRESS_POINT_INTERPOLATION": "true"
      },
      "preferredDictionaryOrders": null
   },
   "addresses": [
      {
         "mainAddressLine": "21 Byng Ave, toronto ON M9W 2M5",
         "addressLastLine": null,
         "placeName": null,
         "areaName1": null,
         "areaName2": null,
         "areaName3": null,
         "areaName4": null,
         "postCode1": null,
         "postCode2": null,
         "country": "CAN",
         "addressNumber": null,
         "streetName": null,
         "unitType": null,
         "unitValue": null,
         "customFields": null
      }
   ]
}         

The following shows the JSON response returned by the previous request.

{
   "responses": [
      {
         "totalPossibleCandidates": 1,
         "totalMatches": 1,
         "candidates": [
            {
               "precisionLevel": 16,
               "formattedStreetAddress": "21 BYNG AVE",
               "formattedLocationAddress": "TORONTO ON M9W 2M5",
               "identifier": "29566199",
               "precisionCode": "S8HPNTSCZA",
               "sourceDictionary": "1",
               "matching": null,
               "geometry": {
                  "type": "Point",
                  "coordinates": [
                     -79.54916,
                     43.72659
                  ],
                  "crs": {
                     "type": "name",
                     "properties": {
                        "name": "epsg:4326"
                     }
                  }
               },
               "address": {
                  "mainAddressLine": "21 BYNG AVE",
                  "addressLastLine": "TORONTO ON M9W 2M5",
                  "placeName": "",
                  "areaName1": "ON",
                  "areaName2": "TORONTO",
                  "areaName3": "TORONTO",
                  "areaName4": "",
                  "postCode1": "M9W",
                  "postCode2": "2M5",
                  "country": "CAN",
                  "addressNumber": "21",
                  "streetName": "BYNG",
                  "unitType": null,
                  "unitValue": null,
                  "customFields": {}
               },
               "ranges": [
                  {
                     "placeName": null,
                     "lowHouse": "21",
                     "highHouse": "21",
                     "side": "LEFT",
                     "oddEvenIndicator": "ODD",
                     "units": [],
                     "customValues": {
                        "AREA_NAME_1": "ON",
                        "POST_CODE_1": "M9W",
                        "POST_CODE_2": "2M5",
                        "AREA_NAME_3": "ETOBICOKE"
                     }
                  }
               ]
            }
         ]
}