Added Code of Postgres and Api call