The `azure-devops-node-api` package provides a robust and officially supported Node.js client for programmatically interacting with Azure DevOps Services and on-premises Team Foundation Server (TFS) REST APIs. It offers strongly typed interfaces for various services including Git, Build, Release, Work Items, and more, simplifying authentication and API calls compared to direct HTTP requests. The current stable version is 15.1.2, requiring Node.js >= 16.0.0. The library's release cadence is generally aligned with major Azure DevOps and TFS server updates, with significant version increments often indicating breaking changes tied to server compatibility and new features. Its key differentiator is providing a comprehensive, type-safe wrapper over the Azure DevOps REST APIs, making development more efficient and less error-prone.
npm install azure-devops-node-apiVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to authenticate with Azure DevOps using a Personal Access Token (PAT), establish a connection, obtain a `BuildApi` client, and list the most recent builds for a specified project.
Review the package's GitHub releases or npm history for specific version compatibility notes. Test upgrades thoroughly in non-production environments. Pay close attention to changes in API client instantiation or method signatures.
Verify the PAT's scopes in Azure DevOps User Settings -> Personal Access Tokens. Regenerate the PAT if expired or if scopes are insufficient. Test PAT validity using a simple API call.
Check the `npm` package page or GitHub releases for explicit minimum TFS/Azure DevOps Server version compatibility for your specific client library version. Downgrade `azure-devops-node-api` if necessary to match your server's version.
Ensure your `tsconfig.json` (for TypeScript) or `package.json` (`"type": "module"`) is correctly configured for your chosen module system. Use `import ... from 'package';` syntax where possible. If encountering issues, try `import * as azdev from 'azure-devops-node-api';` or consult Node.js module documentation.
Double-check the project name, repository ID, or other resource identifiers for typos. Ensure the PAT has sufficient permissions (e.g., 'Project and Team: Read', 'Code: Read'). Verify the organization URL is correct.
Generate a new PAT in Azure DevOps User Settings with the required scopes. Update the PAT in your application configuration. Ensure the organization URL is correct and accessible.
Ensure you have successfully called `connection.getBuildApi()` (or similar for other APIs) and stored its result in a variable before attempting to call methods on it. Add `await` if `getBuildApi()` is an async call.
Verify your internet connection and DNS settings. Double-check the Azure DevOps organization URL for typos. If behind a proxy, ensure Node.js is configured to use it (e.g., via `HTTPS_PROXY` environment variable).
No dependency data recorded yet.