Unable to find space through REST API in postman but working fine from browser
Asked by Puneet Gupta:

I am using confluence server and trying to get SPACE details through the POSTMAN and Confluence REST API.

<https://x01sdcifcnfl1a.uat.dbs.com:8443/dcifcnfl/rest/api/space/APTE>

While I run on browser, I get details of the space

```
{"id":46301185,"key":"APTE","name":"ap30test","type":"global","_links":{"webui":"/display/APTE","collection":"/rest/api/space","base":"https://x01sdcifcnfl1a.uat.dbs.com:8443/dcifcnfl","context":"/dcifcnfl","self":"https://x01sdcifcnfl1a.uat.dbs.com:8443/dcifcnfl/rest/api/space/APTE"},"_expandable":{"metadata":"","icon":"","description":"","homepage":"/rest/api/content/45844347"}}
```

But running from postman, following response:-

{  
"statusCode": 404,  
"data": {  
"authorized": false,  
"valid": true,  
"allowedInReadOnlyMode": true,  
"errors": \[\],  
"successful": false  
},  
"message": "No space found with key : APTE",  
"reason": "Not Found"  
}

Not sure why it works in browser and not POSTMAN. Any solutions?


Answers:
author: Brant Schroeder
body: Are you using the same credentials in the browser and in Postman? If the credentials you are using do not have access to the space then you will get the message that you are currently receiving.

comments: author: Puneet Gupta
body: I have access to the space as I can browse the space through browser.

In postman if I am not using any authentication, then it displays as below:-

{"statusCode":404,"data":{"authorized":false,"valid":true,"allowedInReadOnlyMode":true,"errors":\[\],"successful":false},"message":"No space found with key : Digital","reason":"Not Found"}

Using Basic authentication and passing same user name and password(as in browser) is throwing Server error(does not look like Apache server error)

\<!doctype html\>\<html lang="en"\>\<head\>\<title\>HTTP Status 401 -- Unauthorized\</title\>\<style type="text/css"\>h1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} h2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} h3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} body {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} b {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} p {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;} a {color:black;} a.name {color:black;} .line {height:1px;background-color:#525D76;border:none;}\</style\>\</head\>\<body\>\<h1\>HTTP Status 401 -- Unauthorized\</h1\>\<hr class="line" /\>\<p\>\<b\>Type\</b\> Status Report\</p\>\<p\>\<b\>Message\</b\> Basic Authentication Failure - Reason : AUTHENTICATION_DENIED\</p\>\<p\>\<b\>Description\</b\> The request has not been applied because it lacks valid authentication credentials for the target resource.\</p\>\<hr class="line" /\>\<h3\>Apache Tomcat/9.0.12\</h3\>\</body\>\</html\>


author: Brant Schroeder
body: You should look at this document to make sure your call is structured correctly.

<https://developer.atlassian.com/server/jira/platform/basic-authentication/>

Towards the bottom of the page it talks about if CAPTCHA is triggered your will get the error code back that you are seeing. You might check and make sure that the account does not have CAPTCHA triggered on it.


Tags: confluence-server

rest-api

server