访问Azure Devops中的消息主体运行API

发布于 2025-01-30 01:19:39 字数 717 浏览 4 评论 0原文

我正在尝试使用HTTP请求触发我的Azure管道。我正在使用Azure Devops提供的运行API来执行此操作, https://learn.microsoft.com/en-us/rest/rest/api/azure/devops/pipelines/runs/run-pipeline?view = azure-devops-rest-6.0

我希望能有能力在我的管道中,访问发送的消息正文以及邮政请求。

我知道可以执行以下操作,

将参数添加到我的管道中,类似于下面显示的内容,

parameters:
   - name: id
     type: string

请将我的请求的消息正文发送到templateParameters中的运行API,以便能够访问值为参数。

我面临的问题是,我的管道实际上将由网络钩触发,因此,我无法控制消息主体的结构。我无法将数据放入templateParameters以通过参数可以访问的值。

还有其他方法可以访问消息主体的值吗?我的问题还有其他解决方案吗?

I am trying to trigger my Azure Pipeline using an HTTP request. I am doing this using the Runs API provided by Azure DevOps,
https://learn.microsoft.com/en-us/rest/api/azure/devops/pipelines/runs/run-pipeline?view=azure-devops-rest-6.0

I want to be able to access the message body sent along with the POST request, within my pipeline.

I know that it is possible to do the following,

Add parameters to my pipeline similar to what has been shown below,

parameters:
   - name: id
     type: string

Send the message body of my request to the Runs API within templateParameters to be able to access the values as parameters.

The issue that I am facing is, my pipeline will actually be triggered by a Webhook and as a result, I don't have control over the structure of the message body. I cannot put the data within templateParameters for the values to be accessible through the parameters.

Is there any other way that I can access the values of the message body? Is there some other solution to my problem?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

茶花眉 2025-02-06 01:19:39

如@Thomas所述,发送请求的正文将需要在DevOps API中定义,因此,我必须使用Azure函数作为中介机构来获取我的初始请求,将其放入templateParameters 并将其重新列为Azure DevOps。

As @Thomas mentioned, the body of the request sent will need to be as defined in the DevOps API, therefore, I had to use an Azure Function as an intermediary to take my initial request, put it inside of templateParameters and re-route it to Azure DevOps.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文