0

查看文档这个 REST URI 应该是正确的:

https://tenant.atlassian.net/rest/api/content/search?cql=space=myspace

为什么我在 chrome 中浏览到这个 URL(登录后)我得到了一个死链接。当我尝试以下 powershell 脚本时,响应正文中出现相同的错误:

#Connection settings
$restcreds = [System.Convert]::ToBase64String(
[System.Text.Encoding]::ASCII.GetBytes(('username' + ":" + 'pass123'))
)
$URI = 'http://tenant.atlassian.net/rest/api/content/search?cql=space=Myspace'
$httpheader = @{Authorization = "Basic $restcreds"}
$restParameters = @{
Uri = ($URI);
ContentType = "application/json";
Method = 'GET';
Headers = $httpheader;
}
$response = Invoke-RestMethod @restParameters
try{
$response = Invoke-RestMethod @restParameters
} catch {
$result = $_.Exception.Response.GetResponseStream()
$reader = New-Object System.IO.StreamReader($result)
$reader.BaseStream.Position = 0
$reader.DiscardBufferedData()
$errorResponse = $reader.ReadToEnd();
$errorResponse
}
$response
4

1 回答 1

3

不,您的网址无效,您需要在您的网址中添加“wiki”:https ://tenant.atlassian.net/wiki/rest/api/content/search?cql=space=myspace

于 2016-08-19T19:00:03.747 回答