api.py: incorporates db.update() in api.sync()