A C++ application that fetches data from the Congress API using HTTPS.
https://pedro-vicente.net:9445/
This project requires CMake, a C++ compiler, OpenSSL, and the ASIO library.
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
brew install cmake openssl asio
export OPENSSL_ROOT_DIR=$(brew --prefix openssl)
export PKG_CONFIG_PATH=$(brew --prefix openssl)/lib/pkgconfig:$PKG_CONFIG_PATHsudo apt install build-essential cmake libssl-dev libasio-dev- Install CMake from https://cmake.org/download/
- Download OpenSSL pre-compiled binaries from https://slproweb.com/products/Win32OpenSSL.html 3 Set environment variable:
set OPENSSL_ROOT_DIR=C:\OpenSSL-Win64On a bash shell (on Windows, Git bash shell), run
chmod a+x build.cmake.sh
build.cmake.sh- Create a
key.txtfile in the project root with your Congress API key. Obtain key from
https://gpo.congress.gov/sign-up/
Edit file config.json with the API key
{
"API_KEY": "MY_API_KEY",
"RESPONSE_FORMAT": "json",
"LIMIT": "2"
}
- Run the application:
./congress The application will fetch member data and save it to member.json.
An HTTP GET request with the following format is made
GET /v3/member?api_key=API_KEY&limit=1 HTTP/1.1
Host: api.congress.gov
Accept: */*
Connection: close{
"members": [
{
"bioguideId": "Y000064",
"depiction": {
"attribution": "Image courtesy of the Member",
"imageUrl": "https://www.congress.gov/img/member/y000064_200.jpg"
},
"name": "Young, Todd",
"partyName": "Republican",
"state": "Indiana",
"terms": {
"item": [
{
"chamber": "House of Representatives",
"endYear": 2017,
"startYear": 2011
},
{
"chamber": "Senate",
"startYear": 2017
}
]
},
"updateDate": "2025-09-20T10:30:32Z",
"url": "https://api.congress.gov/v3/member/Y000064?format=json"
}
],
"pagination": {
"count": 2598,
"next": "https://api.congress.gov/v3/member?offset=1&limit=1&format=json"
},
"request": {
"contentType": "application/json",
"format": "json"
}
}
The web interface display retrieved data on a web browser. It uses the Wt framework
Wt is a C++ library for developing web applications.
Build dependencies Boost and Wt on a bash shell (Linux, Mac, Windows) with
./build.boost.sh
./build.wt.sh ./build.cmake.sh On a bash shell
./build/congress/web --http-address=0.0.0.0 --http-port=8080 --docroot=.Access the web interface at http://localhost:8080
