Skip to content

Building an API for Commonwealth member countries, filter results by all member countries, by region and by ISO3 Code as identified from iban

License

Notifications You must be signed in to change notification settings

lmakoti/commonwealth_member_countries

Repository files navigation

Building an API (fastAPI, Heroku & PostgreSQL)

Building an API for Commonwealth member countries, filter results by all member countries, by region and by ISO3 Code as identified from iban

Overview

Technology Stack Documentation

  1. Github: https://docs.github.com/en

  2. FastAPI: https://fastapi.tiangolo.com

  3. Heroku: https://devcenter.heroku.com/categories/reference

  4. PostgreSQL: https://www.postgresql.org/docs

Solution Architecture

  1. Create a project repository on GitHub and add: python gitignore and creative commons licence
  2. Create a Heroku app and link it to the project repo
  3. Create the database on Heroku and obtain the connection credentials
  4. Using any postgres client (DBeaver) connect to the database and import the member countries' data into a new table
  5. Create the fastAPI code to build the API.

Using the api

Base URL: https://fastapi-heroku-postgres-cw.herokuapp.com/

Endpoints:

  • /countries - returns all member countries
  • /iso/[specify_iso3] - returns a single member country based ISO3 code, to see codes run:
curl -X GET "https://fastapi-heroku-postgres-cw.herokuapp.com/countries" -H "accept: application/json"

or go to https://fastapi-heroku-postgres-cw.herokuapp.com

  • /region/[specify_region] - returns all member countries in a region, region values are Africa, Americas, Asia, Europe or Pacific

Credit

Much appreciation and credit goes to Tse'po Melvin Thoabala for pointing me in the right direction and Navule Pavan Kumar Rao @tutlinks for the amazing tutorial: https://www.tutlinks.com/fastapi-with-postgresql-crud-async/

Connect

Lets connect on LinkedIn: Lehlohonolo Makoti
Learn more: Portfolio
GitHub: https://github.com/lmakoti

About

Building an API for Commonwealth member countries, filter results by all member countries, by region and by ISO3 Code as identified from iban

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published