1 | [![Build Status](https://dev.azure.com/ms/azure-devops-node-api/_apis/build/status/Microsoft.azure-devops-node-api?branchName=master)](https://dev.azure.com/ms/azure-devops-node-api/_build/latest?definitionId=89&branchName=master)
|
2 |
|
3 | # Azure DevOps Client for Node.js
|
4 |
|
5 | Integrate with Azure DevOps from your Node.js apps.
|
6 |
|
7 | ### Install the library
|
8 | ```
|
9 | npm install azure-devops-node-api --save
|
10 | ```
|
11 |
|
12 | ## News
|
13 |
|
14 | vso-node-api has been renamed and released as azure-devops-node-api
|
15 |
|
16 | ## Get started
|
17 |
|
18 | ### Samples
|
19 |
|
20 | See [samples](./samples) for complete coding examples
|
21 |
|
22 | ### Install the library
|
23 | ```
|
24 | npm install azure-devops-node-api --save
|
25 | ```
|
26 |
|
27 | ![Intellisense](docs/intellisense.png)
|
28 |
|
29 | ### Create a connection
|
30 | ```javascript
|
31 | import * as azdev from "azure-devops-node-api";
|
32 |
|
33 | // your collection url
|
34 | let orgUrl = "https://dev.azure.com/yourorgname";
|
35 |
|
36 | let token: string = process.env.AZURE_PERSONAL_ACCESS_TOKEN;
|
37 |
|
38 | let authHandler = azdev.getPersonalAccessTokenHandler(token);
|
39 | let connection = new azdev.WebApi(orgUrl, authHandler);
|
40 | ```
|
41 |
|
42 | > 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,
|
43 | so url should be structured like https://**vssps**.dev.azure.com/{yourorgname}
|
44 |
|
45 | ### Get an instance of a client
|
46 |
|
47 | ```javascript
|
48 | import * as ba from "azure-devops-node-api/BuildApi";
|
49 |
|
50 | let build: ba.IBuildApi = await connection.getBuildApi();
|
51 | ```
|
52 |
|
53 | #### Available clients
|
54 |
|
55 | These clients are available:
|
56 |
|
57 | * Advanced Security Alert
|
58 | * Advanced Security Management
|
59 | * Build
|
60 | * Core
|
61 | * Dashboard
|
62 | * ExtensionManagement
|
63 | * FeatureManagement
|
64 | * FileContainer
|
65 | * Git
|
66 | * Locations
|
67 | * Notification
|
68 | * Policy
|
69 | * Profile
|
70 | * ProjectAnalysis
|
71 | * Release
|
72 | * SecurityRoles
|
73 | * TaskAgent
|
74 | * Task
|
75 | * Test
|
76 | * TestPlan
|
77 | * TestResults
|
78 | * Tfvc
|
79 | * Wiki
|
80 | * Work
|
81 | * WorkItemTracking
|
82 | * WorkItemTrackingProcess
|
83 | * WorkItemTrackingProcessDefinitions
|
84 |
|
85 | ### Use the client
|
86 |
|
87 | Coding is easy using linear coding with async/await in TypeScript
|
88 |
|
89 | ```javascript
|
90 | import * as bi from "azure-devops-node-api/interfaces/BuildInterfaces";
|
91 |
|
92 | async function run() {
|
93 | let project: string = "myProject";
|
94 | let defs: bi.DefinitionReference[] = await build.getDefinitions(project);
|
95 |
|
96 | defs.forEach((defRef: bi.DefinitionReference) => {
|
97 | console.log(`${defRef.name} (${defRef.id})`);
|
98 | });
|
99 | }
|
100 |
|
101 | run();
|
102 | ```
|
103 |
|
104 | ## APIs
|
105 |
|
106 | To see what APIs are available, see the appropriate client interface. For example, [GitApi.ts](https://github.com/Microsoft/azure-devops-node-api/blob/master/api/GitApi.ts)
|
107 |
|
108 | 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
|
109 |
|
110 | ## Running Samples
|
111 |
|
112 | Pre-reqs: [Node >= 16](https://nodejs.org) and [typescript (tsc) >= 4](https://www.npmjs.com/package/typescript)
|
113 |
|
114 | Run `npm install` first
|
115 |
|
116 | Set environment variables using set or export:
|
117 |
|
118 | ```bash
|
119 | API_URL=https://dev.azure.com/yourorgname
|
120 |
|
121 | // use your token
|
122 | API_TOKEN=cbdeb34vzyuk5l4gxc4qfczn3lko3avfkfqyb47etahq6axpcqha
|
123 |
|
124 | API_PROJECT=myProject
|
125 | ```
|
126 |
|
127 | Run samples:
|
128 |
|
129 | ```bash
|
130 | $ npm run samples
|
131 | ```
|
132 |
|
133 | Run a specific sample:
|
134 |
|
135 | ```bash
|
136 | $ npm run samples -- projectAnalysis
|
137 | ```
|
138 |
|
139 | ## Node support
|
140 | v14 and above - [current, maintained] - Supports node 16 and above
|
141 |
|
142 | v13 and below - End Of Life, for Node < 16, contains security vulnerabilities, use at your own risk
|
143 |
|
144 | ## API and TFS Mapping
|
145 |
|
146 | 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.
|
147 |
|
148 | |**TFS Version** | **Node API VERSION**|
|
149 | |-------------------|------------------|
|
150 | |Azure DevOps Server vNext | 8.0.0|
|
151 | |Azure DevOps Server 2019 | 7.0.0|
|
152 | |TFS 2018 Update 2 | 6.6.2|
|
153 | |TFS 2017 Update 2 | 6.2.8-preview|
|
154 | |TFS 2017 Update 1 | 5.1.2|
|
155 | |TFS 2017 RTW | 5.0.0|
|
156 | |TFS 2015 Update 2 | 0.7.0|
|
157 |
|
158 | ## Contributing
|
159 |
|
160 | To contribute to this repository, see the [contribution guide](./CONTRIBUTING.md)
|
161 |
|
162 | ## Issues
|
163 |
|
164 | Feel free to file an issue in this repo.
|
165 |
|
166 | 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.
|
167 |
|
168 | ## Code of Conduct
|
169 |
|
170 | This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.
|
171 |
|
\ | No newline at end of file |