finished database api