访问Azure Devops中的消息主体运行API
我正在尝试使用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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如@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.