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
If it works with curl, what is different about the call you are making with whatever is failing?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Can you check the scopes object in your atlassian-connect.json file? I ran into this same issue and found out I only had the READ scope by defailt. I added WRITE scope as well and it worked like a champ.
"scopes": [ "READ", "WRITE" ]
Also, be sure to update your script to use the new AP.request method as the one listed above is deprecated. See docs here
Hope that helps!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks, Daniel. I got the same error because of this reason. I added WRITE scope and now It works well.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I added
"scopes": [ "READ", "WRITE" ]
and for me it works well too
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello @Pavel Naydanov
I'm using free cloud server and her is my connect descriptor here. Do you have any suggestion, I'm still getting this error
Thanks
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Has anyone solved this issue? I'm also having the same problem. The curl command works completely fine, however when I try POST method with the same credentials and same datas on my code, it returns 403.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi, I'm also having this issue.
I can make the POST call work in Postman. But when I try to do it as an AJAX call I get a 403 Forbidden error.
Would be great to hear if someone has solved this issue.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Is the payload of your AJAX call identical to the POST?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yep, I even tried copy & pasting directly out of Postman.
The error just says "403 (Forbidden)". Here's the code below:
var requestBody = {
"fields": {
"summary": "Kevin Test",
"description": "Description Test",
"project": {
"id": "13104"
},
"issuetype": {
"id": "7"
},
"components": [
{
"id": "20720"
}
],
"customfield_12213": "2019-04-22"
}
}
var settings = {
"async": true,
"crossDomain": true,
"url": "https://corsBypassURL.com/https://jira.corp.docusign.com/rest/api/2/issue",
"method": "POST",
"headers": {
"Authorization": "Basic xxxxx=",
"Content-Type": "application/json",
"cache-control": "no-cache"
},
"data": requestBody
}
$.ajax(settings).done(function (response) {
console.log(response);
});
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Not sure, but you can try passing User-Agent header.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I got this error, and was solved with header
User-Agent: MyAgent (Insomnia)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello @Kevin Cassidy
I got the same issue with you, Did you solve your problem? please suggest
Thanks
Quách
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Nguyen Quach , it turned out the domain needed to be whitelisted by a Jira admin. Once this was done, it worked perfectly :)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Instructions can be found here: https://confluence.atlassian.com/adminjiraserver073/configuring-the-whitelist-861254007.html
Once we added the specific domain here, then I no longer received the 403 error and my API calls started working successfully.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Is anyone having the answers to the questions posted above. I am having the same issue.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Can you please try "data: JSON.stringify(sendInfo)". I am not sure here but you can try.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
sorry but it gives me the same error
Also the URL i hitting expects a JSON in the request
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.