SL Postal Codes API is HTTP-based, all API requests are made using HTTP GET method. HTTP response is in json format by default.

Contents
  1. Postal Code Lookup
  2. Reverse Postal Code Lookup
  3. Near Postal Areas

Postal Code Lookup

Request URL

http://apis.slpostal-codes.net78.net/search/postalcode?{query-parameters}

Example :

http://apis.slpostal-codes.net78.net/search/postalcode/area/kandy/format/xml/key/YOUR_API_KEY

or

http://apis.slpostal-codes.net78.net/search/postalcode?area=kandy&format=xml&key=YOUR_API_KEY

Supported Formats

json.jsonp,xml,html,php,csv,serialized

Query Parameters

Parameter Example Description
area area=kandy Required. The postal area that you may need to get the postal code
format format=xml Optional. Data format of the response. json is the default.
key key=YOUR_API_KEY Required. Your API key, this is our way to identify you and authorize your call.

Response (xml)

<xml>
    <area>Kandy</area>
    <postal_code>20000</postal_code>
    <district>KY</district>
    <latitude>7.2964</latitude>
    <longitude>80.635</longitude>
</xml> 

Reverse Postal Code Lookup

Request URL

http://apis.slpostal-codes.net78.net/search/area?{query-parameters}

Example :

http://apis.slpostal-codes.net78.net/search/area/postalcode/20000/format/xml/key/YOUR_API_KEY

or

http://apis.slpostal-codes.net78.net/search/area?postalcode=20000&format=xml&key=YOUR_API_KEY

Supported Formats

json.jsonp,xml,html,php,csv,serialized

Query Parameters

Parameter Example Description
postalcode postalcode=20000 Required. The postal code of the unknown postal area.
format format=xml Optional. Data format of the response. json is the default.
key key=YOUR_API_KEY Required. Your API key, this is our way to identify you and authorize your call.

Response (xml)

<xml>
    <area>Kandy</area>
    <postal_code>20000</postal_code>
    <district>KY</district>
    <latitude>7.2964</latitude>
    <longitude>80.635</longitude>
</xml>       

Near Postal Areas

Request URL

http://apis.slpostal-codes.net78.net/search/nearby?{query-parameters}

Example :

http://apis.slpostal-codes.net78.net/search/nearby/area/kandy/radius/20/limit/3/format/xml/key/YOUR_API_KEY

or

http://apis.slpostal-codes.net78.net/search/nearby?area=kandy&radius=20&limit=3&format=xml&key=YOUR_API_KEY

Supported Formats

json.jsonp,xml,html,php,csv,serialized

Query Parameters

Parameter Example Description
area area=kandy Required. Postal area for which you may need nearby places.
radius radius=20 Required. Defines the distance (in miles) within which to return place results.
limit limit=3 Optional. Number of place results you may need. Search for five results by default.
format format=xml Optional. Data format of the response. json is the default.
key key=YOUR_API_KEY Required. Your API key, this is our way to identify you and authorize your call.

Response (xml)

<xml>
    <item>
    <area>Kandy</area>
    <postal_code>20000</postal_code>
    <district>KY</district>
    <latitude>7.2964</latitude>
    <longitude>80.635</longitude>
    <distance>0.00</distance>
    </item>

    <item>
    <area>Katugastota</area>
    <postal_code>20800</postal_code>
    <district>KY</district>
    <latitude>7.3161</latitude>
    <longitude>80.6211</longitude>
    <distance>1.66</distance>
    </item>

    <item>
    <area>Udatalawinna</area>
    <postal_code>20802</postal_code>
    <district>KY</district>
    <latitude>7.3161</latitude>
    <longitude>80.6211</longitude>
    <distance>1.66</distance>
    </item>
</xml>