This repository provides developer examples demonstrating how to integrate with AmpliFlow using APIs (Swagger definition here) and solutions. The examples are written in Python and cover common use cases such as interacting with the Custom List API and updating KPI measurements.
It includes an example of a simple data integration script that integrates with Wint to show an example of how to get financial data into KPI measurements in AmpliFlow.
Before you begin, ensure you have the following installed:
- Python 3.x
- pip package installer
- An AmpliFlow administrator account
- (Optional) A virtual environment tool like
venv
orconda
-
Clone the repository
git clone [email protected]:AmpliFlow/ampliflow-examples.git cd ampliflow-examples
-
Create a virtual environment (optional but recommended)
python -m venv venv source venv/bin/activate # On Windows, use `venv\Scripts\activate`
-
Install dependencies
pip install -r requirements.txt
-
Copy the example environment file
cp .env.example .env
-
Update the
.env
fileOpen the
.env
file in a text editor and replace the placeholders with your actual credentials:AF_BASE_URL='https://yourtenant.ampliflow.com' AF_API_KEY='your_ampliflow_api_key' WINT_USERNAME='your_username' WINT_PASSWORD='your_password_or_api_key'
- AF_BASE_URL: Replace
yourtenant
with your AmpliFlow tenant name. - AF_API_KEY: Generate an API key from your AmpliFlow account settings at
https://yourtenant.ampliflow.com/api-keys
. - WINT_USERNAME and WINT_PASSWORD: Credentials required for authentication if applicable.
- AF_BASE_URL: Replace
The repository includes example scripts demonstrating how to use different AmpliFlow APIs. Each property in the exec endpoints is accompanied by a detailed description in the Swagger documentation to assist with implementation.
The custom list API example shows how to interact with custom lists in AmpliFlow.
- Script:
custom_list_example.py
Running the Example
python custom_list_example.py
Features Demonstrated
- Authenticating with the AmpliFlow API using an API key
- Retrieving custom lists
- Adding items to a custom list
- Updating existing items in a custom list
- Error handling for API requests
This example demonstrates how to update KPI measurements using the AmpliFlow API.
- Script:
update_kpi_measurement.py
Running the Example
python update_kpi_measurement.py
Features Demonstrated
- Authenticating with the AmpliFlow API using an API key
- Submitting new KPI measurements
- Validating API responses
- Handling errors and exceptions
Contributions are welcome! If you'd like to contribute, please follow these steps:
- Fork the repository.
- Create a new branch for your feature or bugfix.
- Commit your changes with clear commit messages.
- Push your changes to your fork.
- Submit a pull request explaining your changes.
Please ensure your code adheres to the existing style and includes appropriate documentation and tests.