Hello everyone,
I’m currently facing an issue while trying to interact with the Confluence Server API using a GET request.
I’ve found examples in the documentation that describe authentication for Confluence Cloud, where they use an API Token and Bearer authentication. However, I am working with a Confluence Server instance (self-hosted), and I haven't found any examples that directly apply to my case. Does the Basic Auth method (using my email and password) still work, or do I need to use a different kind of token?
I’ve already tried using API tokens in my GET requests, but I keep receiving 403 (Unauthorized) or 404 (Not Found) errors, indicating that the resource is not accessible.
Could someone clarify:
The correct authentication method for Confluence Server (email/password vs token)?
The difference in API URL structure between Cloud and Server instances?
How to check if my user has the necessary permissions to access the API?
Thanks in advance for your help!
Welcome to Atlassian community!
When working with the Confluence Server API, there are some key differences and specific methods for authentication and accessing resources compared to Confluence Cloud. Here are the details to help you resolve your issues:
For Confluence Server (self-hosted), the recommended authentication method is Basic Authentication using your email and password. Here’s how you can do it:
Basic Authentication:
Authorization
HTTP header containing Basic username:password
where username:password
must be base64 encoded Example:
GET /rest/api/content HTTP/1.1
Host: your-confluence-server.com
Authorization: Basic base64encoded(username:password)
2. API Tokens:
The URL structure for Confluence Server and Confluence Cloud APIs differs slightly:
Confluence Cloud:
https://your-domain.atlassian.net/wiki/rest/api/
https://your-domain.atlassian.net/wiki/rest/api/content
Confluence Server:
https://your-confluence-server.com/rest/api/
https://your-confluence-server.com/rest/api/content
To ensure your user has the necessary permissions to access the API, you can follow these steps:
Inspect Permissions:
Using the REST API:
GET /rest/api/space/{spaceKey}?expand=permissions
If you continue to face issues, ensure that your credentials are correct and that your user has the necessary permissions to access the resources you are trying to retrieve.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.