Security News
PyPI Introduces Digital Attestations to Strengthen Python Package Security
PyPI now supports digital attestations, enhancing security and trust by allowing package maintainers to verify the authenticity of Python packages.
azure-devops-node-api
Advanced tools
The azure-devops-node-api package is a Node.js library that provides an interface to interact with Azure DevOps services. It allows developers to automate and manage various aspects of Azure DevOps, such as work items, builds, releases, and more.
Work Item Tracking
This feature allows you to interact with work items in Azure DevOps. The code sample demonstrates how to retrieve work items by their IDs.
const azdev = require('azure-devops-node-api');
const orgUrl = 'https://dev.azure.com/yourorganization';
const token = 'yourPAT';
const authHandler = azdev.getPersonalAccessTokenHandler(token);
const connection = new azdev.WebApi(orgUrl, authHandler);
async function getWorkItems() {
const witApi = await connection.getWorkItemTrackingApi();
const workItems = await witApi.getWorkItems([1, 2, 3]);
console.log(workItems);
}
getWorkItems();
Build Management
This feature allows you to manage builds in Azure DevOps. The code sample demonstrates how to retrieve a list of builds for a specific project.
const azdev = require('azure-devops-node-api');
const orgUrl = 'https://dev.azure.com/yourorganization';
const token = 'yourPAT';
const authHandler = azdev.getPersonalAccessTokenHandler(token);
const connection = new azdev.WebApi(orgUrl, authHandler);
async function getBuilds() {
const buildApi = await connection.getBuildApi();
const builds = await buildApi.getBuilds('yourProject');
console.log(builds);
}
getBuilds();
Release Management
This feature allows you to manage releases in Azure DevOps. The code sample demonstrates how to retrieve a list of releases for a specific project.
const azdev = require('azure-devops-node-api');
const orgUrl = 'https://dev.azure.com/yourorganization';
const token = 'yourPAT';
const authHandler = azdev.getPersonalAccessTokenHandler(token);
const connection = new azdev.WebApi(orgUrl, authHandler);
async function getReleases() {
const releaseApi = await connection.getReleaseApi();
const releases = await releaseApi.getReleases('yourProject');
console.log(releases);
}
getReleases();
The azure-devops-extension-api package provides APIs for developing extensions for Azure DevOps. It focuses on extending the capabilities of Azure DevOps through custom extensions, whereas azure-devops-node-api is more about automating and managing Azure DevOps services.
The azure-sdk-for-js package is a collection of libraries for interacting with various Azure services. While it includes libraries for Azure DevOps, it is broader in scope and covers many other Azure services, unlike azure-devops-node-api which is specifically focused on Azure DevOps.
Integrate with Azure DevOps from your Node.js apps.
npm install azure-devops-node-api --save
vso-node-api has been renamed and released as azure-devops-node-api
See samples for complete coding examples
npm install azure-devops-node-api --save
import * as azdev from "azure-devops-node-api";
// your collection url
let orgUrl = "https://dev.azure.com/yourorgname";
let token: string = process.env.AZURE_PERSONAL_ACCESS_TOKEN;
let authHandler = azdev.getPersonalAccessTokenHandler(token);
let connection = new azdev.WebApi(orgUrl, authHandler);
Please note that some API's (e.g. ProfileApi) can't be hit at the org level, and has to be hit at the deployment level, so url should be structured like https://vssps.dev.azure.com/{yourorgname}
import * as ba from "azure-devops-node-api/BuildApi";
let build: ba.IBuildApi = await connection.getBuildApi();
These clients are available:
Coding is easy using linear coding with async/await in TypeScript
import * as bi from "azure-devops-node-api/interfaces/BuildInterfaces";
async function run() {
let project: string = "myProject";
let defs: bi.DefinitionReference[] = await build.getDefinitions(project);
defs.forEach((defRef: bi.DefinitionReference) => {
console.log(`${defRef.name} (${defRef.id})`);
});
}
run();
To see what APIs are available, see the appropriate client interface. For example, GitApi.ts
More detailed information for the endpoints of each API can be found at https://docs.microsoft.com/en-us/rest/api/vsts/?view=vsts-rest-4.1
Pre-reqs: Node >= 16 and typescript (tsc) >= 4
Run npm install
first
Set environment variables using set or export:
API_URL=https://dev.azure.com/yourorgname
// use your token
API_TOKEN=cbdeb34vzyuk5l4gxc4qfczn3lko3avfkfqyb47etahq6axpcqha
API_PROJECT=myProject
Run samples:
$ npm run samples
Run a specific sample:
$ npm run samples -- projectAnalysis
v14 and above - [current, maintained] - Supports node 16 and above
v13 and below - End Of Life, for Node < 16, contains security vulnerabilities, use at your own risk
Below you'll find a quick mapping of azure-devops-node-api versions and their corresponding TFS releases. All API versions will work on the TFS version mentioned as well as later TFS versions.
TFS Version | Node API VERSION |
---|---|
Azure DevOps Server vNext | 8.0.0 |
Azure DevOps Server 2019 | 7.0.0 |
TFS 2018 Update 2 | 6.6.2 |
TFS 2017 Update 2 | 6.2.8-preview |
TFS 2017 Update 1 | 5.1.2 |
TFS 2017 RTW | 5.0.0 |
TFS 2015 Update 2 | 0.7.0 |
To contribute to this repository, see the contribution guide
Feel free to file an issue in this repo.
Do you think there might be a security issue? Have you been phished or identified a security vulnerability? Please don't report it here - let us know by sending an email to secure@microsoft.com.
This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.
FAQs
Node client for Azure DevOps and TFS REST APIs
We found that azure-devops-node-api demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 6 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
PyPI now supports digital attestations, enhancing security and trust by allowing package maintainers to verify the authenticity of Python packages.
Security News
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.