示例#1
0
        private void TestHelperDeleteItem(RallyRestApi restApi, string reference)
        {
            OperationResult deleteResponse = restApi.Delete(Ref.GetRelativeRef(reference));
            dynamic         testEmpty      = restApi.GetByReference(reference);

            Assert.IsNull(testEmpty);
        }
        static void Main(string[] args)
        {
            RallyRestApi restApi;

            restApi = new RallyRestApi("*****@*****.**", "secret", "https://rally1.rallydev.com", "v2.0");
            String workspaceRef = "/workspace/12352608129"; //use your workspace object id

            Request defectRequest = new Request("defect");

            defectRequest.Workspace = workspaceRef;
            defectRequest.Query     = new Query("LastUpdateDate", Query.Operator.GreaterThanOrEqualTo, "2014-07-20");
            defectRequest.Fetch     = new List <string>()
            {
                "Name",
                "FormattedID"
            };

            int         stopAfter          = 2; //KEEP IT LOW UNTIL YOU MAKE SURE IT IS DELETING THE INTENDED SUBSET OF YOUR DATA
            int         count              = 0;
            QueryResult queryDefectResults = restApi.Query(defectRequest);

            foreach (var d in queryDefectResults.Results)
            {
                if (count == stopAfter)
                {
                    break;
                }
                Console.WriteLine("Deleting: " + d["FormattedID"] + " " + d["Name"]);
                OperationResult deleteResult = restApi.Delete(workspaceRef, d["_ref"]); //DELTED DEFECTS WILL BE FOUND IN THE RECYCLE BIN
                count++;
            }
        }
示例#3
0
        private void AssertCanDelete(RallyRestApi restApi, bool includeFullData = false)
        {
            // Create test defect
            var defect    = TestHelperCreateDefect(restApi, includeFullData);
            var defectOid = Ref.GetOidFromRef(defect);

            OperationResult deleteResponse  = restApi.Delete(Ref.GetRelativeRef(defect));
            dynamic         testDefectEmpty = restApi.GetByReference(defect);

            Assert.IsNull(testDefectEmpty);
        }
        private void AssertCanDelete(RallyRestApi restApi)
        {
            var dynamicJson = new DynamicJsonObject();

            dynamicJson["Name"] = "C# Json Rest Toolkit Test Defect";
            CreateResult response = restApi.Create("defect", dynamicJson);

            Assert.AreEqual(0, response.Errors.Count);
            Assert.IsTrue(response.Reference.ToLower().Contains("defect"));
            OperationResult deleteResponse  = restApi.Delete(Ref.GetRelativeRef(response.Reference));
            dynamic         testDefectEmpty = restApi.GetByReference(response.Reference);

            Assert.IsNull(testDefectEmpty);
        }
示例#5
0
        public void ExampleMethodText()
        {
            string username = "******";
            string password = "******";
            // Initialize the REST API. You can specify a web service version if needed in the constructor.
            RallyRestApi restApi = new RallyRestApi();

            restApi.Authenticate(username, password, "https://preview.rallydev.com", proxy: null, allowSSO: false);

            //Create an item
            DynamicJsonObject toCreate = new DynamicJsonObject();

            toCreate["Name"] = "My Defect";
            CreateResult createResult = restApi.Create("defect", toCreate);

            //Update the item
            DynamicJsonObject toUpdate = new DynamicJsonObject();

            toUpdate["Description"] = "This is my defect.";
            OperationResult updateResult = restApi.Update(createResult.Reference,
                                                          toUpdate);

            //Get the item
            DynamicJsonObject item = restApi.GetByReference(createResult.Reference);

            //Query for items
            Request request = new Request("defect");

            request.Fetch = new List <string>()
            {
                "Name", "Description", "FormattedID"
            };
            request.Query = new Query("Name", Query.Operator.Equals, "My Defect");
            QueryResult queryResult = restApi.Query(request);

            foreach (var result in queryResult.Results)
            {
                //Process item as needed
            }

            //Delete the item
            OperationResult deleteResult = restApi.Delete(createResult.Reference);
        }
        private void AssertCanDelete(RallyRestApi restApi, bool includeFullData = false)
        {
            var dynamicJson = new DynamicJsonObject();

            dynamicJson["Name"] = "C# Json Rest Toolkit Test Defect";
            if (includeFullData)
            {
                dynamicJson["Owner"]   = restApi.GetCurrentUser()["_ref"];
                dynamicJson["Package"] = "Package A";
            }
            CreateResult response = restApi.Create("defect", dynamicJson);

            Assert.AreEqual(0, response.Errors.Count);
            Assert.IsTrue(response.Reference.ToLower().Contains("defect"));
            OperationResult deleteResponse  = restApi.Delete(Ref.GetRelativeRef(response.Reference));
            dynamic         testDefectEmpty = restApi.GetByReference(response.Reference);

            Assert.IsNull(testDefectEmpty);
        }
		private void AssertCanDelete(RallyRestApi restApi, bool includeFullData = false)
		{
			var dynamicJson = new DynamicJsonObject();
			dynamicJson["Name"] = "C# Json Rest Toolkit Test Defect";
			if (includeFullData)
			{
				dynamicJson["Owner"] = restApi.GetCurrentUser()["_ref"];
				dynamicJson["Package"] = "Package A";
			}
			CreateResult response = restApi.Create("defect", dynamicJson);
			Assert.AreEqual(0, response.Errors.Count);
			Assert.IsTrue(response.Reference.ToLower().Contains("defect"));
			OperationResult deleteResponse = restApi.Delete(Ref.GetRelativeRef(response.Reference));
			dynamic testDefectEmpty = restApi.GetByReference(response.Reference);
			Assert.IsNull(testDefectEmpty);
		}
		private void TestHelperDeleteItem(RallyRestApi restApi, string reference)
		{
			OperationResult deleteResponse = restApi.Delete(Ref.GetRelativeRef(reference));
			dynamic testEmpty = restApi.GetByReference(reference);
			Assert.IsNull(testEmpty);
		}
		private void AssertCanDelete(RallyRestApi restApi, bool includeFullData = false)
		{
			// Create test defect
			var defect = TestHelperCreateDefect(restApi, includeFullData);
			var defectOid = Ref.GetOidFromRef(defect);

			OperationResult deleteResponse = restApi.Delete(Ref.GetRelativeRef(defect));
			dynamic testDefectEmpty = restApi.GetByReference(defect);
			Assert.IsNull(testDefectEmpty);
		}
 private void AssertCanDelete(RallyRestApi restApi)
 {
     var dynamicJson = new DynamicJsonObject();
     dynamicJson["Name"] = "C# Json Rest Toolkit Test Defect";
     CreateResult response = restApi.Create("defect", dynamicJson);
     Assert.AreEqual(0, response.Errors.Count);
     Assert.IsTrue(response.Reference.ToLower().Contains("defect"));
     OperationResult deleteResponse = restApi.Delete(Ref.GetRelativeRef(response.Reference));
     dynamic testDefectEmpty = restApi.GetByReference(response.Reference);
     Assert.IsNull(testDefectEmpty);
 }
		public void ExampleMethodText()
		{
			string username = "******";
			string password = "******";
			// Initialize the REST API. You can specify a web service version if needed in the constructor.
			RallyRestApi restApi = new RallyRestApi();
			restApi.Authenticate(username, password, "https://preview.rallydev.com", proxy: null, allowSSO: false);

			//Create an item
			DynamicJsonObject toCreate = new DynamicJsonObject();
			toCreate["Name"] = "My Defect";
			CreateResult createResult = restApi.Create("defect", toCreate);

			//Update the item
			DynamicJsonObject toUpdate = new DynamicJsonObject();
			toUpdate["Description"] = "This is my defect.";
			OperationResult updateResult = restApi.Update(createResult.Reference,
											toUpdate);

			//Get the item
			DynamicJsonObject item = restApi.GetByReference(createResult.Reference);

			//Query for items
			Request request = new Request("defect");
			request.Fetch = new List<string>() { "Name", "Description", "FormattedID" };
			request.Query = new Query("Name", Query.Operator.Equals, "My Defect");
			QueryResult queryResult = restApi.Query(request);
			foreach (var result in queryResult.Results)
			{
				//Process item as needed
			}

			//Delete the item
			OperationResult deleteResult = restApi.Delete(createResult.Reference);
		}