Integrating the database into the API