0
votes

I'm quite new to Azure DevOps Rest API but until now I've managed to create service hooks subscriptions using it. The problem is that my initial goal was to create a single subscription that responds to multiple or any event type. Here is what I have until now, which works fine:

{
  "publisherId": "tfs",
  "eventType": "git.push",
  "consumerId": "webHooks",
  "consumerActionId": "httpRequest",
  "consumerInputs": {
    "url": "my_url"
  }
}

This is just a simple POST request at https://dev.azure.com/{my_organization}/_apis/hooks/subscriptions. I was wondering if there is any way to create webHooks subscriptions that listen to any eventType from any publisherId (by supplying a null value to the publisherId/eventType for instance). Or is there any other way I can create a webHook for multiple events? I've tried passing an array of events to the eventType but this fails as eventType must be a String as the documentation says: https://docs.microsoft.com/en-us/rest/api/azure/devops/hooks/subscriptions/create?view=azure-devops-rest-5.0

1
How about the issue? Does the answer below resolved your question? If not, would you please let me know the latest information about this issue? If the answer could help, would you please accept it as the answer? So it could help other community members who get the same issues and we could archive this thread. Thanks. Have a nice day. :)Vito Liu

1 Answers

1
votes

It seems that you want to create one webhook and listen to all eventType, we cannot do this. You could refer to this doc to check all support event types.

Since the field eventType type is String instead of Array, we could only create one eventType for one request, it is same as create webhook in the UI, If you want to receive all the eventType message, we recommend that you create multiple webhooks.