Handle REST API for sync gateway DBs.