Instantly starting 16 imaging sessions using Web API

Imagine you have 16 TaskForce SATA and SAS ports switched to Source mode and source drives plugged into them. Now you can instantly launch 16 imaging sessions simply starting the script.

Python script utilizes /start-image API request and prints task keys of all launched imaging sessions.


import sys

if sys.version_info[0] < 3:
    raise Exception("Please use Python 3 to run this script")

import urllib.request

ports = ["SATA1", "SATA2", "SATA3", "SATA4", "SATA5", "SATA6", "SATA7", "SATA8", 
         "SAS1", "SAS2", "SAS3", "SAS4", "SAS5", "SAS6", "SAS7", "SAS8"]
tasks = []
errors = {}

for port in ports:
    try:
        res = urllib.request.urlopen("http://10.0.0.4/api/start-image?source=%s&targetFolder=//Vitaliy/Share" % (port))
        tasks.append(res.read().decode('utf-8'))
    except urllib.error.HTTPError as e:
        errors[port] = e.read()

print("IDs of started imaging tasks:")
print('\n'.join(tasks))

The script works in any operating system. To run, perform the following actions:

  1. Save the script into image16.py file.
  2. Replace 10.0.0.4 with IP address of your TaskForce 2.
  3. Replace //Vitaliy/Share with your shared network folder path.
  4. Execute the script in the console: python image16.py.

For more information about these and other commands, see API specification that we made available to public.

Back to Manual start page