Example: JSON POST Request & Response

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"
                     }
                  }
               ]
            }
         ]
}