red888
red888

Reputation: 31570

Trying to use confluence API getting (Oops, you've found a dead link.)

Looking at the docs this REST URI should be correct:

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

Why I browse to this URL in chrome (after logging in) I'm getting a dead link. When I try the following powershell script I get the same error in the response body:

#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

Upvotes: 0

Views: 1494

Answers (1)

mtheriault
mtheriault

Reputation: 1075

No, your URL is invalid, you need to add "wiki" in your URL: https://tenant.atlassian.net/wiki/rest/api/content/search?cql=space=myspace

Upvotes: 3

Related Questions