OpenAPI documentation
API documentation allows developers to explore and test the API.
When setup is complete, go to http://{{your_venus_webapi_ip_address}} for the API documentation. Refer to Enable Swagger for OpenAPI documentation for setup instructions.
API documentation contains several categories, each with different endpoints and a schema section with response schemas for the API endpoints.
To access different versions of the Web API, choose the desired version from the drop-down at the top right of the page. The endpoints for the selected version are displayed.
This documentation provides information on V3, which is the latest release of the Web API.
Enable Swagger for OpenAPI documentation
This section contains instructions on how to enable the Swagger UI to view API documentation.
To enable the Swagger UI:
-
Navigate to the C:/Program Files (x86)/Hamilton/Bin/WebAPI folder and open WebAPI.Host.appsettings.
-
For the swaggerUIEnabled setting, replace false with true.
-
Save the file and close. The files are in a subdirectory in Program Files (x86) and are administrator-access only.
-
Launch the Services and select Hamilton VENUS WebAPI Host.
-
Restart the Web API host.
-
Go to https://{{your_venus_webapi_ip_address}}/ for the OpenAPI documentation (Swagger UI).
Categories
In Swagger, the API calls are separated into their respective categories for easier navigation. All categories shown in this section are from the Hamilton.WebAPI.Host V3 definition. This section provides a list of the available categories and a general description of what the API endpoints can accomplish within their category.
Cameras
Contains calls for retrieving camera information and performing recording operations.
Devices
Contains calls that can:
-
Retrieve information from registered devices.
-
Retrieve instrument configuration.
-
Open control panels for a requested device.
ErrorHandler
Contains calls related to error handler registration and error handling for an instrument.
Files
Contains calls related to method export, import, and validation. The category also contains methods to request the different files used and their contents.
RunExecutor
Contains calls for method loading and execution. The category also contains calls that request current data such as state and loaded method.
RunMessages
Contains calls related to queuing messages to specific channels.
System
Contains calls that can request Vector and VENUS information. The category can also archive program data and invalidate the run history cache.
Users
Contains calls that request information about a user.
Enable Swagger for Identity Provider
-
Navigate to the C:/Program Files (x86)/Hamilton/Bin/IdentityProvider folder and open IdentityProvider.appsettings.
-
For the swaggerUIEnabled setting, replace false with true.
-
Save the file and close. The files are in a subdirectory in Program Files (x86) and are administrator-access only.
-
Launch the Services and select Hamilton VENUS Identity Provider.
-
Restart the Identity Provider service.
-
Go to http:/{{your_venus_identityprovider_ip_address}}/swagger/index.html for the Identity Provider reference documentation (Swagger UI).
Categories
The identity provider service has a category (Token) for access tokens.
Usage
Swagger UI allows users to view and execute endpoints in the Web API and Identity Provider. If authentication is enabled, endpoints in V3 require a JSON Web Token (JWT) to make an authorized call to the endpoint.
Expand the endpoints to view their respective documentation on usage, parameters, headers, and request and response bodies.
To view the documentation, select the desired API endpoint.
If authentication is enabled, select to bring the authorization modal to view and insert the access token, then select to authorize access for all endpoints.
To test the API endpoint:
-
Select to enable any parameter inputs and display the button.
-
Populate the parameter inputs, if applicable, and select to execute the endpoint.
-
When executing the API endpoint, a server response returns a status code, response body, and response headers.
For more information about Swagger and its other developer tools, go to https://swagger.io/.