While trying to create a Jira project Using Post Method with REST API URL getting user doesn't have access.
How to get the Access_token.
Firstly, you will need to create an API token from your Atlassian account:
Log in to https://id.atlassian.com/manage-profile/security/api-tokens.
Click Create API token.
From the dialog that appears, enter a memorable and concise Label for your token and click Create.
Then follow Basic auth for REST APIs for examples on how you can use it in scripts. Hope this helps.
Hi, @Kishan Sharma Thank you for the information.
While trying with like above one getting 500 Internal Server Error
function createProject(keyValue,summary,lead,issueUrl)
{
var originalKeyValue = keyValue;
keyValue = keyValue.replace("-","");
console.log(keyValue);
summary = summary.trim();
console.log(summary);
AJS.$.ajax
({
url: urlToAPI[baseUrl],
type: "POST",
timeout: 0,
dataType: 'json',
processData: false,
headers: {
"Content-Type": "application/json; charset=utf-8",
"Authorization": "Basic YmhhZ2F2YW4uZ291ZEBpbi5lYm1wYXBzdC5jb206RWJtUGFwc3RJbml0aWFsLWI3KXY=="
// "Authorization" : "Basic " + btoa(lead + ":" + "")
},
data: JSON.stringify({
"key": keyValue,
"name": originalKeyValue+" "+summary,
"lead": lead,
"url": issueUrl,
"projectTypeKey": "business",
"templateProjectId":global_config_project_template_id
//"templateProjectId":"13303"
}),
success: function (response) {
console.log(JSON.stringify(response));
console.log("keyValue"+response.key);
alert("Jira project has been created. Now you will be navigated to the project summary screen.");
window.location.replace(((baseUrl=='http://localhost:2990')?(baseUrl+'/jira'):(baseUrl)) +'/projects/'+ keyValue +'/summary');
},
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Bhagavan Goud Do you have JIRA Admin permission, as per the error message it seems that you don't have project creation access ?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Vikrant Yadav I have JIRA Admin Permission but the error message seems that you don't have project creation access?
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.
Hi @Bhagavan Goud From the error it looks like either the parameters are incorrect or that the json package is incorrect. Please see the KB Get an internal server error message when trying to create a new issue through REST method
You can refer example here and make sure you are using the correct headers, payload, and endpoint with parameters.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Bhagavan Goud Are you using JIRA cloud or local host JIRA server ?
If you using JIRA Cloud you can check this link for creating project via Rest API :- https://www.youtube.com/watch?v=jrYbx-3Px9A
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.