我正在尝试从我们的 Atlassian Confluence/Jira 实例中提取用户列表。但是,我很难找到有关可用 REST 服务的良好文档,而且似乎不推荐使用 SOAP 服务。
下面的代码确实得到了结果,但是我们有超过 100 个用户,这会返回 0。
if(-not ($credentials)) { #put this here so I can rerun the same script in the same IDE session without having to reinput credentials each time
$credentials = get-credential 'myAtlassianUsername'
}
$tenant = 'myCompany'
invoke-restmethod -Method Get -Uri ('https://{0}.atlassian.net/rest/api/2/groupuserpicker?query=users' -f $tenant) -Credential $credentials | ConvertTo-Json -Depth 5
(这ConvertTo-Json
只是为了更简单地查看扩展的结果集)。
{
"users": {
"users": [
],
"total": 0,
"header": "Showing 0 of 0 matching users"
},
"groups": {
"header": "Showing 2 of 2 matching groups",
"total": 2,
"groups": [
{
"name": "confluence-users",
"html": "confluence-\u003cb\u003eusers\u003c/b\u003e",
"labels": [
]
},
{
"name": "jira-users",
"html": "jira-\u003cb\u003eusers\u003c/b\u003e",
"labels": [
]
}
]
}
}
我认为结果是试图给我 JIRA 和 Confluence 用户 API 的 URL;但我无法弄清楚这些相对 URL 是如何映射到根 URL 的(我尝试在 URL 中的各个位置附加,所有这些都给我一个404
或dead link
错误)。