Hi,
I’m trying to call the confluence rest api search function but facing some issues. I’m getting a 401 response even with the correct credentials.
Here’s the simple code I’m trying out:
curl --request GET
–url ‘https://corporate.atlassian.net/wiki/rest/api/search?cql=text~test’
–user ‘corporate@email.com:GENERATED_TOKEN’
–header ‘Accept: application/json’
I tried with 2 tokens with difference scopes. The first token I created have these scopes
Read
- read:account
- read:confluence-content.all
- read:confluence-content.permission
- read:confluence-content.summary
- read:confluence-groups
- read:confluence-props
- read:confluence-space.summary
- read:confluence-user
- read:me
Search
- search:confluence
The 2nd token that I created have a more limited scope having only these
Read
- read:content-details:confluence
Search
- search:confluence
But still I’m getting a 401 even just by using the simplest sample code from the documentation of search endpoint - https://developer.atlassian.com/cloud/confluence/rest/v1/api-group-search/#api-group-search
I can see that the tokens are being access as the page API Tokens shows when it was last accessed.
Not sure how to proceed and what else to check. Please advise.
