Forums

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

node express Jira 403 error

zzw8200465323 June 10, 2019
const httpClient = await addon.httpClient({ addon: addon, clientKey: '5d5659b6-09f0-3482-bfa2-0405c4818f1e' });
httpClient.get('rest/api/3/project', function (err, response, body) {
res.send(`body = ${body}`);
});
//success
const httpClient = await addon.httpClient({ addon: addon, clientKey: '5d5659b6-09f0-3482-bfa2-0405c4818f1e' });
httpClient.del({ url: 'rest/api/3/project/10002',
headers: { 'Accept': 'application/json', 'Content-Type': 'application/json', 'X-Atlassian-Token': 'nocheck' } },
(
err, response, body) => {
err
? res.methodsend(`body = ${err.error_description}`)
: res.send(`body = ${body}`) }); 
//Forbidden(403)

Forbidden (403)

2 answers

2 accepted

0 votes
Answer accepted
zzw8200465323 June 26, 2019

If you use node.js ,so,you can use jira-npm complete the operation of the Jira issue.

0 votes
Answer accepted
Dario B
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 11, 2019

Hi @zzw8200465323 ,

 

I am not sure I have a correct understanding of what you are asking for in here. However, what I understand is that:

  • You are able to get the list of projects by sending a GET request to the /rest/api/3/project endpoint
  • You cannot delete one of the projects you got from above call by sending a DELETE request to the /rest/api/3/project/{projectIdOrKey} endpoint since you get error 403 (forbidden) in return.

 

If this is correct, then can you make sure you have the proper permissions/scope? 

Delete project

DELETE /rest/api/3/project/{projectIdOrKey}

Deletes a project.

Permissions required: Administer Jira global permission.

App scope requiredPROJECT_ADMIN

OAuth scopes required
manage:jira-configuration

 

 

Also, kindly notice that:

  1. The endpoint /rest/api/3/project to get all projects visible to the user has been deprecated and you should use the Get projects paginated (that supports search and pagination) instead.
  2. This might not be the best place to get help on development related questions. You may have more chances to get help on this in the developers' community: https://community.developer.atlassian.com/

 

 

Cheers,
Dario

zzw8200465323 June 26, 2019

@Dario B  This problem has been solved, Because I used Jira npm,But I still have a question, where is the API for adding a child issue? What parameters need to be passed

zzw8200465323 June 26, 2019

@Dario B   Also , I'm use local server jira-6.3.6 + crowd + our own products joint adjustment

Dario B
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 27, 2019
zzw8200465323 June 28, 2019

@Dario B  Thank you very much, the subtask can already be created.

demo code:

const body = { 
fields: {
parent: {
id: "10701"

},

project: {
id: 10100  //require?
},

summary: "summary",
issuetype: {
id: "10001" //require?
},

assignee: {
name: "zhangzhouwang"
},
/*reporter: { name: "zhangzhouwang" },*/
duedate: "2019-6-27",
description: "封装后创建的任务描述"
}

};

In my local jira, I see that the project id and issuetype are required. Is it mandatory? And these two fields I can't cancel

zzw8200465323 June 28, 2019

@Dario B 

If this is the case, Is there an api query field's reqire state?

Dario B
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 28, 2019

Hi @zzw8200465323 ,

If you don't specify project-id and issuetype  then Jira cannot possibly know  where (under which project) to create the issue and what kind of issue  (issuetype) has to be created. That's why those fields are necessary.

Also, as written in:

The fields that can be set on create, in either the fields parameter or the update parameter can be determined using the /rest/api/2/issue/createmeta resource. If a field is not configured to appear on the create screen, then it will not be in the createmeta, and a field validation error will occur if it is submitted.

Creating a sub-task is similar to creating a regular issue, with two important differences:

  • the issueType field must correspond to a sub-task issue type (you can use /issue/createmeta to discover sub-task issue types), and
  • you must provide a parent field in the issue create request containing the id or key of the parent issue.

 

I hope this helps.

 

Dario

zzw8200465323 June 30, 2019

@Dario B 

Thank you very much for your help. If there are any problems, let me ask you again.

Like Dario B likes this
zzw8200465323 July 10, 2019

hi @Dario B  

Very sorry, I am coming again...

Because I want to migrate jira data to our own service,

The way I found is basically only xml and database backup, but I also see the data export method inside the jira system, such as excel, but the data is not complete, and the attachment can not be exported. Do you have any recommended data migration method?

zzw8200465323 July 10, 2019

@Dario B 

Or do you have a document in the database data format?Such as getting all issues and attachments and comments, etc.

zzw8200465323 July 11, 2019

@Dario B 

And the export inside jira can only have a maximum of 1000, how can I export more?

The local address is like this

http://localhost:9001/sr/jira.issueviews:searchrequest-fullcontent/temp/SearchRequest.html?jqlQuery=project+in+%28ZHANGZHOUW%2C+TEST%29&tempMax=1000

parameters do I need to add?

I tried start and startAt , but not

Dario B
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
July 11, 2019

@zzw8200465323 , Please notice that this question has nothing to do with the original topic and it should be posted in a new thread (also because this thread is marked as solved). 

For the rest, the way to export more than 1000 issues to CSV is explained in the below KB:

 

By searching the community you can find many threads discussing this same topic and adding also some alternative approaches like, e.g. (search the community for more if needed):

 

Cheers,
Dario

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events