in Webapp/SDAF/Controllers/RestHelper.cs [334:364]
public async Task<string> GetVariableFromVariableGroup(string id, string variableGroupName, string variableName)
{
try
{
if (id == null || id == "")
{
id = await GetVariableGroupIdFromName(variableGroupName);
if (id == null)
{
throw new Exception();
}
}
string getUri = $"{collectionUri}{project}/_apis/distributedtask/variablegroups/{id}?api-version=7.1";
using HttpResponseMessage response = client.GetAsync(getUri).Result;
string responseBody = await response.Content.ReadAsStringAsync();
HandleResponse(response, responseBody);
JsonElement variables = JsonDocument.Parse(responseBody).RootElement.GetProperty("variables");
string value = variables.GetProperty(variableName).GetProperty("value").GetString();
if (value.EndsWith('/'))
{
value = value.Remove(value.Length - 1);
}
return value;
}
catch
{
return "WORKSPACES";
}
}