Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

unable to create user through restAPI

Admin Test
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
March 7, 2023

unable to create user through restAPI by following URL

URL: https://api.atlassian.com/ex/jira/{{cloudId}}/rest/api/3/user

Method: Post

the error msg which i got is 

OAuth 2.0 is not enabled for method: POST /rest/api/3/user

3 answers

0 votes
Brandon Harris March 20, 2023

I'm seeing a similar issue with the create user api endpoint at https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-users/#api-rest-api-3-user-post

I get a 500 error with the not helpful message 

{'errorMessages': ["The request failed. We're not sure what went wrong. Try again and if the problem persists, contact Jira support."], 'errors': {}}

 

The endpoint has been working for months, so something in the api changed and the documentation hasn't been updated to reflect it, or they just shut the end point down since it was experimental.

Either way it's broken and has been for a few days.  I have a support ticket open, so hopefully we'll get some answers.

0 votes
Prince Nyeche
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 8, 2023

I think OAuth 2.0 might be too much of a step if you simply just wanted to create users. A simple script using your direct instance URL should suffice. An example is shown on the API docs in different languages. 

https://your-domain.atlassian.net/rest/api/3/user

The API URL can be in the above form, then you can authenticate with your email address + API token. Also, the docs say "Connect apps cannot access this REST resource."

0 votes
Tuncay Senturk _Snapbytes_
Community Champion
March 8, 2023

Hi @Admin Test 

Welcome to the Community!

You need to authenticate your API requests using OAuth 2.0. To do so, you have to obtain an access token from Jira and include the access token in your API requests as an Authorization header.

  • Go to the "Jira settings" page and click on "Apps" and then "OAuth credentials" in the left-hand menu.
  • Click on "Create credentials" and choose "OAuth client ID".
  • Enter a name for your app and choose "Web application" as the application type.
  • Set the "Authorized redirect URIs" to the URL of your application.
  • Click "Create" to generate your client ID and client secret.
  • Use the client ID and client secret to request an access token from Jira using the OAuth 2.0 authentication flow.
  • Include the access token in your API requests as an Authorization header as below
Authorization: Bearer <access_token>

 I hope that helps

Tuncay

Admin Test
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
March 8, 2023

Hi Tuncay,

i followed above steps to create access token. Eventhough i am getting same error.Same Access token is used in getUsers API and it is working fine. When comes to CreateUsers API, I am getting error.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD Trial
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events