0

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
red888
  • 27,709
  • 55
  • 204
  • 392
  • Maybe the username contains a non-ASCII symbol? Should be `UTF8.GetBytes` Also, [the docs](https://docs.atlassian.com/confluence/REST/latest) list several different URL paths depending on usage. – wOxxOm Aug 11 '16 at 18:08

1 Answers1

3

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

mtheriault
  • 1,065
  • 9
  • 21