Search code examples
tfstfs-2015tfs-sdkms-release-management

TFS: PublisherNotFoundException when trying to create a subscription for "rm"


On-premises TFS 2015 u2. I want to create an HTTP service hook subscription for a release creation event. As directed here and here, I'm sending a POST request to

http://tfs.mycompany.com:8080/tfs/MyCollection/_apis/hooks/subscriptions?api-version=1.0

with the following JSON:

{
"publisherId": "rm",
"eventType": "ms.vss-release.release-created-event",
"resourceVersion": "1.0-preview.1",
"consumerId": "webHooks",
"consumerActionId": "httpRequest",
"publisherInputs": 
{
    "projectId": "aaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee"
},
"consumerInputs":
{
    "url": "http://someserver/somefolder/"
}
}

I get back the following error message:

{
"innerException": null,
"message": "No publisher could be found with id \"rm\".",
"typeName": "Microsoft.VisualStudio.Services.ServiceHooks.WebApi.PublisherNotFoundException, Microsoft.VisualStudio.Services.ServiceHooks.WebApi, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a",
"typeKey": "PublisherNotFoundException",
"errorCode": 0,
"eventId": 4501
}

And indeed, if you request a list of publishers, there's only one, with ID "tfs". There's no "rm" publisher there. Requesting the same subscription from the "tfs" publisher yields an "unknown event" error.

Do I have to enable that publisher somehow? Is it supported in on-prem TFS? If so, since which version?

Would it hurt Microsoft to annotate their TFS REST API docs with supported versions, like the rest of their API docs do?


Solution

  • A publisher is a service that publishes events to service hooks. In TFS 2015 update2, if you request a list of publishers, you will not get publish ID with "rm". It's not support for TFS2015 for now.

    Moreover, actually the resource version for rm should be 3.0

    "resourceVersion": "3.0-preview.1",