Azure DevOps Client for Node.js
Перейти к файлу
dependabot[bot] faa68c4d2f
Bump minimist and mocha
Bumps [minimist](https://github.com/minimistjs/minimist) to 1.2.8 and updates ancestor dependency [mocha](https://github.com/mochajs/mocha). These dependencies need to be updated together.


Updates `minimist` from 1.2.5 to 1.2.8
- [Release notes](https://github.com/minimistjs/minimist/releases)
- [Changelog](https://github.com/minimistjs/minimist/blob/main/CHANGELOG.md)
- [Commits](https://github.com/minimistjs/minimist/compare/v1.2.5...v1.2.8)

Updates `mocha` from 3.5.3 to 10.2.0
- [Release notes](https://github.com/mochajs/mocha/releases)
- [Changelog](https://github.com/mochajs/mocha/blob/master/CHANGELOG.md)
- [Commits](https://github.com/mochajs/mocha/compare/v3.5.3...v10.2.0)

---
updated-dependencies:
- dependency-name: minimist
  dependency-type: indirect
- dependency-name: mocha
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-03-02 08:15:28 +00:00
.github Add codeownerrs (#513) 2022-08-23 11:13:44 +03:00
api M216 API updates (#539) 2023-01-18 13:36:29 +04:00
docs new img 2016-07-27 23:22:43 -04:00
samples M216 API updates (#539) 2023-01-18 13:36:29 +04:00
test M216 API updates (#539) 2023-01-18 13:36:29 +04:00
.gitignore Allow cross domain authorization by default and add unit tests (#427) 2021-01-12 12:35:54 +03:00
CONTRIBUTING.md update typed-rest-client to 1.7.2 (#375) 2020-02-27 11:01:31 -05:00
LICENSE Add NTLM support (#43) 2016-07-06 09:54:51 -04:00
README.md Add info about ProfileApi (#461) 2021-08-09 03:02:08 -07:00
SECURITY.md Microsoft mandatory file (#507) 2022-07-20 18:16:36 +04:00
ThirdPartyNotice.txt Add third party notice and copy files to _build. (#161) 2018-03-23 13:59:26 -04:00
azure-pipelines.yml Update library to support Node 16 (#509) 2022-07-19 17:12:17 +04:00
generate-third-party-notice.js Add third party notice and copy files to _build. (#161) 2018-03-23 13:59:26 -04:00
issue_template.md Update issue_template.md 2018-10-23 09:02:13 -04:00
make.js Add node versions 6, 10 and 14 to the unit tests (#465) 2021-09-13 10:39:12 +03:00
package-lock.json Bump minimist and mocha 2023-03-02 08:15:28 +00:00
package.json Bump minimist and mocha 2023-03-02 08:15:28 +00:00
tsconfig.json Cleanup work. (#154) 2018-03-26 11:10:39 -04:00

README.md

Build Status

Azure DevOps Client for Node.js

Integrate with Azure DevOps from your Node.js apps.

Install the library

npm install azure-devops-node-api --save

News

vso-node-api has been renamed and released as azure-devops-node-api

Get started

Samples

See samples for complete coding examples

Install the library

npm install azure-devops-node-api --save

Intellisense

Create a connection

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}

Get an instance of a client

import * as ba from "azure-devops-node-api/BuildApi";

let build: ba.IBuildApi = await connection.getBuildApi();

Available clients

These clients are available:

  • Build
  • Core
  • Dashboard
  • ExtensionManagement
  • FeatureManagement
  • FileContainer
  • Git
  • Locations
  • Notification
  • Policy
  • Profile
  • ProjectAnalysis
  • Release
  • SecurityRoles
  • TaskAgent
  • Task
  • Test
  • Tfvc
  • Wiki
  • Work
  • WorkItemTracking
  • WorkItemTrackingProcess
  • WorkItemTrackingProcessDefinitions

Use the client

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();

APIs

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

Running Samples

Pre-reqs: Node >= 4.4.7 LTS and typescript (tsc) >= 1.8

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

API and TFS Mapping

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

Contributing

To contribute to this repository, see the contribution guide

Issues

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.

Code of Conduct

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.