How to use OFBiz to lookup Postal Codes and Lat Long Data

Query templates

URL - https://dev-hc.hotwax.io/api/postcodeLookup

1. To get postal codes in a given range

Enter latitude, longitude in pt field (separated by comma) and distance in kilometer (d) to find postal codes of stores in that diameter

Method type - Get

Body -

{
  "json": {
    "query": "*:*",
    "filter": "{!geofilt sfield=location}",
    "params": {
      "pt": "18.180555,-66.749961",
      "d": "100"
    }
  }
}

2. To get latitude longitude of the postal code

Enter postal code to find latitude and longitude of the store

Method type - Get

Body -

{
  "json": {
    "query": "postcode:2635",
    "fields": [
      "latitude",
      "longitude"
    ]
  }
}

3. Find latitude and longitude from partial postal code (Gives multiple documents based on partial matches)

Enter partial postal code

Request Type - Get

Body -

{
  "json": {
    "query": "postcodelike:601",
    "fields": [
      "latitude",
      "longitude"
    ]
  }
}
1 Like