public ApiResponseMsg GetWorkItemsByQuery(string organizationName, string projectName) { Object wiql = new { query = "Select [Id],[State], [Title]" + "From WorkItems " + //"Where [Work Item Type] = '" + workItemType + "'" + "Where [System.TeamProject] = '" + projectName + "' " + "Order By [Stack Rank] Desc, [Backlog Priority] Desc" }; HttpConfigurations oAppConfigurations = new HttpConfigurations(); oAppConfigurations.BaseUrl = _baseUrl; oAppConfigurations.UrlParams = string.Format("/{0}/_apis/wit/wiql?api-version=5.0", organizationName); oAppConfigurations.SecurityKey = _token; oAppConfigurations.ContentType = Constants.ContentTypeJson; oAppConfigurations.RequestBody = JsonConvert.SerializeObject(wiql); oAppConfigurations.HttpMethod = Constants.Post; oAppConfigurations.AuthenticationScheme = AuthConfig.AuthType; HttpServices oHttpService = new HttpServices(oAppConfigurations); return(oHttpService.Post()); }
public System.Drawing.Image ExportAttachments(string accountName, string projectName, string attachmentId, string attachmentName) { System.Drawing.Image image = null; try { HttpConfigurations oAppConfigurations = new HttpConfigurations(); oAppConfigurations.BaseUrl = _baseUrl; oAppConfigurations.UrlParams = string.Format("{0}/{1}/_apis/wit/attachments/{2}?download=true&api-version=5.0", accountName, projectName, attachmentId); oAppConfigurations.SecurityKey = _token; oAppConfigurations.ContentType = Constants.ContentTypeJson; oAppConfigurations.HttpMethod = Constants.Get; oAppConfigurations.AuthenticationScheme = AuthConfig.AuthType; HttpServices oHttpService = new HttpServices(oAppConfigurations); System.Net.HttpWebRequest webRequest = (System.Net.HttpWebRequest)System.Net.HttpWebRequest.Create(oAppConfigurations.BaseUrl + "/" + oAppConfigurations.UrlParams); webRequest.AllowWriteStreamBuffering = true; webRequest.ContentType = "application/json"; webRequest.Headers.Add("Authorization", oAppConfigurations.AuthenticationScheme + " " + oAppConfigurations.SecurityKey); System.Net.WebResponse webResponse = webRequest.GetResponse(); System.IO.Stream stream = webResponse.GetResponseStream(); image = System.Drawing.Image.FromStream(stream); webResponse.Close(); } catch (Exception ex) { return(null); } return(image); }
/// <summary> /// CreatedOn : 12-12-2018 /// Created By : Deviprasad /// Document Url : https://docs.microsoft.com/en-us/rest/api/azure/devops/account/accounts/list?view=azure-devops-rest-4.1 /// Api Url : GET https://app.vssps.visualstudio.com/_apis/accounts?ownerId={ownerId}&memberId={memberId}&properties={properties}&api-version=4.1 /// Discription : /// Current Version : /// BasicTest Executed : NO /// </summary> /// <returns></returns> public ApiResponseMsg GetListAccounts() { HttpConfigurations oAppConfigurations = new HttpConfigurations(); oAppConfigurations.BaseUrl = AuthConfig.AzureDevOpsBaseUrl; oAppConfigurations.UrlParams = string.Format("/_apis/accounts?ownerId={0}/api-version=4.1", _profileId); oAppConfigurations.SecurityKey = _token; oAppConfigurations.ContentType = Constants.ContentTypeJson; oAppConfigurations.HttpMethod = Constants.Get; oAppConfigurations.AuthenticationScheme = AuthConfig.AuthType; HttpServices oHttpService = new HttpServices(oAppConfigurations); return(oHttpService.Get()); }
public HttpServices(HttpConfigurations appConfigs) { appConfig.SecurityKey = appConfigs.SecurityKey; appConfig.BaseUrl = appConfigs.BaseUrl; appConfig.UrlParams = appConfigs.UrlParams; appConfig.ContentType = appConfigs.ContentType; appConfig.AuthenticationScheme = appConfigs.AuthenticationScheme; appConfig.HttpMethod = appConfigs.HttpMethod; appConfig.RequestBody = appConfigs.RequestBody; if (string.IsNullOrEmpty(appConfigs.AuthType)) { appConfig.AuthType = ConfigurationManager.AppSettings["AuthType"]; } }
private ApiResponseMsg GetAccessToken() { HttpConfigurations oAppConfigurations = new HttpConfigurations(); oAppConfigurations.BaseUrl = AuthConfig.AzureDevOpsBaseUrl; oAppConfigurations.UrlParams = _tokenUrl; oAppConfigurations.ContentType = Constants.ContentTypeUriEncode; oAppConfigurations.HttpMethod = Constants.Post; oAppConfigurations.RequestBody = GetTokenExchangeParam(_code); oAppConfigurations.AuthenticationScheme = Constants.ContentTypeUriEncode; HttpServices oHttpService = new HttpServices(oAppConfigurations); return(oHttpService.Post(true)); }
/// <summary> /// CreatedOn : /// Document Url : https://docs.microsoft.com/en-us/rest/api/azure/devops/profile/profiles/get?view=azure-devops-rest-4.1 /// Api Url : GET https://app.vssps.visualstudio.com/_apis/profile/profiles/{id}?details={details}&withAttributes={withAttributes}&partition={partition}&coreAttributes={coreAttributes}&forceRefresh={forceRefresh}&api-version=4.1 /// Discription : /// Current Version : /// BasicTest Executed : NO /// </summary> /// <returns></returns> public ApiResponseMsg GetCurrentProfile() { HttpConfigurations oAppConfigurations = new HttpConfigurations(); oAppConfigurations.BaseUrl = AuthConfig.AzureDevOpsBaseUrl; oAppConfigurations.UrlParams = "_apis/profile/profiles/me?api-version=4.1"; oAppConfigurations.SecurityKey = _token; oAppConfigurations.ContentType = Constants.ContentTypeJson; oAppConfigurations.HttpMethod = Constants.Get; oAppConfigurations.AuthenticationScheme = AuthConfig.AuthType; HttpServices oHttpService = new HttpServices(oAppConfigurations); return(oHttpService.Get()); }
/// <summary> /// CreatedOn : 12-12-2018 /// Created By : Deviprasad /// Document Url : https://docs.microsoft.com/en-us/rest/api/azure/devops/account/accounts/list?view=azure-devops-rest-4.1 /// Api Url : GET https://dev.azure.com/{organization}/_apis/projects?api-version=5.0 /// GET https://dev.azure.com/{organization}/_apis/projects?stateFilter={stateFilter}&$top={$top}&$skip={$skip}&continuationToken={continuationToken}&getDefaultTeamImageUrl={getDefaultTeamImageUrl}&api-version=5.0 /// Discription : /// Current Version : /// BasicTest Executed : NO /// </summary> /// <returns></returns> public ApiResponseMsg GetProjects(string organizationName, string stateFilter = "") { HttpConfigurations oAppConfigurations = new HttpConfigurations(); oAppConfigurations.BaseUrl = _baseUrl; oAppConfigurations.UrlParams = string.Format("/{0}/_apis/projects?api-version=4.1", organizationName); oAppConfigurations.SecurityKey = _token; oAppConfigurations.ContentType = Constants.ContentTypeJson; oAppConfigurations.HttpMethod = Constants.Get; oAppConfigurations.AuthenticationScheme = AuthConfig.AuthType; HttpServices oHttpService = new HttpServices(oAppConfigurations); return(oHttpService.Get()); }
/// <summary> /// CreatedOn : /// Document Url : https://docs.microsoft.com/en-us/rest/api/azure/devops/wit/classification%20nodes/get?view=azure-devops-rest-5.0 /// Api Url : GET https://dev.azure.com/{organization}/SMH360/_apis/wit/classificationnodes?$depth=3&api-version=5.0 /// Discription : /// Current Version : /// BasicTest Executed : NO /// </summary> /// <returns></returns> public ApiResponseMsg GetClassificationNodes(string organizationName, string projectName) { HttpConfigurations oAppConfigurations = new HttpConfigurations(); oAppConfigurations.BaseUrl = _baseUrl; oAppConfigurations.UrlParams = string.Format("{0}/{1}/_apis/wit/classificationnodes?$depth=3&api-version=5.0", organizationName, projectName); oAppConfigurations.SecurityKey = _token; oAppConfigurations.ContentType = Constants.ContentTypeJson; oAppConfigurations.HttpMethod = Constants.Get; oAppConfigurations.AuthenticationScheme = AuthConfig.AuthType; HttpServices oHttpService = new HttpServices(oAppConfigurations); return(oHttpService.Get()); }
public ApiResponseMsg GetWIByIds(string organizationName, string projectName, string ids) { HttpConfigurations oAppConfigurations = new HttpConfigurations(); oAppConfigurations.BaseUrl = _baseUrl; oAppConfigurations.UrlParams = string.Format("{0}/{1}/_apis/wit/workitems?ids={2}&$expand=relations&api-version=5.0", organizationName, projectName, ids); oAppConfigurations.SecurityKey = _token; oAppConfigurations.ContentType = Constants.ContentTypeJson; oAppConfigurations.HttpMethod = Constants.Get; oAppConfigurations.AuthenticationScheme = AuthConfig.AuthType; HttpServices oHttpService = new HttpServices(oAppConfigurations); return(oHttpService.Get()); }
public ApiResponseMsg CreateWorkItem(string organization, string workItemReqBody) { HttpConfigurations oAppConfigurations = new HttpConfigurations(); oAppConfigurations.BaseUrl = AuthConfig.AzureDevOpsBaseUrl; oAppConfigurations.UrlParams = string.Format("{0}/_apis/work/processes?api-version=4.1-preview.1", organization); oAppConfigurations.SecurityKey = _token; oAppConfigurations.ContentType = Constants.ContentTypeJson; oAppConfigurations.HttpMethod = Constants.Post; oAppConfigurations.AuthenticationScheme = AuthConfig.AuthType; oAppConfigurations.RequestBody = workItemReqBody; HttpServices oHttpService = new HttpServices(oAppConfigurations); return(oHttpService.Get()); }
/// <summary> /// CreatedOn : /// Created By : /// Document Url : GET https://dev.azure.com/{organization}/{project}/_apis/testplan/Plans/{planId}/suites?api-version=5.0-preview.1 /// Api Url : /// /// Discription : /// Current Version : /// BasicTest Executed : NO /// </summary> /// <returns></returns> public ApiResponseMsg GetTestSuitesByTestPlanId(string organizationName, string projectName, string testPlanId) { HttpConfigurations oAppConfigurations = new HttpConfigurations(); oAppConfigurations.BaseUrl = _baseUrl; oAppConfigurations.UrlParams = string.Format("/{0}/{1}/_apis/testplan/Plans/{2}/suites?api-version=5.0-preview.1 ", organizationName, projectName, testPlanId); oAppConfigurations.SecurityKey = _token; oAppConfigurations.ContentType = Constants.ContentTypeJson; oAppConfigurations.HttpMethod = Constants.Get; oAppConfigurations.AuthenticationScheme = AuthConfig.AuthType; HttpServices oHttpService = new HttpServices(oAppConfigurations); return(oHttpService.Get()); }
/// <summary> /// CreatedOn : /// Document Url : /// Api Url : GET https://vssps.dev.azure.com/{organization}/_apis/graph/descriptors/{storageKey}?api-version=5.0-preview.1 /// Discription : /// Current Version : /// BasicTest Executed : NO /// </summary> /// <returns></returns> public ApiResponseMsg GetDescriptors(string organizationName, string projectId) { HttpConfigurations oAppConfigurations = new HttpConfigurations(); oAppConfigurations.BaseUrl = _baseUrl; oAppConfigurations.UrlParams = string.Format("{0}/_apis/graph/descriptors/{1}?api-version=5.0-preview.1", organizationName, projectId); oAppConfigurations.SecurityKey = _token; oAppConfigurations.ContentType = Helpers.Constants.ContentTypeJson; oAppConfigurations.HttpMethod = Constants.Get; oAppConfigurations.AuthenticationScheme = AuthConfig.AuthType; HttpServices oHttpService = new HttpServices(oAppConfigurations); return(oHttpService.Get()); }
/// <summary> /// CreatedOn : /// Document Url : https://docs.microsoft.com/en-us/rest/api/azure/devops/memberentitlementmanagement/members/get?view=azure-devops-rest-5.0 /// Api Url : GET https://vsaex.dev.azure.com/{organization}/_apis/GroupEntitlements/{groupId}/members?api-version=5.0-preview.1 /// Discription : /// Current Version : /// BasicTest Executed : NO /// </summary> /// <returns></returns> public ApiResponseMsg GetMenbersForGroup(string organizationName, string groupId) { HttpConfigurations oAppConfigurations = new HttpConfigurations(); oAppConfigurations.BaseUrl = _baseUrl; oAppConfigurations.UrlParams = string.Format("{0}/_apis/GroupEntitlements/{1}/members?api-version=5.0-preview.1", organizationName, groupId); oAppConfigurations.SecurityKey = _token; oAppConfigurations.ContentType = Constants.ContentTypeJson; oAppConfigurations.HttpMethod = Constants.Get; oAppConfigurations.AuthenticationScheme = AuthConfig.AuthType; HttpServices oHttpService = new HttpServices(oAppConfigurations); return(oHttpService.Get()); }
/// <summary> /// CreatedOn : /// Document Url : https://docs.microsoft.com/en-us/rest/api/azure/devops/graph/groups/list?view=azure-devops-rest-5.0 /// Api Url : GET https://vssps.dev.azure.com/{organization}/_apis/graph/groups/{groupDescriptor}?api-version=5.0-preview.1 /// Discription : /// Current Version : /// BasicTest Executed : NO /// </summary> /// <returns></returns> public ApiResponseMsg GetGroups(string organizationName, string scopeDescriptor = "") { HttpConfigurations oAppConfigurations = new HttpConfigurations(); oAppConfigurations.BaseUrl = _baseUrl; if (string.IsNullOrEmpty(scopeDescriptor)) { oAppConfigurations.UrlParams = string.Format("{0}/_apis/graph/groups?api-version=5.0-preview.1", organizationName); } else { oAppConfigurations.UrlParams = string.Format("{0}/_apis/graph/groups?scopeDescriptor={1}&api-version=5.0-preview.1", organizationName, scopeDescriptor); } oAppConfigurations.SecurityKey = _token; oAppConfigurations.ContentType = Constants.ContentTypeJson; oAppConfigurations.HttpMethod = Constants.Get; oAppConfigurations.AuthenticationScheme = Constants.SchemeOAuth; HttpServices oHttpService = new HttpServices(oAppConfigurations); return(oHttpService.Get()); }
/// <summary> /// CreatedOn : /// Created By : /// Document Url : /// Api Url : /// /// Discription : /// Current Version : /// BasicTest Executed : NO /// </summary> /// <returns></returns> public ApiResponseMsg GetTestPlans(string organizationName, string projectName, bool includePlanDetails = true) { HttpConfigurations oAppConfigurations = new HttpConfigurations(); oAppConfigurations.BaseUrl = _baseUrl; if (includePlanDetails) { oAppConfigurations.UrlParams = string.Format("/{0}/{1}/_apis/test/plans?includePlanDetails={2}&api-version=5.0", organizationName, projectName, includePlanDetails); } else { oAppConfigurations.UrlParams = string.Format("/{0}/{1}/_apis/test/plans?api-version=5.0", organizationName, projectName); } oAppConfigurations.SecurityKey = _token; oAppConfigurations.ContentType = Constants.ContentTypeJson; oAppConfigurations.HttpMethod = Constants.Get; oAppConfigurations.AuthenticationScheme = AuthConfig.AuthType; HttpServices oHttpService = new HttpServices(oAppConfigurations); return(oHttpService.Get()); }