symplpay is a small web app which demonstrates how to combine several highly-related REST API calls on server A into a single REST API call for server B. One reason for implementing such a pattern is to make API consumers' lives easier.
This software is distributed under the MIT License.
- Ubuntu 18.04, Ubuntu 20.04, or the latest-and-greatest release of Windows 10. While symplpay may work as-is on other Linux OSVs, all testing was performed against the latest HWE LTS versions of Ubuntu and also Windows 10
- 64-bit Python 3.6 or higher
- Python's
requests_oauthlib
3rd party package. Instructions are given below on installing this which is needed to handle the OAuth 2.0 protocol with the remote server - (Optional) Python's
gunicorn
3rd party package. Again, there are instructions below on installation which is only necessary to host the local REST API using HTTPS on Linux
- The "--ssl" flag doesn't work on Windows 10
- The logs page doesn't work without usage of the "--debug" flag. By-Design as availability of this functionality in production would be considered a security issue without appropriate authorization (not implemented by symplpay)
- Ubuntu 18.04/20.04 HWE LTS: open a Terminal and run
sudo apt install python3
. Verify successful installation by runningpython3 --version
-> the reported version needs to be >= 3.6. - Windows 10: download 64-bit Python 3.9 and install. Once complete, open a cmd.exe and run
python --version
to ensure the 3.x version of Python appears first in your %PATH%.
IMPORTANT NOTE: all remaining instructions assume you're running Linux. If not the case, simply substitute "python" for "python3", "pip" for "pip3", and "cmd.exe" for "Terminal" in any commands below.
From a Terminal:
pip3 install requests_oauthlib
- Run
python3 -c "import oauthlib"
to confirm the package was successfully installed -> no output and an exit code of 0 is expected.
From a Terminal:
- (Ubuntu)
sudo apt install openssl
. Probably unnecessary on most systems, but better safe than sorry;) pip3 install gunicorn
- Run
python3 -c "import gunicorn"
to confirm the package was successfully installed -> no output and an exit code of 0 is expected. - IMPORTANT NOTE: you must supply the "--ssl" parameter to the
python3 -m symplpay.server ...
command in the Server Initialization Instructions below to enable HTTPS. I.e., this does not happen automatically simply because you're on Linux
Open a new Terminal:
export PYTHONPATH=.
(only if you do not already have Python configured to look in the current directory for Python files)cd <where-you-dropped-this>/symplpay
- Run
python3 -m symplpay.server -h
to see what configurable server parameters are available... python3 -m symplpay.server --client_id <your ID> --client_secret <your secret> --debug
to start the server- Open http://localhost:8080 (or https://localhost:8080 if you supplied the "--ssl" flag) in your favorite web browser
- Use curl, Postman, etc. to invoke the server's single API, http(s)://localhost:8080/compositeUsers/:userId