OpenControl API v1 Setup
This section is intended for users who want to demo the API capability or run one of the Mersive supplied Python applications, and assumes no familiarity with general purpose programming. If you are familiar with programming and have a preferred way of sending and receiving HTTP GET and POST commands, jump to the list of commands.
If you simply want to experiment with receiving and sending information via the API, Postman is a great tool that can help you develop an intuitive grasp of the capabilities and workflows of the OpenControl API. Enter the URL of your target Solstice Pod and click ‘GET’ to confirm connectivity with your target and see the results of every key:value set associated with that target.
How To
Setup
If you want to run complete scripts and are starting from scratch, follow the comprehensive instructions below.
The following steps assume the use of a Windows operating system and Python version 3.11. If you have a different operating system or are using a different version of Python, you need to modify the steps to suit your situation.
-
Download Python 3.11 from python.org/downloads/.
-
Install as close to the main drive as possible. The default location is likely
C:\Python311, which is perfect. -
Download get-pip from pip.pypa.io/en/stable/installation/ and move the file into the same folder as your new installation of Python 3.11.
-
Open the Windows Command Prompt (CMD).
-
Navigate to the Python directory. If you installed in the default location, type:
cd C:\Python311\ -
If you installed into a different folder, navigate through your file system using
cd [folder name]to enter a subfolder orcd ..to move up a level. The commanddirlists a directory of everything inside the current folder. -
After you’re in the Python folder, type
dirto verify that get-pip.py is in the folder. -
If so, type
python get-pip.pyand wait for pip to install. -
Next, install the requests package with the following command:
python -m pip install requests -
Wait for requests to finish installing. Information on this package is available at docs.python-requests.org/en/latest/.
After the requests package is installed, you can GET/POST individual messages to or from specific IP addresses directly from the Python terminal window (access by double-clicking the python.exe file), or you can write a Python script in an editor (such as Notepad++) and run the script from PowerShell or the Python terminal window.
Test Connectivity to a Solstice Pod
Now, test that you have network connectivity to a Solstice IP address (Pod or Software Instance) by pinging the IP address. If the IP address is http://192.168.3.127, the shell command is:
>>> ping 192.168.3.127
Wait for the ping to finish. The result should be 4 packets sent and 4 packets received.
Download and Run the Example GET Script
At this point, we recommend downloading and running the example GET script to see all the available options. Download the script from our GitHub repository hereand move it to a known location. You can double-click the file to run it immediately, or open it in an editor to modify the script.