Is is possible to create and delete queue in orchestrator through code?
I want my process to have fresh queue every start of the run and delete queue whenever the process is about to end.
TIA
Is is possible to create and delete queue in orchestrator through code?
I want my process to have fresh queue every start of the run and delete queue whenever the process is about to end.
TIA
@joscares
For that you need to hit orchestrator API
Here is the options are available in swagger.
Hi @joscares
It is possible to create and delete a queue in UiPath Orchestrator through code using the UiPath Orchestrator API. The Orchestrator API allows you to interact with queues programmatically.
Find this sample snippet which might help you with the API payload design:
using System;
using System.Net.Http;
using System.Net.Http.Headers;
public class OrchestratorApiHelper
{
private const string OrchestratorUrl = "https://your-orchestrator-instance.com/";
private const string TenantLogicalName = "your-tenant-logical-name";
private const string Token = "your-authentication-token";
public void CreateQueue(string queueName)
{
using (var client = new HttpClient())
{
client.BaseAddress = new Uri(OrchestratorUrl);
client.DefaultRequestHeaders.Accept.Clear();
client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
client.DefaultRequestHeaders.Add("Authorization", $"Bearer {Token}");
var createQueueUrl = $"odata/Queues/UiPathODataSvc.CreateQueue";
var queueData = new { Name = queueName };
var response = client.PostAsJsonAsync(createQueueUrl, queueData).Result;
response.EnsureSuccessStatusCode();
}
}
}
Hope this helps,
Best Regards.