REST API Creating Issues with LDAP users

I create issues from a corporate site with JIRA REST API.

Creating everything under the administrator or agent, everything works. But creating a normal user (LDAP), there is a problem.

LDAP is configured correctly. Users in the system are working. Can there be a problem with access rights or system settings? I think I set everything right. Where to look?

<div id="wrapper">
  <h1>Create Issue</h1>
  <form id="create-form">
    Summary: <input type="text" name="summary" id="summary" value=""/>
    Description: <input type="text" name="description" id="description" value="" />
    Issue Type: <input type="text" name="type" id="type" value=""/>
    Username: <input type="text" name="user" id="user" value=""/>
    Password: <input type="password" name="pass" id="pass" value=""/>
    <input type="button" id="button" value="Create Issue"/>
<script>$('#button').click(function() {
     type: "POST",
     url: "jiraapi.php",
     data: $('#create-form').serialize(),
     success: function(data){
     dataType: "html"


  $base64_usrpwd = base64_encode($_POST['user'].':'.$_POST['pass']);
  $ch = curl_init();
  curl_setopt($ch, CURLOPT_URL, 'http://localhost:8080/rest/api/2/issue/');
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  curl_setopt($ch, CURLOPT_POST, 1);
  curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json',
                        'Authorization: Basic '.$base64_usrpwd)); 
  $arr['project'] = array( 'key' => 'TP');
  $arr['summary'] = $_POST['summary'];
  $arr['description'] = $_POST['description'];
  $arr['issuetype'] = array( 'name' => $_POST['type']);
  $json_arr['fields'] = $arr;
  $json_string = json_encode ($json_arr);
  curl_setopt($ch, CURLOPT_POSTFIELDS,$json_string);
  $result = curl_exec($ch);
  echo $result;

Under the administrator I get an alert with the data and the issue is created.

Under LDAP users, the response is empty, issue is not created, alert comes empty.

If login / password is not valid, then displays error 401

1 answer

0 vote
Alexey Matveev Community Champion Nov 14, 2017


Are you sure that the user from LDAP has permissions to create an issue it the project?

I usually experiment with REST API Browser plugin first. You can login under the user from LDAP to Jira and try to execute same request using the plugin. If everything is fine, then the problem is in your code. If not, then there will be the error.

That is the link for the plugin. It is free

I never had a problem with Ldap users without a reason (Jira setups or code)

Having entered JIRA under the user LDAP, it is possible to create and view issues in the project. Using REST API, under LDPA user, create a issues does not work.

Alexey Matveev Community Champion Nov 14, 2017

Are you sure that response message is empty? What is response status?

No Response message.Console message like:

XHR finished loading: POST "http://..."
(anonymous function)
Alexey Matveev Community Champion Nov 14, 2017

I am not familiar much with php, but Atlassian usually returns JSON as a response. You need to print it to console. I could give you an example in Java but I guess it will not make sense.

the problem is that there is a bug in the script or when processing the validation of the login. Because response and does not return anything, it generally does not. Or the problem in access rights

Alexey Matveev Community Champion Nov 14, 2017

Try to use POST /rest/auth/1/session and see if you are successfully connected

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published Jun 14, 2018 in Jira Service Desk

How the Telegram Integration for Jira helps Sergey's team take their support efficiency to the bank

...+ reading Fantasy). The same is true for him at the bank he works for: Efficiency is key when time literally equals money. Read on to learn how Sergey makes most of the time he has by...

792 views 5 7
Read article

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you