I am trying to get all existing build definitions on a TFS 2015 Update 3 server using the REST API from the Microsoft VSTS SDK as a panel widget:
VSS.init({
explicitNotifyLoaded: true,
usePlatformStyles: true
});
VSS.require("TFS/Dashboards/WidgetHelpers", "TFS/Build/RestClient", "VSS/Authentication/Services"],
function (WidgetHelpers, TFS_Build_Api) {
VSS.register("BuildStatusMonitor.Configuration", function () {
return {
load: function (widgetSettings, widgetConfigurationContext) {
var buildClient = TFS_Build_Api.getClient();
buildClient.getDefinitions().then(function(definition) {
}, function(reason) {
});
},
}
});
VSS.notifyLoadSucceeded();
});
Sorry, I always get
TFS.WebApi.Exception: TF400813: The resource is not available for anonymous access. Client authentication required.
What am I doing wrong?
When I send a receive request to the Chrome Developer Console, I get the correct answer: = /
$. get ("http: // *****: 8080 / tfs / TestReporting / DashboardWidgets / _apis / build / definitions? api-version = 2.2") .success (function (res) {console.log (res)})
source
share