Connections.CreateConnectionAsync
Description
The API creates a new Connection with the specified details inside the connected AI Command Center.
Signature [C#]
Task<Connection> CreateConnectionAsync(NewConnection connection);
Properties
Input
| Parameter | Type | Required / default | Description |
|---|---|---|---|
connection | NewConnection | Required | The new connection details to be created. |
Output
| Property | Description |
|---|---|
| Task<Connection> | Returns newly created connection. |
Remarks
Use CreateConnectionAsync API to create a new Connection inside the connected AI Command Center.
Example
C#
public async Task CreateConnection()
{
IControlRoomContext context = LoginControlRoom();
try
{
NewConnection connection = new NewConnection()
{
ConnectionType = "File System",
Description = "API test",
Name = "FsConnApiTest",
Value = new ConnectionValue()
{
Value = "{\"folderPath\":\"YourPath\"}"
}
};
var conn = await context.Connections.CreateConnectionAsync(connection);
System.Console.WriteLine("Connection Name: " + conn.Name);
}
finally
{
context.Close();
}
}
Connection helper
public IControlRoomContext LoginControlRoom()
{
string RequiredSetting(string name) => Environment.GetEnvironmentVariable(name) ?? throw new InvalidOperationException($"Set {name} before running this example.");
string serverUrl = RequiredSetting("INTELLIBUDDIES_SERVER_URL");
string userName = RequiredSetting("INTELLIBUDDIES_USERNAME");
string password = RequiredSetting("INTELLIBUDDIES_PASSWORD");
string connectionString = $"ServerUrl={serverUrl};UserName={userName};Password={password}";
IControlRoomContext context = new ControlRoomContext(connectionString);
context.Open();
return context;
}
See Get started for namespaces, configuration, and context cleanup, and SDK usage for error handling.