Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Error 405 when trying to create a user group Edited

 

AP.request({ 
url: "/rest/api/group",
type: 'PUT',
contentType: "application/json",
Accept: 'application/json',
Authorization: "Basic bWJvdWF6emEuc3BlY3RydW1ncm91cGVAZ21haWwuY29tOk9jQjloZXRCWVg1b2dDaDdtUXNSMDRCNA==",                    data: JSON.stringify(bodyData2),
     success: function (data) {
console.log(data)
}}).catch(function (error) {
console.log(error)
});

I added to scope all permissions 

"scopes": [    "READ",    "ACT_AS_USER",    "WRITE",    "DELETE",    "SPACE_ADMIN",    "ADMIN"  ],

 im connected with an administrator

2 answers

Hi @mehdi - Can you check the URI format?

New group creation must have a POST /wiki/rest/api/group

https://developer.atlassian.com/cloud/confluence/rest/api-group-group/#api-api-group-post

User must be a site admin to create a new group

hi @Niranjan , sorry i put the wrong code

this is my code 

const bodyData2 = {"name": "RS-managers"};
AP.request({ url: "/rest/api/group",
type: 'PUT',
contentType: "application/json",
Accept: 'application/json',
Authorization: "bWJvdWF6emEuc3BlY3RydW1ncm91cGVAZ21haWwuY29tOnd6UGhpRXBWd1JTN0E0aDhrRVRyODhGRg==",
data: JSON.stringify(bodyData2),
success: function (data) {console.log(data)}
}).catch(function (error
console.log(error)        
});

@mehdi - Can you try with POST method ? PUT method is generally used for update.

Hello @mehdi 

A 405 error is telling you that the request is incorrectly formed, which means your code which is making the request has a mistake in it.

Try doing some basic testing of the structure of the request first, using a REST API test tool like Postman. If the request works, then some other part of your code is incorrect.

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Confluence

🏑 Atlympic Event: Confluence

Hello Community!  Quick disclaimer: We are running a contest on Community (The Atlympics!) from July 23rd - August 8th of 2021. If you are interested in participating in this contest (prizes! ...

504 views 18 17
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you