Azure DevOps Node API Reference

Navigation: Home > API Reference

Welcome to the Azure DevOps Node API reference documentation. This documentation provides detailed information about the classes, methods, and interfaces available in the Azure DevOps Node API.

Class Description
WorkItemTrackingApi Work with work items, queries, and work item types
BuildApi Manage builds and build definitions
GitApi Work with Git repositories, pull requests, and commits
CoreApi Access projects, teams, and process templates
ReleaseApi Manage release definitions and deployments
TaskAgentApi Work with agent pools and task groups
TestApi Manage test plans, test suites, and test cases
WikiApi Work with wikis and wiki pages

To use the Azure DevOps Node API, you need to:

  1. Install the package:

    npm install azure-devops-node-api
    
  2. Create a connection to Azure DevOps:

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

    // Create a connection to Azure DevOps
    const orgUrl = "https://dev.azure.com/myorganization";
    const token = "YOUR_PERSONAL_ACCESS_TOKEN";
    const authHandler = azdev.getPersonalAccessTokenHandler(token);
    const connection = new azdev.WebApi(orgUrl, authHandler);
  3. Get the API client you need:

    // Get the WorkItemTrackingApi instance
    const workItemTrackingApi = await connection.getWorkItemTrackingApi();
  4. Use the API client to interact with Azure DevOps:

    // Get a work item
    const workItem = await workItemTrackingApi.getWorkItem(42);
    console.log(`Work Item ${workItem.id}: ${workItem.fields["System.Title"]}`);

The Azure DevOps Node API supports several authentication methods:

const token = "YOUR_PERSONAL_ACCESS_TOKEN";
const authHandler = azdev.getPersonalAccessTokenHandler(token);
const connection = new azdev.WebApi(orgUrl, authHandler);
const username = "username";
const password = "password";
const authHandler = azdev.getBasicHandler(username, password);
const connection = new azdev.WebApi(orgUrl, authHandler);
const token = "YOUR_BEARER_TOKEN";
const authHandler = azdev.getBearerHandler(token);
const connection = new azdev.WebApi(orgUrl, authHandler);

The Azure DevOps Node API is organized into several API clients, each focused on a specific area of Azure DevOps:

  • WorkItemTrackingApi: Work with work items, queries, and work item types
  • BuildApi: Manage builds and build definitions
  • GitApi: Work with Git repositories, pull requests, and commits
  • CoreApi: Access projects, teams, and process templates
  • ReleaseApi: Manage release definitions and deployments
  • TaskAgentApi: Work with agent pools and task groups
  • TestApi: Manage test plans, test suites, and test cases
  • WikiApi: Work with wikis and wiki pages

Each API client provides methods for interacting with the corresponding Azure DevOps service.

While each API client can be used independently, many real-world scenarios require combining multiple APIs. The Integration Patterns documentation provides guidance on how to effectively combine multiple Azure DevOps APIs to solve common real-world scenarios.

Key integration patterns include:

To understand how different API clients and methods relate to each other, refer to the API Cross-Reference Table. This table shows which methods are commonly used together and which integration patterns they support.

The API Priority Matrix provides a strategic view of the most important methods within each API client, along with common use cases and complexity ratings. Use this matrix to focus your learning and implementation efforts on the most impactful functionality.