简体   繁体   English

使用 Azure DevOps API 共享一个拉取请求

[英]Using Azure DevOps API to share a pull request

I would like to be able to use the Azure DevOps API to send emails about certain pull requests.我希望能够使用 Azure DevOps API 发送有关某些拉取请求的电子邮件。

I am looking at this page as a reference: https://docs.microsoft.com/en-us/rest/api/azure/devops/git/pull%20request%20share/share%20pull%20request?view=azure-devops-rest-6.0我正在查看此页面作为参考: https://docs.microsoft.com/en-us/rest/api/azure/devops/git/pull%20request%20share/share%20pull%20request?view=azure- devops-rest-6.0

I am not sure how the body of the POST should be formatted, especially the "IdentityRef" entry.我不确定 POST 的正文应该如何格式化,尤其是“IdentityRef”条目。 How do I get this IdentityRef for individual users?如何为个人用户获取此 IdentityRef?

The request body format is like this请求正文格式是这样的

{
  "message": "xxx",
  "receivers": [
    {
      "id": "xxx"
    }
  ]
}

If you want to share the pull request with individual user, you could get the user ID via this REST API如果您想与单个用户共享拉取请求,您可以通过此REST API获取用户 ID

GET https://vsaex.dev.azure.com/{organization}/_apis/userentitlements?api-version=6.0-preview.3

Result:结果:

在此处输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM