403 Forbidden on POST method of /rest/api/2/issue however get works

Hello,

 

I am using the /rest/api/2/issue API of JIRA. I am successfully able to use Get for below URL

https://futuregroupb.atlassian.net/rest/api/2/issue/LHEL-24

but i get 403 forbidden error on POST with basic authentication which i used in GET method.

The POST method works absolutely fine on curl command.

 

Please help.

 

Thanks

Ramneek

4 answers

1 accepted

0 vote

If it works with curl, what is different about the call you are making with whatever is failing?

Hello,

Only the client is different, i fire the Curl command from Linux command line which works fine, but when try to hit the API using the AJAX jquery call (using the same authenticatio), i get 403 forbidden error

attached is my JS File, i have intentionally hidden the password here

 

Thanks

Ramneek

I don't know enough about javascript to help you with that, but it must be the call in that trying to do the wrong thing.

What was the solution? I've currently a similar issue in a CORS scenario - so GET's against the API work but a POST to create a new issue throws a 403...

I too got the same error 403 forbidden error when trying to access rest-api using POST/PUT method and my code was as follows,

AP.require(['request'], function(request) {
request({
url: 'https://mysite.atlassian.net/rest/api/2/issue/XYZ-5',
type: 'POST',
contentType: 'application/json',
data: {
"fields": {"description": "testing"}
},
beforeSend: function (xhr) {
xhr.setRequestHeader ("Authorization", "Basic " + btoa(" user : password "));
},
success: function(response) {
alert("success");
},
error: function (response) {
alert('fail... ');
}
});
});

Did you get any idea to fix the 403() status response. How, to overcome this and edit an existing issue using rest api with POST method. 

And also have questioned regarding Edit and Update issues here.

Or if using CURL can fix this error, how to use this code based on CURL code within request.

Can you please try "data: JSON.stringify(sendInfo)". I am not sure here but you can try.

sorry but it gives me the same error

Also the URL i hitting expects a JSON in the request

0 vote

Is anyone having the answers to the questions posted above. I am having the same issue.

I'm sure they discovered that they were not providing the right user details.  This is the usual pattern when a discussion about 404's over REST stops with no-one making follow-up comments.

I'm still having this same issue. I don't think user credentials are the issue, as making GET requests, and POST requests via CURL both work fine with the same credentials. Making the call via AJAX for what it's worth. Any ideas?

Suggest an answer

Log in or Join to answer
Community showcase
Sarah Schuster
Posted Jan 29, 2018 in Jira

What are common themes you've seen across successful & failed Jira Software implementations?

Hey everyone! My name is Sarah Schuster, and I'm a Customer Success Manager in Atlassian specializing in Jira Software Cloud. Over the next few weeks I will be posting discussion topics (8 total) to ...

3,254 views 14 20
Join discussion

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
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot