Last updated

Run a method

This page provides step-by-step instructions for running a method using the VENUS Web API. During method loading and execution, keep track of real-time data such as instrument state, method progress, device creation, and more. Go to Runtime notifications for more information.

Load a method

Loading a method requires the method's HSL file, a simulation flag, and a native window handle (HWND).

The filePath field requires the full path of the HSL file of the associated method. For example, C:\Methods\TestMethod.hsl is sufficient in making the request, but \Methods\TestMethod.hsl isn't.

The simulation field allows developers to trigger a simulation of the method associated with the filePath field. All devices associated with the method are also simulated.

The parentWindowHandle field requires the native window handler of the application’s window. Vector handles dialog windows through the native window handle (HWND) to ensure that the dialogs are brought to view correctly. If an incorrect HWND is passed into the parameter, the method is aborted during execution. If the provided HWND for the application is 0 (zero), the dialogs are displayed in the background.

If a device is created when loading a method, the SignalR API pushes an On Device Created notification, where its payload contains information for the device. When a load execution is complete, the SignalR API pushes a New Runtime Status notification, bearing a payload of either Initialized or Initialize Failed. The Web API provides a response query with a status code, header, and response body.

put/api/vector/v3/execution/load
curl 'https://{{your_venus_webapi_ip_address}}/api/vector/v3/execution/load' \
  --request PUT \
  --header 'Authorization: Bearer <token>' \
  --data '{
  "filePath": "string",
  "simulation": true,
  "parentWindowHandle": 0
}'
Response
Returns Hamilton.WebAPI.Common.CmdResult object.

Pass values to global variables

Global variables can be altered prior to a method run.

The endpoint used to pass a value to a variable only works in VENUS 6.2.1 or later.

Get Initialized instrument state

Loading a method sets the instrument state to Initialized. For more information on loading a method, go to Load a method.

put/api/vector/v3/execution/load
curl 'https://{{your_venus_webapi_ip_address}}/api/vector/v3/execution/load' \
  --request PUT \
  --header 'Authorization: Bearer <token>' \
  --data '{
  "filePath": "string",
  "simulation": true,
  "parentWindowHandle": 0
}'
Response
Returns Hamilton.WebAPI.Common.CmdResult object.

Pass value(s) to variable(s)

To pass a value to a global variable, the instrument must be in an Initialized state.

Only individual values are supported.

put/api/vector/v3/execution/input
curl 'https://{{your_venus_webapi_ip_address}}/api/vector/v3/execution/input' \
  --request PUT \
  --header 'Authorization: Bearer <token>' \
  --data '{
  "variableNames": [
    "string"
  ],
  "variableValues": []
}'
Response
Returns Hamilton.WebAPI.Common.CmdResult object.

After values are input to the desired variables, run the method. Go to Run a method for more information.


Execute method operations

This section describes the available operations for method execution: starting, pausing, resuming, and aborting a method. Each operation requires the instrument to be in a specific state before it can be performed.

Available operations

Start a method

To start a method, the instrument must be in an Initialized state.

post/api/vector/v3/execution/start
curl 'https://{{your_venus_webapi_ip_address}}/api/vector/v3/execution/start' \
  --request POST \
  --header 'Authorization: Bearer <token>'
Response
Returns Hamilton.WebAPI.Common.CmdResult object.

Pause a method

To pause a method, the instrument must be in a Running state.

post/api/vector/v3/execution/pause
curl 'https://{{your_venus_webapi_ip_address}}/api/vector/v3/execution/pause' \
  --request POST \
  --header 'Authorization: Bearer <token>'
Response
Returns Hamilton.WebAPI.Common.CmdResult object.

Resume a method

To resume a method, the instrument must be in a Paused state.

Never use the Resume endpoint to start a method.

post/api/vector/v3/execution/resume
curl 'https://{{your_venus_webapi_ip_address}}/api/vector/v3/execution/resume' \
  --request POST \
  --header 'Authorization: Bearer <token>'
Response
Returns Hamilton.WebAPI.Common.CmdResult object.

Abort a method

This option is available when the instrument is in a Running or Paused state.

post/api/vector/v3/execution/abort
curl 'https://{{your_venus_webapi_ip_address}}/api/vector/v3/execution/abort' \
  --request POST \
  --header 'Authorization: Bearer <token>'
Response
Returns Hamilton.WebAPI.Common.CmdResult object.

Unload a method

This option is available when the instrument is in an Aborted, Initialized, or Terminated state.

post/api/vector/v3/execution/unload-method
curl 'https://{{your_venus_webapi_ip_address}}/api/vector/v3/execution/unload-method' \
  --request POST \
  --header 'Authorization: Bearer <token>'
Response
Returns Hamilton.WebAPI.Common.CmdResult object.