获取TFS Webhook订阅状态 [英] Get TFS Webhook SubscriptionStatus

查看:105
本文介绍了获取TFS Webhook订阅状态的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

来自我之前的问题

From my previous question link here it appears that we do not have a feature in any version of TFS/Azure DevOps to setup monitoring for the webhook subscriptions.

作为一种解决方法,我现在正在寻找编写PowerShell脚本来检查订阅的心跳的方法.从Microsoft文档链接,看来我们可以通过查询订阅ID来获取SubscriptionStatus.

As a workaround I'm now looking to write a PowerShell script to check the heartbeat of the subscription. From the Microsoft documentation link here it appears we can get the SubscriptionStatus by querying the subscription ID.

在以下API的GET请求中,我收到了文档中指定的所有详细信息,但在响应中找不到状态". 有人知道是否还有其他方法可以获取SubscriptionStatus.

On a GET request for below API I receive all the details specified in the documentation but I'm unable to find "status" in the response. Does anybody know if there is any other way to get the SubscriptionStatus.

https://collectionurl/_apis/hooks/subscriptions/3d9af4ba -d642-4c80-8d62-34cabca322f9

推荐答案

我发现我所讨论的API是正确的,但是由于某种原因我没有获得启用"状态,因此我成功测试了提到的所有其他状态这里.

I found that my API in question is correct, but for some reason i'm not getting 'enabled' status, I tested successfully for all other status mentioned here.

我现在正在设置PowerShell以每5分钟执行一次,以检查webhook的状态并发送电子邮件以获取除已启用"以外的其他状态.

I'm now setting up my PowerShell to execute every 5mins to check the webhook for its status and send an email for any other status than 'enabled'.

如果状态为已启用"或空",则进一步检查consumerInputs.url以检查网络钩是否仍在运行.

If the status is 'enabled' or 'empty' I further check consumerInputs.url to check if the webhook is alive.

这很好用.

这篇关于获取TFS Webhook订阅状态的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆