/** * Get list of address types * GET: /api/addresses/types.cfm * Returns: { OK: true, TYPES: [{ ID: 1, Label: "Billing" }, ...] } */ try { qTypes = queryExecute(" SELECT tt_AddressTypeID as ID, tt_AddressType as Label FROM tt_AddressTypes ORDER BY tt_AddressTypeID ", {}, { datasource: "payfrit" }); types = []; for (row in qTypes) { arrayAppend(types, { "ID": row.ID, "Label": row.Label }); } writeOutput(serializeJSON({ "OK": true, "TYPES": types })); } catch (any e) { writeOutput(serializeJSON({ "OK": false, "ERROR": "server_error", "MESSAGE": e.message })); }