Skip to content

Vso WebHook Apis

suwatch01 edited this page Oct 20, 2015 · 2 revisions
  • List all hooks
ARMClient.exe get "https://%vsoaccountname%.visualstudio.com/DefaultCollection/_apis/hooks/subscriptions?api-version=1.0"

Note: vsoaccountname is from account's accountName.

  • Get hook
ARMClient.exe get "https://%vsoaccountname%.visualstudio.com//DefaultCollection/_apis/hooks/subscriptions/%vsohookid%?api-version=1.0"
  • Add hook
ARMClient.exe post "https://%vsoaccountname%.visualstudio.com/DefaultCollection/_apis/hooks/subscriptions?api-version=1.0" @hook.json

Note: to test E2E hook with SCM site, make sure you add Site AppSetting's RepoUrl with value from Repository'sremoteUrl.

Sample hook.json

{
  "consumerActionId": "deployWebApp",
  "consumerId": "azureAppService",
  "consumerInputs": {
    "basicAuthUsername": "$mysite",
    "url": "https://mysite.scm.azurewebsites.net/deploy?scmType=vso",
    "basicAuthPassword": "password"
  },
  "publisherId": "tfs",
  "eventType": "git.push",
  "publisherInputs": {
    "branch": "master",
    "projectId": "{vsoprojectid}",
    "repository": "{vsorepositoryid}"
  }
}

Note: vsoprojectid and vsorepositoryid are Repository's api.

  • Test hook
ARMClient.exe post "https://%vsoaccountname%.visualstudio.com/DefaultCollection/_apis/hooks/testNotifications?api-version=1.0" @testhook.json

Sample testhook.json

{
  "subscriptionId": "{vsohooksubscriptionid}",
  "details": {
    "consumerActionId": "deployWebApp",
    "consumerId": "azureAppService",
    "consumerInputs": {
      "basicAuthUsername": "$mysite",
      "url": "https://mysite.scm.azurewebsites.net/deploy?scmType=vso",
      "basicAuthPassword": "password"
    },
    "publisherId": "tfs",
    "eventType": "git.push"
  }
}
  • Delete hook
ARMClient.exe delete "https://%vsoaccountname%.visualstudio.com//DefaultCollection/_apis/hooks/subscriptions/%vsohookid%?api-version=1.0"
Clone this wiki locally