tap-restcountries is a Singer tap for the REST Countries API. It reads the v5
countries list and emits records in the v3.1 shape, so existing loads keep their columns.
Built with the Meltano Tap SDK for Singer Taps.
Install from GitHub:
uv tool install git+https://github.com/TicketSwap/tap-restcountries.git@main| Stream | Endpoint | Primary Key | Replication |
|---|---|---|---|
| countries | /countries/v5 (100 per page) |
cca3 |
Full table |
| Setting | Type | Required | Default | Description |
|---|---|---|---|---|
api_key |
string | Yes | REST Countries API key | |
fields |
array | No | (all) | v3.1 field names to emit, see Fields |
cca2, cca3, ccn3, cioc, fifa, independent, status, unMember, name, altSpellings,
translations, area, borders, capital, capitalInfo, continents, landlocked, latlng, maps,
region, subregion, timezones, population, languages, demonyms, currencies, tld, postalCode,
startOfWeek, car, gini, flag, flags.
v5 has no equivalent for the v3.1 idd and coatOfArms fields, and status carries the v5 values
(official, user_assigned).
This Singer tap will automatically import any environment variables within the working directory's
.env if the --config=ENV is provided, such that config values will be considered if a matching
environment variable is set either in the terminal context or in the .env file.
export TAP_RESTCOUNTRIES_API_KEY=your_api_key
export TAP_RESTCOUNTRIES_FIELDS='["name","cca2","capital"]'Every request needs an API key from restcountries.com, sent as a bearer
token. The free plan allows 1,000 requests a month; a full sync takes 3. The demo key rc_live_demo returns
one sample country and no quota.
You can easily run tap-restcountries by itself or in a pipeline using Meltano.
tap-restcountries --version
tap-restcountries --help
tap-restcountries --config CONFIG --discover > ./catalog.jsonFollow these instructions to contribute to this project.
Prerequisites:
- Python 3.11+
- uv
uv syncCreate tests within the tests subfolder and
then run:
TAP_RESTCOUNTRIES_API_KEY=your_api_key uv run pytestYou can also test the tap-restcountries CLI interface directly using uv run:
uv run tap-restcountries --helpTesting with Meltano
Note: This tap will work in any Singer environment and does not require Meltano. Examples here are for convenience and to streamline end-to-end orchestration scenarios.
Use Meltano to run an EL pipeline:
# Install meltano
uv tool install meltano
# Test invocation
meltano invoke tap-restcountries --version
# Run a test EL pipeline
meltano run tap-restcountries target-jsonlSee the dev guide for more instructions on how to use the SDK to develop your own taps and targets.