====== Using the API on Wanesy Management Cockpit ====== ===== API documentation ===== The Wanesy Management Cockpit exposes an API for integration with your information system. \\ The following documentation describes all available API methods as well as the expected parameters and format for using them: [[https://wmc.wanesy.com/docs/index.html|API Web services documentation]] (online) To help you better understand how to interact with this API, we provide some code examples which consist of a series of Python scripts demonstrating various functionalities of Wanesy Management Cockpit. ===== Setting up your environment ===== ==== Dependencies ==== To install the dependencies needed to run the scripts, you can use the ''requirements.txt'' file. Make sure you have a Python environment configured and enabled before running the following command: \\ ''pip install-requirements.txt'' This command will use ''pip'' (the Python package manager) to install all the Python libraries listed in the ''requirements.txt'' file. \\ This ensures that all dependencies required to run the examples are correctly installed in your environment. If your python interpreter doesn't find your module to authenticate, add your module to the PYTHONPATH environment with the following command (replace YOUR_PATH by your real PATH): \\ ''export PYTHONPATH=$PYTHONPATH:YOUR_PATH/examples'' ==== Authentication ==== Before running the scripts, ensure you have valid credentials for authentication with the Wanesy Management Cockpit API. \\ For that, you need to configure the authentication information in the ''authentification.py'' or ''authentification_function.py'' files. ==== Run the scripts ==== Choose a file, enter your authentication information and run. \\ Sometimes you will need to enter others parameters like the customer ID, the group ID or the gateway EUI. ===== API usage examples ===== The following archive contains the set of Python scripts: {{ :wiki:wanesy_management_cockpit_api_examples.zip |}} \\ Each script provides examples of usage along with explanations of the functionality it covers. ==== Authenticating ==== The directory ''authentification/'' contains the following example scripts: * ''authentification.py'' for authenticating with the Wanesy Management Cockpit API using basic authentication * ''authentification_function.py'' for authenticating with the Wanesy Management Cockpit API and obtain authentication headers ==== Managing the customers ==== The directory ''customers/'' contains the following example scripts: * ''create_customer.py'' for creating a new customer * ''get_list_customers.py'' for listing customers * ''get_specific_customer.py'' for getting a specific customer ==== Managing the users ==== The directory ''users/'' contains the following example scripts: * ''create_user.py'' for creating a new user * ''get_list_users.py'' for listing users * ''get_specific_user.py'' for getting a specific user ==== Managing & monitoring the gateways ==== The directory ''gateways/'' contains the following example scripts: * ''create_gateway.py'' for creating a new gateway * ''get_connection_status_gateway.py'' for getting connection status of a gateway * ''get_health_data_gateway.py'' for getting health information of a gateway * ''get_list_gateway.py'' for listing gateways of a specific customer, without pagination * ''get_full_list_gateway.py'' for listing all gateways of a specific customer, with pagination loop ==== Managing the groups ==== The directory ''groups/'' contains the following example scripts: * ''create_group.py'' for creating a new group * ''get_specific_group.py'' for getting a specific group * ''put_gateway_in_specific_group.py'' for putting a gateway in a specific group * ''get_list_gateway_in_specific_group.py'' for listing all gateways of a specific group ==== Managing & monitoring the actions ==== The directory ''actions/'' contains the following example scripts: * ''get_actions_definitions.py'' for getting all actions definitions * ''gateways_actions.py'' for creating a new action for a gateway, getting its status and cancelling it * ''groups_actions.py'' for creating a new action for a group, getting its status and cancelling it