Method GetOrCreateRestServerAgentAsync
- Namespace
- Kepware.Api.ClientHandler
- Assembly
- Kepware.Api.dll
GetOrCreateRestServerAgentAsync(string, IDictionary<string, object>?, CancellationToken)
Gets or creates a REST Server agent with the specified name. If the agent exists, it is loaded and returned. If it does not exist, it is created with the specified properties.
public Task<RestServerAgent> GetOrCreateRestServerAgentAsync(string name, IDictionary<string, object>? properties = null, CancellationToken cancellationToken = default)
Parameters
namestringThe name of the agent.
propertiesIDictionary<string, object>Optional properties to set on the agent.
cancellationTokenCancellationTokenThe cancellation token.
Returns
- Task<RestServerAgent>
A task that represents the asynchronous operation. The task result contains the created or loaded RestServerAgent.
Exceptions
- ArgumentException
Thrown when the name is null or empty.
- InvalidOperationException
Thrown when the agent cannot be created or loaded.