/// <summary> /// Job execution related methods /// </summary> private async Task <ProcessRelease> GetProcessRelease() { ProcessRelease processRelease = new ProcessRelease(_workflowName, _envName); string getEndpoint = $"{ProcessReleaseEndpoint}?$filter=Name eq '{processRelease.Name}'"; Utilities.WebUtility uipathApiProcRelease = new Utilities.WebUtility(getEndpoint); string jsonStringResponse = await uipathApiProcRelease.GetAsync("application/json", _authToken); processRelease.Key = JsonProcessing.ExtractFromODataJsonByKey(jsonStringResponse, "Key"); return(processRelease); }
private async Task <Robot> GetRobot() { Robot robot = new Robot(_machineName); string getEndpoint = $"{RobotEndpoint}?$filter=MachineName eq '{robot.MachineName}'"; Utilities.WebUtility uipathApiRobot = new Utilities.WebUtility(getEndpoint); string jsonStringResponse = await uipathApiRobot.GetAsync("application/json", _authToken); robot.Id = JsonProcessing.ExtractFromODataJsonByKey(jsonStringResponse, "Id"); return(robot); }
/// <summary> /// Asset (process variables) related methods /// </summary> public async Task <Asset> GetAsset(string variableName) { Asset asset = new Asset(_workflowName, variableName); string getEndpoint = $"{AssetsEndpoint}?$filter=Name eq '{asset.Name}'"; Utilities.WebUtility uipathApiAsset = new Utilities.WebUtility(getEndpoint); string jsonStringResponse = await uipathApiAsset.GetAsync("application/json", _authToken); try { asset.JsonData = JObject.Parse(jsonStringResponse)?["value"]?[0]?.ToString(); asset.Id = JsonProcessing.ExtractFromODataJsonByKey(jsonStringResponse, "Id"); return(asset); } catch (System.ArgumentOutOfRangeException ex) { // Asset not existing return(null); } }