Hi, I have used the following API to implement the above (http://www.postalpincode.in/Api-Details). Hope this helps.
a!localVariables(
local!pinCode,
local!integrationResult,
local!isintegrationSuccess,
{
a!sectionLayout(
label: "Find the post offices by Pin Code",
contents: {
a!columnsLayout(
columns: {
a!columnLayout(
contents: {
a!textField(
label: "",
labelPosition: "ABOVE",
value: local!pinCode,
saveInto: { local!pinCode },
refreshAfter: "UNFOCUS",
validations: {}
)
}
),
a!columnLayout(
contents: {
a!buttonArrayLayout(
buttons: {
a!buttonWidget(
label: "SEARCH",
style: "NORMAL",
saveInto: {
a!save(
local!integrationResult,
rule!JPS_INT_getDetailsByPostCode(pinCode: local!pinCode)
),
a!save(
local!isintegrationSuccess,
and(
toboolean(
index(local!integrationResult, "success", null)
) = true(),
tointeger(
index(
local!integrationResult,
"statusCode",
null
)
) = 200
)
)
}
)
},
align: "START"
)
}
),
a!columnLayout(contents: {})
}
)
}
),
a!richTextDisplayField(
value: {
a!richTextItem(
text: local!integrationResult.result.message,
color: "NEGATIVE",
showWhen: local!isintegrationSuccess
),
a!richTextBulletedList(
items: local!integrationResult.result.body.PostOffice.Name,
showWhen: not(local!isintegrationSuccess)
)
},
showWhen: a!isNotNullOrEmpty(local!integrationResult)
)
}
)