Integration Patterns Documentation

Navigation: Home > API Reference > Integration Patterns

Integration Patterns provide guidance on how to effectively combine multiple Azure DevOps APIs to solve common real-world scenarios. While individual API documentation focuses on specific methods and their usage, integration patterns demonstrate how these APIs work together to create comprehensive solutions.

The Integration Patterns documentation is designed to:

  • Demonstrate Real-World Scenarios: Show practical, real-world usage scenarios that span multiple APIs
  • Provide Code Examples: Offer end-to-end code examples for common integration workflows
  • Illustrate Best Practices: Showcase best practices for combining different Azure DevOps services
  • Clarify API Relationships: Help developers understand the relationships between different APIs
  • Accelerate Development: Provide reusable patterns for common tasks to speed up implementation

This documentation covers key integration patterns between the most commonly used Azure DevOps APIs:

Integration patterns address several common scenarios in Azure DevOps workflows:

Link work items to code changes, builds, and releases to maintain a complete history of how requirements are implemented and deployed.

Trigger actions in one service based on events in another, such as creating a build when code is pushed or updating a work item when a build completes.

Gather data across multiple services to create comprehensive reports that provide insights across the entire development lifecycle.

Keep information consistent across different systems, ensuring that changes in one system are reflected in others.

Coordinate complex processes across multiple services to implement end-to-end workflows that span the entire development lifecycle.

To use these integration patterns, you'll need:

  • An Azure DevOps account with appropriate permissions
  • A Personal Access Token (PAT) with scopes for all relevant services
  • The Azure DevOps Node.js API client library
  • Familiarity with the individual APIs being integrated

To implement these integration patterns, first establish a connection to your Azure DevOps organization and obtain the necessary API clients:

import * as azdev from "azure-devops-node-api";

// Connection setup
const orgUrl = "https://dev.azure.com/yourorganization";
const token = "your-personal-access-token";

const authHandler = azdev.getPersonalAccessTokenHandler(token);
const connection = new azdev.WebApi(orgUrl, authHandler);

// Get API clients for integration
const workItemTrackingApi = await connection.getWorkItemTrackingApi();
const gitApi = await connection.getGitApi();
const buildApi = await connection.getBuildApi();

// Now you can implement the integration patterns
// using these API clients together

The following describes the relationships between the primary APIs covered in these integration patterns:

API Relationship Structure:

  • The Core API (Projects & Teams) serves as the central component
  • Three main APIs branch from the Core API:
    • Git API (Code & Repositories)
    • Work Item Tracking API
    • Build API
  • These three APIs have bidirectional relationships with each other
  • All APIs contribute to Integration Patterns

For a detailed breakdown of how specific methods relate to each other, see the API Cross-Reference Table.

The Work Item Tracking API provides methods for managing work items:

The Git API provides methods for working with repositories and code:

The Build API provides methods for managing build pipelines:

When implementing integration patterns, consider these best practices:

Implement robust error handling that accounts for failures in any of the integrated APIs. Consider how to handle partial failures and ensure your application can recover gracefully.

Consider how to maintain consistency when operations span multiple services. Implement compensating transactions or idempotent operations to handle failures.

Minimize API calls by batching operations where possible. Use efficient querying patterns and cache results when appropriate to reduce load on the server.

Be aware of API rate limits, especially when making many cross-service calls. Implement retry logic with exponential backoff to handle rate limiting gracefully.

Ensure your authentication token has all necessary scopes for the APIs you're integrating. Use the principle of least privilege to minimize security risks.

Design integrations to be safely retryable in case of failures. Ensure that operations can be repeated without causing unintended side effects.