예제 #1
0
        public async Task Authenticate()
        {
            Utilities.WebUtility uipathApiAuthenticate = new Utilities.WebUtility(AuthenticationEndpoint);
            string responseString = await uipathApiAuthenticate.PostAsync("{\"tenancyName\" : \"robo-zell\",\"usernameOrEmailAddress\" : \"admin\",\"password\" : \"uip@thr0b0t\"}", _headerList);

            JObject responseJson = JObject.Parse(responseString);

            _authToken = responseJson["result"].ToString();
        }
예제 #2
0
        public async Task <string> StartJob()
        {
            ProcessRelease release = await GetProcessRelease();

            Robot robot = await GetRobot();

            Utilities.WebUtility uipathApiStartJob = new Utilities.WebUtility(StartJobEndpoint);
            string jobJsonBody = "{\"startInfo\": {\"ReleaseKey\": \"" + release.Key + "\",\"Strategy\": \"Specific\",\"RobotIds\": [" + robot.Id + "],\"NoOfRobots\": 0}}";
            string jobResponse = await uipathApiStartJob.PostAsync(jobJsonBody, _headerList, _authToken);

            return(jobResponse);
        }
예제 #3
0
        public async Task <Asset> CreateAndGetTextAsset(string variableName)
        {
            string endpoint = $"{AssetsEndpoint}";

            Utilities.WebUtility uipathApiAsset = new Utilities.WebUtility(endpoint);
            Asset existingAsset = await GetAsset(variableName);

            if (existingAsset != null)
            {
                // Asset already exists
                return(existingAsset);
            }
            string jsonPayloadString  = Properties.Resources.ResourceManager.GetString("TextAssetTemplate");
            string jsonStringResponse = await uipathApiAsset.PostAsync(jsonPayloadString, _headerList, _authToken);

            // Asset created successfully
            return(await GetAsset(variableName));
        }