Countries

The countries API provides an endpoint that allows you to fetch all the countries currently supported by Waza's API.

curl --request GET \
     --url https://api.waza.co/api/countries \
     --header 'waza-x-key: your-api-key' \
const https = require('https')

const options = {
  hostname: 'api.waza.co',
  port: 443,
  path: '/api/countries',
  method: 'GET',
  headers: {
    'x-waza-key': 'YOUR-API-KEY',
  }
}

const req = https.request(options, res => {
  let data = ''

  res.on('data', (chunk) => {
    data += chunk
  });

  res.on('end', () => {
    console.log(JSON.parse(data))
  })
}).on('error', error => {
  console.error(error)
})

req.end()

A successful Countries API call should return the countries we support as seen below:

{
    "status": "success",
    "message": "Countries fetched successfully.",
    "data": [
        {
            "id": 2,
            "code": "GHA",
            "name": "Ghana",
            "phoneCode": "+233",
            "rails": "DIRECT",
            "type": "SEND_RECEIVE"
        },
        {
            "id": 1,
            "code": "NGA",
            "name": "Nigeria",
            "phoneCode": "+234",
            "rails": "DIRECT",
            "type": "SEND_RECEIVE"
        }
    ]
}

πŸ“˜

Info

You can use the data from the countries API to fetch the routes associated to each country supported by Waza.


What’s Next

Learn how to use the data from the countries API to fetch the routes associated to each country.