Deprecated JS Library v2.0.1
JavaScript client
Code snippet
<link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/themes/smoothness/jquery-ui.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js" type="text/javascript"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js" type="text/javascript"></script>
<script src="https://common.mastersoftgroup.com/scripts/harmony-2.0.1.min.js" type="text/javascript"></script>
<script>
$(function() {
// Use the Production environment
Harmony.useEnv(Harmony.ENV_PRODUCTION);
Harmony.init(USERNAME, PASSWORD, Harmony.AUSTRALIA);
// Use the JSONP protocol
Harmony.useProtocol(Harmony.JSONP);
ADDRESS_ID.autocomplete({
// minimum number of entered characters before trying to search
minLength:3,
// miliseconds to wait before trying to search
delay:500,
source: function(request, response) {
// call find method to get a list of candidate.
Harmony.v2.find({ fullAddress : request.term, country: "au" },
Harmony.AUPAF,
function(data) {
var array = [];
if(data.status == Harmony.SUCCESS) {
array = $.map(data.payload, function(p) {
return {
label: p.fullAddress,
id: p.id
};
});
response(array);
}
});
},
focus: function(event, ui) {
// prevent autocomplete from updating the textbox
event.preventDefault();
// manually update the textbox
$(this).val(ui.item.label);
},
select: function(event, ui) {
// prevent autocomplete from updating the textbox
event.preventDefault();
// call retrieve method to get additional information of the address
Harmony.v2.retrieve({id: ui.item.id}, function(responseData) {
$(this).val(ui.item.label);
console.log(JSON.stringify(responseData));
});
}
});
});
</script>
Pre-requisites
Getting the client
Initialising the client
Setting the environment and protocol
Invoking service requests
JavaScript client API v2.0.1
Constants
Name
Type
Description
Methods[Back to top]
Name
Description
Since
Harmony.v2.find(address, sourceOfTruth, callback)[Back to top]
address
sourceOfTruth
callback
Harmony.v2.retrieve(address, callback)[Back to top]
address
callback
Harmony.reverseGeocode(address, sourceOfTruth, callback)[Back to top]
address
sourceOfTruth
callback
Harmony.init(username, password, locale)[Back to top]
username
password
locale
Harmony.useEnv(environment)[Back to top]
environment
Harmony.useProtocol(protocol)[Back to top]
protocol
Harmony.useFeatureOptions(featureOptions)[Back to top]
featureOptions
Harmony.Parse.address(address, callback)[Back to top]
address
callback
Harmony.International.reverseGeocode(address, callback)[Back to top]
address
callback
Harmony.International.getGeocode(address, callback)[Back to top]
address
callback
Harmony.Validate.email(emailAddress, sourceOfTruth, callback)[Back to top]
emailAddress
sourceOfTruth
callback
Harmony.Validate.phone(phone, callback)[Back to top]
phone
callback
Harmony.Company.abn(company, apiName, optionalConfig, guid, callback)[Back to top]
company
apiName
optionalConfig
guid
callback
Last updated