Using the Automation API Demo Project for Python

Important:

The Automation API demo project requires Python 3.6 (or later).

  1. On a system running Python 3.6 (or later), install the following modules:
    • pycryptodome

    • hashlib

    • PyJWT

  2. Download the Automation API demo project file from:

    http://docs.trendmicro.com/all/ent/tmcm/v7.0/en-us/api/Python3DemoScript.zip

  3. Decompress the Python3DemoScript.zip folder.
  4. In the extracted Python3DemoScript.py file, locate and specify the following settings:
    • use_url_base: The URL of the Control Manager server without the WebApp

      Example: https://192.168.121.223:443

    • use_application_id: The application ID generated by Control Manager

    • use_api_key: The API key generated by Control Manager

  5. Execute the demo script, which will access the Automation APIs and perform the following actions:
    • Attempt to get and print product agents with hostname="BENPFUOSCECLIEN"

      Note:

      You can change the hostname criteria directly in the Python script to specify any product agent.

    • Attempt to uninstall a product agent with entity_id="123456780114-694DBF9D-2018-0618-1930"

      Note:

      You can change the entity_id criteria directly in the Python script to specify any product agent.