Friday, May 31, 2019

Let me know, TFS

Today's obscure corner of the TFS REST API to explore would be - notifications. Some time ago, I've noticed that SOAP is no longer an option on the collection-level Notifications screen, but it's supported internally. If it's supported internally, then it must be supported by the API. Indeed it is, there's a REST API endpoint for subscription creation, and one of the parameters is called "channel", and it's supposed to be an instance of ISubscriptionChannel. That's where the docs go blank, except mentioning that it has a type property.



Pulling up a record for a legacy SOAP notification that existed since TFS2017, one can see an instance of the SOAP-type channel object; it goes:

"channel":
{
    "type": "Soap",
    "address": "http://www.acme.com/tfsutil/boo.svc",
    "useCustomAddress": true
}

So there's definitely more to the channel object than the type property. Good job documenting the REST endpoint, Microsoft.

Here's where we fall back to the C# API. Turns out, ISubscriptionChannel is a C# interface in the Microsoft.VisualStudio.Services.Notifications.WebApi namespace, and it is implemented by the following documented concrete classes:

  • BlockSubscriptionChannel ("Block")
  • MessageQueueSubscriptionChannel ("MessageQueue")
  • ServiceBusSubscriptionChannel ("ServiceBus")
  • ServiceHooksSubscriptionChannel ("ServiceHooks")
  • UnsupportedSubscriptionChannel (no set type)
  • EmailHtmlSubscriptionChannel ("EmailHtml")
  • EmailPlaintextSubscriptionChannel ("EmailPlaintext")
  • GroupSubscriptionChannel ("Group")
  • SoapSubscriptionChannel ("Soap")
  • UserSubscriptionChannel ("User")
  • UserSystemSubscriptionChannel ("UserSystem")

The latter 6 have, in addition to Type, two more properties: string Address and boolean UseCustomAddress. The first 5 have no parameters. I'm not sure how/if they work at all.

No comments:

Post a Comment