I'm trying to get all existing build definitions on a TFS 2015 Update 3 server using the REST API from Microsofts VSTS SDK in a dashboard 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) {
// 401
});
},
}
});
VSS.notifyLoadSucceeded();
});
Unfortunately I always get a
TFS.WebApi.Exception: TF400813: Resource not available for anonymous access. Client authentication required.
What am I doing wrong?
When I am sending a get request on chromes developer console, I get the correct response: =/
$.get("http://*****:8080/tfs/TestReporting/DashboardWidgets/_apis/build/definitions?api-version=2.2").success(function(res) { console.log(res) })