从 azure devops 获取所有设置

Getting all settings from azure devops

开发人员创建了一个插件,其中 devops 中的每个任务都有一组复选框,需要在关闭任务之前选择这些复选框。我们已被重定向到这篇文章,了解它是如何实现的:

https://docs.microsoft.com/en-us/azure/devops/extend/develop/data-storage?view=azure-devops

我正在尝试将所有值导入我们拥有的另一个系统中,以便我们可以监控已选中的复选框数量。

当我调用它时,我可以在列表中找到分机: https://extmgmt.dev.azure.com/xxx/_apis/extensionmanagement/installedextensions?api-version=5.1-preview.1

但我需要找到所有数据。我在文档中找不到任何关于如何通过 REST API 获取数据的内容。我可以看到您可以存储简单和复杂的数据类型。你可以通过 javascript 获得一个单一的价值。但是如何从 REST API 中获取所有值?

文档 How settings are stored 说设置在内部存储为文档。并且集合名称始终是特殊名称“$settings”,同时将设置存储为文档。

所以您可以尝试使用特殊集合$settings下的获取所有文档方法获取所有设置。

 VSS.getService(VSS.ServiceIds.ExtensionData).then(function(dataService) {
        // Get all document under the collection
        dataService.getDocuments("$settings").then(function(docs) {
            console.log("There are " + docs.length + " in the collection.");
        });
    });

您也可以尝试以下 api:

GET _apis/ExtensionManagement/InstalledExtensions/{publisherName}/{extensionName}/Data/Scopes/User/Me/Collections/%24settings/Documents