Giter VIP home page Giter VIP logo

msa-world-factbook's Introduction

msa-world-factbook

Semi structured API for the CIA World Factbook, a reference of information for 267 countries.

Built with the factbook ruby gem.

Quick start

Execute the microservice container with the following command :

docker run -ti -p 9904:80 msagency/msa-world-factbook

Example(s)

To get the list of countries :

$ curl http://localhost:9904/factbook/codes
{
  "codes": [
    {
      "code": "af",
      "name": "Afghanistan",
      "category": "Countries",
      "region": "South Asia"
    },
    {
      "code": "al",
      "name": "Albania",
      "category": "Countries",
      "region": "Europe"
    },
    ...

To get the list of attributes :

$ curl http://localhost:9904/factbook/attributes
{
  "background": "Background",
  "location": "Location",
  "coords": "Geographic coordinates",
  "map": "Map references",
  "area": "Area › total",
  "area-land": "Area › land",
  "area-water": "Area › water",
  "area-note": "Area › note",
   ...

All the data is in text format, but the app will try to extract the numbers from the text for convenience :

$ curl http://localhost:9904/factbook/br/area
{
  "country-code": "br",
  "country-name": "Brazil",
  "area": {
    "text": "8,515,770 sq km",
    "numbers": [
      8515770.0
    ]
  }

$ curl http://localhost:9904/factbook/us/area
{
  "country-code": "us",
  "country-name": "United States",
  "area": {
    "text": "9,833,517 sq km",
    "numbers": [
      9833517.0
    ]
  }

Without a specific attribute, a summary of all the data for this country will be returned :

$ curl http://localhost:9904/factbook/br
{
  "country-code": "br",
  "country-name": "Brazil",
  "data": {
    "Introduction": {
      "Background": {
        "text": "Following more than three centuries under Portuguese rule, Brazil gained its independence in ..."
      }
    },
    "Geography": {
      "Location": {
        "text": "Eastern South America, bordering the Atlantic Ocean"
      },
      "Geographic coordinates": {
        "text": "10 00 S, 55 00 W"
      },
      "Map references": {
        "text": "South America"
      },
      ...

Endpoints

Standard endpoints

About

A project by the Microservices Agency.

msa-world-factbook's People

Contributors

msagency avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.