Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error when attempting to create VSTS API Service Hook Subscription

Everyone,

I have been around and around about creating Visual Studio Team Services - Service Hook Subscriptions automagically via API. I can get the TFS publisher to work, but not the RM publisher. I am trying to create a hook subscription for Release Deployment Completed. Any examples I can find simply don't work even when swapped with my data. TFS provider works perfecty. Sample with response... POST https://project.visualstudio.com/_apis/hooks/subscriptions?api-version=4.1-preview

Body:

{
  "publisherId": "rm",
  "eventType": "ms.vss-release.deployment-completed-event",
  "consumerId": "slack",
  "consumerActionId": "postMessageToChannel",
  "publisherInputs": {
    "releaseEnvironmentId" : "777",
    "releaseDefinitionId" : "1",
    "releaseEnvironmentStatus" : "4",
    "projectId" : "6ce954b1-ce1f-45d1-b94d-e6bf2464ba2c"
  },
  "consumerInputs": {
    "url": "https://hooks.slack.com/services/myservice/crazyGuidxxxxxxxxxxxxxxxx"
  }
}

Response:

{
    "$id": "1",
    "innerException": null,
    "message": "There is no registered handler for the service hooks event type ms.vss-release.deployment-completed-event.",
    "typeName": "System.InvalidOperationException, mscorlib",
    "typeKey": "InvalidOperationException",
    "errorCode": 0,
    "eventId": 0
}
like image 308
KingAmongGeeks Avatar asked Nov 28 '25 18:11

KingAmongGeeks


1 Answers

It's because you missed vsrm in your url for a release. Use the following api and you'll get a successful response:

POST https://project.vsrm.visualstudio.com/_apis/hooks/subscriptions?api-version=4.1-preview
like image 130
Cece Dong - MSFT Avatar answered Nov 30 '25 10:11

Cece Dong - MSFT