How to load and render a vtk file via visualizer API

Hi All,
I want to use the REST API of visualizer to load and render a certain vtk file in the data directory it’s connected to.

The following code returns 200 but there’s nothing happening in visualizer. Can you help?

mheaders = {
“Content-Type”: “application/json”
}

def load_file_into_pv():
url = “visURL”
payload = {
“method”: “openFile”,
“args”: {
“file”: “/tmp/pv/file.vtk”
}
}

response = requests.get(url, json=payload, headers=mheaders)

if response.status_code == 200:
    print("File loaded successfully!")
else:
    print("Failed to load file:", response.text)

def render_display():
render_url = “visURL”
payload = {“method”: “render”}
response = requests.get(render_url, json=payload, headers=mheaders)
if response.status_code == 200:
print(“Render triggered successfully!”)
else:
print(“Failed to trigger render:”, response.text)

Visualizer don’t have a REST API.

Is there another way that would achieve that?
i.e. load and render a file, and set certain options like color map as default?

Command line arguments when you start visualizer. Or change the client code to process some URL and make RPC call to the server.

Or change the server code to create a REST endpoint.