Remove Duplicated Rows in Rest API

It looks like “DISTINCT” isnt supported yet by DreamFactory.
Refer: Selecting Distinct Values

But we found a way on getting the unique values of an API response.

        window.df.apis.database.getRecords({
            table_name: "table"
        }, function (response) {
            var cityList = [];
            for (var index = 0; index < response.record.length; index++) {
                cityList = pushUniqueRecord(response.record[index], cityList);
            }

        }, function (response) {
                PGproxy.notification.alert(getErrorString(response), 'error', 'Error', 'OK');
        });



function pushUniqueRecord(data, cityList) {
    var found = false;
    for (var i = 0; i < cityList.length; i++) {
        if (cityList[i].City == data.City) {
            found = true;
            break
        }
    }
    if (!found) {
        cityList.push(data);
    }
    return cityList;
}

The pushUniqueRecord function will check if the cityList array has an object that has the same City element as to your response. If City is not found then that record will be push to the cityList array. If the response has same City element on the other record it will not push then. Then just use cityList.