Dev: SM: Postal Codes API

From AAT Wiki
Jump to navigation Jump to search


Using this tool you will be able to retrieve postal codes from most locations in SA

XML Call key here--&search=ILLOVO Amanzimtoti

Five Arguments are passed via the URL

KEY (string) You Unique key must always be passed to the server
search (String) You can Search for a town or suburb or both (as per the the exampl above) OR if type in the Postal code the system will return the Area's.
type (string) If you are looking for a POBOX code pass "box", if you require a Street code pass "street" ( leave blank to search for both).
fmt (string) Pass "XML" if you want your Results in XML format or use "JS" if you want your results in JSON format (default is XML format).
jscb (string) Callback function For JSON Requests. ( default is jscallback)

Results From XML Call

Below show is the XML data returned from the above search

<results type="search" status="OK">
  <match area="ILLOVO, AMANZIMTOTI" code="4150" type="box" /> 
  <match area="ILLOVO, JOHANNESBURG" code="2196" type="street" /> 
  <match area="ILLOVO BEACH, AMANZIMTOTI" code="4155" type="box" /> 
  <match area="ILLOVO EXT 1, JOHANNESBURG" code="2196" type="street" /> 
  <match area="ILLOVO GLEN, AMANZIMTOTI" code="4126" type="street" /> 
  <match area="ILLOVO UIT 1, JOHANNESBURG" code="2196" type="street" /> 
  <match area="MADWALENI, MID ILLOVO" code="3750" type="box" /> 
  <match area="MNINI, ILLOVO BEACH" code="4126" type="box" /> 

The XML is fairly self explanatory; here is a brief description of some the important tags

status ( results tag ) OK = All good, "Error" = There was A problem, "Authentication Failed"= API Not Authenticated for domain, "No Results"= no results
area Location Returned ( town, Suburb)
code Postal code
type This will show you weather the code is for a physical street address or a PO Box .