Python IA Schedule task

# importing the required libraries
import requests
import json
import base64
import uuid

# define parameters

username = '<username>'
password = '<password>'
url = "https://iawebapi.automatedvision.info:8081/Dispatcher/SchedulingService/Jobs"
identifier = uuid.uuid4().hex
message = 'Test in Progress with Python'

# create basic authentication
credentials = username + ":" + password
base64_credentials = base64.b64encode(credentials.encode("utf8"))
credential = base64_credentials.decode("utf8")

# Configure the Payload/Body (JSON)
payload = json.dumps({
  "Description": " Send message API ",
  "When": {
    "Immediate": True,
    "IsLocalTime": True,
    "UseWakeOnLAN": False
  },
  "What": [
    {
      "ID": " 0D05A348-4574-4CAB-82F9-A5D3251457FD ",
      "Type": 0,
      "Name": " Send Message API "
    }
  ],
  "Who": [
    {
      "ID": " 325282B6-2099-4FBB-B60B-38EC4F96E755 ",
      "Type": 0,
      "Name": " SB-IV-AM01 "
    },
        {
      "ID": " 4FF6C7C2-4D63-47F7-AE28-CE8BDA0BA36D ",
      "Type": 0,
      "Name": " SB-IV-AM02 "
    }
  ],
  "Parameters": [{
    "Identifier": identifier,
    "Type": 0,
    "TaskContainerGuid":" 0D05A348-4574-4CAB-82F9-A5D3251457FD ",
    "TaskContainerName":" Send Message API ",
    "JobGuid": "{00000000-0000-0000-0000-000000000000}",
    "JobName": "",
        "JobParameters": [{
            "Name":"Caption",
            "Type":0,
            "Description":"",
            "Value1":"This is a test",
            "Hint":"Please provide the necessary input",
            "Selection":""
            },
            {
            "Name":"Message",
            "Type":0,
            "Description":"",
            "Value1": message,
            "Value2":"",
            "Value3":"",
            "Hint":"Please provide the necessary input",
            "Selection":""
            }]
        }]    
})

# create the header
headers = {}
headers['Authorization'] = 'basic ' + credential
headers['Content-Type'] = 'application/json'

# Execute the webrequest to schedule the task
response = requests.request("POST", url, headers=headers, data=payload)

# Show the response. Not required but returns response during testing
print(response.text)