查看the docs此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
答案 0 :(得分:2)
不,您的网址无效,您需要在网址中添加“wiki”:https://tenant.atlassian.net/wiki/rest/api/content/search?cql=space=myspace