Hi,
I am trying to use the Confluence API to add a user to a group. I have tried this option.
api/user/{username}/group/{groupName}
And I have used it in the following Python script:
import json
import os
import requests
confluence_url = os.environ['EXAMPLE_CONFLUENCE_URL']
confluence_pat = os.environ['EXAMPLE_CONFLUENCE_PAT']
headers = {
"Content-Type": "application/json",
'Authorization': 'Bearer ' + confluence_pat
}
json_data = {
'username': 'some.user@example.com',
'groupName': 'some-confluence-group',
}
api_endpoint = '/rest/api/user/'
url = confluence_url + api_endpoint
response = requests.put(url, headers=headers, json=json_data)
print(response.url)
print(response.status_code)
# Result:
# https://confluence.example.com/rest/api/user/
# 404
Not sure why I am getting a 404. I also don't understand what is meant by the {@link User} in the documentation.
HI - Are you able to invoke any other methods successfully? 404 usually indicate that resource end point is not available.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.