You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何通过Azure DevOps Api 5.1获取指定发布版本的工作项?

First off, the 404 error you’re hitting is because the endpoint https://vsrm.dev.azure.com/mycompany/myproject/_apis/release/releases/myreleaseid/workitems?api-version=5.1 doesn’t exist in API version 5.1. Azure DevOps doesn’t offer a direct endpoint to pull work items linked to a release—you’ll need to go through the release’s artifacts instead. Here are your actionable solutions:

Option 1: Fetch Work Items via Release Artifacts (Custom API Approach)

If you need to build custom notification logic, follow these steps:

  1. Pull the release details first (you already have this working):

    GET https://vsrm.dev.azure.com/mycompany/myproject/_apis/release/releases/myreleaseid?api-version=5.1
    

    In the response, look for the artifacts array. Each entry will have a definitionReference field—for example, if your release uses a build artifact, this will include a buildId value.

  2. Call the matching API based on your artifact type:

    • For build artifacts: Use the build ID to fetch linked work items:
      GET https://dev.azure.com/mycompany/myproject/_apis/build/builds/{buildId}/workitems?api-version=5.1
      
    • For pull request artifacts: Use the repo ID and PR ID to get linked work items:
      GET https://dev.azure.com/mycompany/myproject/_apis/git/repositories/{repoId}/pullRequests/{pullRequestId}/workitems?api-version=5.1
      

Double-check your Personal Access Token (PAT) has these permissions:

  • Release: Read access (to fetch release details)
  • Work Items: Read access (to pull work item data)
  • Build/Git: Read access (depending on your artifact type)

Option 2: Use Azure DevOps Built-In Notifications (Easier, Low-Maintenance)

If your only goal is to notify work item stakeholders when a release completes, skip custom API code entirely. Azure DevOps has built-in tools for this:

  1. Go to your project → Click the gear icon in the top right → Select Notifications
  2. Click New subscription
  3. Under "What event do you want to subscribe to?", pick a release event like Release completed
  4. Add filters to target your specific release pipeline/stage (so you don’t get notifications for every release)
  5. In the "Who should receive the notification?" section, select Work item stakeholders and configure it to target work items linked to the release’s artifacts
  6. Save the subscription—Azure DevOps will automatically send notifications to the right people when the release finishes.

This approach avoids all API troubleshooting and is way less work long-term!


内容的提问来源于stack exchange,提问作者Mathias F

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.07 08:58:10