我正在尝试按名称解析特定的 VSTS 组以检索 identityDescriptor 属性。我想利用支持的查询参数,而不是查询所有组和过滤器。查看VSTS Groups - List API,它支持附加查询参数 scopeDescriptor 和 subjectType。但是,我一直为这些参数提供错误的值。
但是,当我指定这些的任何组合时,我得到 0 个结果。此外,一旦我添加了 scopeDescriptor,我就会遇到 Microsoft.VisualStudio.Services.Graph.InvalidSubjectTypeException -> HTTP 400 Bad Request。
问题:
编辑 1 subjectTypes 不是实际类型,而是主题描述符前缀的子类型。例如 -> vssgp,aadgp:
"subjectDescriptor": "vssgp.Dc0NDgzLTzQ1NwOTI5LTI0NTcwNDLTAtMwUy0xLTktMTAtMC0wMjgxNjcxNDU0OS0zMU1MTM3NDI0NS0yMjUzNzA0ODMtE"
Run Code Online (Sandbox Code Playgroud)
示例查询网址:
- Working:
https://{account}.vssps.visualstudio.com/_apis/graph/groups?api-version=4.1-preview.1
- Working subjectTypes:
https://{account}.vssps.visualstudio.com/_apis/graph/groups?subjectTypes=vssgp&api-version=4.1-preview.1
- scopeDescriptor throws:
https://{account}.vssps.visualstudio.com/_apis/graph/groups?scopeDescriptor=collection&api-version=4.1-preview.1
https://{account}.vssps.visualstudio.com/_apis/graph/groups?scopeDescriptor=collection&subjectTypes=Microsoft.TeamFoundation.Identity&api-version=4.1-preview.1
Run Code Online (Sandbox Code Playgroud)