Forum Discussion
Can we integrate azure board in java application for retrieving projects, work items operations
I want to integrate the azure board in my spring boot java application to fetch the projects, iterations,work items. does azure provide the sdk for it so i can use that jar and integrate this kind of operation in my application.
does azure sdk has dedicated methods for azure board data like project,iterations , work items
- balasubramanimIron Contributor
Azure does not have a dedicated SDK for Azure Boards, but the REST API provides all necessary functionality. You can integrate it seamlessly into your Spring Boot Java application using REST clients or Azure Core SDK.
Reference URL: https://learn.microsoft.com/en-us/rest/api/azure/devops/?view=azure-devops-rest-7.2 How about Azure DevOps Java SDK?
Add Azure DevOps SDK Dependency:
<dependency> <groupId>com.microsoft.azure</groupId> <artifactId>azure-devops-java-sdk</artifactId> <version>1.0.0</version> </dependency>
Authenticate with Azure DevOps:
- You will need a Personal Access Token (PAT) to authenticate with Azure DevOps. You can generate a PAT from your Azure DevOps account.
Fetch Projects, Iterations, and Work Items:
- Use the SDK to interact with Azure Boards. Here is an example of how you can fetch projects, iterations, and work items:
import com.microsoft.azure.devops.v5_1.core.CoreHttpClient; import com.microsoft.azure.devops.v5_1.work.WorkHttpClient; import com.microsoft.azure.devops.v5_1.workitemtracking.WorkItemTrackingHttpClient; import com.microsoft.azure.devops.v5_1.core.models.TeamProjectReference; import com.microsoft.azure.devops.v5_1.work.models.TeamSettingsIteration; import com.microsoft.azure.devops.v5_1.workitemtracking.models.WorkItem; import java.util.List; public class AzureBoardsIntegration { private static final String ORGANIZATION_URL = "https://dev.azure.com/your_organization"; private static final String PAT = "your_personal_access_token"; public static void main(String[] args) { CoreHttpClient coreClient = new CoreHttpClient(ORGANIZATION_URL, PAT); WorkHttpClient workClient = new WorkHttpClient(ORGANIZATION_URL, PAT); WorkItemTrackingHttpClient witClient = new WorkItemTrackingHttpClient(ORGANIZATION_URL, PAT); // Fetch projects List<TeamProjectReference> projects = coreClient.getProjects().getValue(); projects.forEach(project -> System.out.println("Project: " + project.getName())); // Fetch iterations for a specific project String projectId = "your_project_id"; List<TeamSettingsIteration> iterations = workClient.getTeamIterations(projectId, "your_team_id").getValue(); iterations.forEach(iteration -> System.out.println("Iteration: " + iteration.getName())); // Fetch work items List<WorkItem> workItems = witClient.getWorkItems("your_query").getValue(); workItems.forEach(workItem -> System.out.println("Work Item: " + workItem.getFields().get("System.Title"))); } }
- surendra-pCopper Contributor
<dependency> <groupId>com.microsoft.azure</groupId> <artifactId>azure-devops-java-sdk</artifactId> <version>1.0.0</version> </dependency>have added the maven dependency in my test project but it says Could not find artifact com.microsoft.azure:azure-devops-java-sdk:pom:1.0.0 in central (https://repo.maven.apache.org/maven2)
is of now i did not found any documentation about this from azure , is it official sdk from azure devops so can do my operations like fetch projects, project level iterations, project level iteration associated work items using wiql etc.
- balasubramanimIron Contributor
You are encountering an error because the Maven Central Repository doesn't host an artifact with the coordinates com.microsoft.azure:azure-devops-java-sdk:1.0.0. This suggests that such an artifact isn't officially provided by Microsoft for Azure DevOps services.
Official SDKs - Microsoft offers the Azure SDK for Java(https://learn.microsoft.com/en-us/azure/developer/java/sdk/), which includes client libraries for various Azure services. However, it doesn't provide a dedicated SDK for Azure DevOps services, including Azure Boards.
Options:
1. Use REST API - Azure DevOps REST API allows you to fetch projects, iterations, and work items. Use HTTP clients like Apache HttpClient or OkHttp in your Java app.2. Community SDK - A community-driven Azure DevOps Java SDK exists, but it’s not officially supported by Microsoft.
Add it via
<dependency>
<groupId>com.microsoft.azure</groupId>
<artifactId>azure-devops-java-sdk</artifactId>
<version>6.0.0</version>
</dependency>3. Ensure access to its hosting repository if needed.