Registry / devops / azure-devops-extension-api

azure-devops-extension-api

JSON →
library5.272.3jsnpmunverified

Azure DevOps Extension API provides REST client libraries and TypeScript contracts for building Azure DevOps web extensions. It ships auto-generated, thin clients for each API area (Git, Build, WorkItemTracking, etc.) with subpath imports enabling tree-shaking. Current stable version is 5.272.3, released in a dual CJS/ESM module format (since v5). AMD format was removed in v5; consumers relying on AMD should pin to v4. Peer dependency on azure-devops-extension-sdk (^2 || ^3 || ^4) is required for authentication and host interaction. Releases follow Azure DevOps API updates, with frequent minor version bumps. Key differentiator: official Microsoft-authored library, closely mirrors Azure DevOps REST API, and provides TypeScript types for all endpoints.

npm install azure-devops-extension-api
INSTALL
IMPORT
SIG · AZURE-DEVOPS-EXTEN
A
azure-devops-extension-api
devopsjavascriptv5.272.3
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

GitRestClient
import { GitRestClient } from 'azure-devops-extension-api/Git'
import { GitRestClient } from 'azure-devops-extension-api'
Subpath imports (e.g., /Git) enable tree-shaking. Importing from root may include all areas.
getClient
import { getClient } from 'azure-devops-extension-api'
const getClient = require('azure-devops-extension-api').getClient
Named import from root. Correct for both ESM (ES module) and CJS (CommonJS) contexts.
WorkItemTrackingRestClient
import { WorkItemTrackingRestClient } from 'azure-devops-extension-api/WorkItemTracking'
import WorkItemTrackingRestClient from 'azure-devops-extension-api/WorkItemTracking'
Named export, not default. TypeScript types are included.

Initializes the Azure DevOps SDK, creates a Git REST client, and fetches repositories for a project.

import { getClient } from 'azure-devops-extension-api'; import { GitRestClient } from 'azure-devops-extension-api/Git'; import * as SDK from 'azure-devops-extension-sdk'; // Initialize the SDK (required) SDK.init(); // Get the Git client const gitClient = getClient(GitRestClient); // Example: get repositories async function listRepos() { const repos = await gitClient.getRepositories('MyProject'); console.log(repos); } // Call after SDK is ready SDK.ready().then(() => listRepos());
Debug
Known issues
breakingAMD module format removed in v5; consumers relying on AMD must pin to v4
fix
Pin to azure-devops-extension-api@4 or migrate to CommonJS/ESM
affects: >=5.0.0
breakingSubpath imports require conditional exports support (Node 12+, bundlers) — older bundlers may need explicit .cjs or .mjs extensions
fix
If using webpack < 5, ensure resolve.conditionNames includes 'require' or 'import'
affects: >=5.0.0
deprecatedImporting from root (e.g., 'azure-devops-extension-api') without subpath imports all API areas, increasing bundle size
fix
Use subpath imports like 'azure-devops-extension-api/Git' to enable tree-shaking
affects: >=1.0.0
gotchaThe SDK peer dependency must be initialized before using any REST client
fix
Call SDK.init() and SDK.ready() before getClient()
affects: >=1.0.0
Errors
Common errors & fixes
Cannot find module 'azure-devops-extension-api/Git' or its corresponding type declarations.
Using older module resolution that doesn't support subpath exports (e.g., tsconfig 'moduleResolution' set to 'node' instead of 'node16' or 'bundler')
fix
Update tsconfig.json: set 'moduleResolution' to 'node16' or 'bundler' (or use 'esModuleInterop')
Uncaught (in promise) Error: [azure-devops-extension-sdk] SDK not initialized
REST client used before SDK.init() or SDK.ready() completes
fix
Ensure SDK.init() is called first and SDK.ready() promise is awaited before calling getClient()
require() of ES Module not supported
Using CommonJS require with ESM-only subpath imports (older Node versions or bundlers)
fix
Use dynamic import() in CJS, or upgrade to Node 12+ with 'type':'module'
Upgrade
Version history
5.272.3latest on npm
Audit
Dependencies
azure-devops-extension-sdkrequiredRequired for authentication and interaction with Azure DevOps host page
Agent activity
12 hits · last 30 days
node
8
OpenAI (training)
2
Amazon
1
Resources
azure-devops-extension-api — npm install azure-devops-extension-api · libregistry