Skip to main content
Version: Current

EnterpriseVariable.CreateVariableAsync

Description​

The API creates a new Enterprise Variable with provided details inside the connected AI Command Center. You can find the newly created Enterprise Variable in AI Command Center under the Assets\Enterprise Variables section.

Signature [C#]​

Task<EnterpriseVariable> CreateVariableAsync(NewVariable newVariable);

Properties​

Input​

ParameterTypeRequired / defaultDescription
newVariableNewVariableRequiredDetails of the variable to be created.

Output​

PropertyDescription
Task<EnterpriseVariable>Returns newly created enterprise variable object.

Remarks​

Use CreateVariableAsync API to create a new enterprise variable inside the connected AI Command Center.

Example​

C#
public async Task CreateEnterpriseVariable()
{
IControlRoomContext context = LoginControlRoom();
try
{
NewVariable newVariable = new NewVariable()
{
Name = "TestEvar",
Value = "3.14",
UserName = null,
Password = null,
Description = "Represents Pi value",
TypeID = 2,
ScopeID = 2,
IsEncrypted = true,
OwnerId = 1
};
EnterpriseVariable enterpriseVariable = await context.EnterpriseVariables.CreateVariableAsync(newVariable);
System.Console.WriteLine("Enterprise Variable Name is " + enterpriseVariable.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.