Best Practices for Migrating to LogicMonitor v3 SDK
Last updated on 07 October, 2024In this article we have provided best practices and guidelines to migrate from LogicMonitor v1 and v2 of Python SDK to the latest v3 SDK. New user can also refer this article to install LogicMonitor v3 SDK.
Prerequisite
You must have Python version 3.7 or above installed on your machine.
Identifying the Current SDK Version
To check the current version of SDK installed on your machine, in the command prompt run the following:
pip show logicmonitor-sdk
If you have v2, you will see the following result:
Note: The output may vary depending on the Python version installed on your machine.
Name: logicmonitor-sdk
Version: 2.0.163 (0 or 1 or 2.0.buildNumber)
Summary: LogicMonitor REST API
Home-page: https://github.com/logicmonitor/lm-sdk-python
Author: UNKNOWN
Author-email: UNKNOWN
License: UNKNOWN
Location: Path where the existing SDK is located in your machine.
Requires: six, python-dateutil, urllib3, certifi
Required-by:
If the SDK is not installed and you run the pip command, you will see the following result:
WARNING: Package(s) not found: logicmonitor_sdk
Uninstalling the Older SDK Version
If the SDK version is less than 3.0.172 (for example, 2.0.163), then uninstall the existing SDK. To do so, in the command prompt run the following:
pip uninstall logicmonitor_sdk
In the output you can see that the SDK has been uninstalled. After successfully uninstalling the older SDK version, the following message is displayed:
Successfully uninstalled logicmonitor-sdk-2.0.163
Installing LogicMonitor v3 SDK
If the SDK package is not present or if you have uninstalled the older SDK version, then install the v3 SDK package. To do so, in the command prompt run the following:
pip3 install "logicmonitor-sdk>=3.0"
Alternatively, you can also run the following:
pip3 install logicmonitor-sdk
In the output you can observe that the v3 SDK has been installed. After successfully installing v3 SDK, the following message is displayed:
Successfully installed logicmonitor-sdk-3.0.172
Alternate Command to Migrate to LogicMonitor v3 SDK
To automatically uninstall the older SDK version on your machine and then install the new v3 SDK, in the command prompt run the following:
pip3 install --upgrade "logicmonitor-sdk>=3.0"
Alternatively, you can also run the following:
pip3 install --upgrade logicmonitor-sdk
v3 SDK Samples
You can access v3 SDK samples here: https://www.logicmonitor.com/support-files/rest-api-developers-guide/sdks/docs/lm-sdkv3-docs.html
Note: You must verify the request and response models for every API from the Swagger UI (above link). You may observe that some model parameters have changed.