Forums

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

Where can I find the Issue field definition for JiraRestClient?

윤현구 July 10, 2019

Hi, I am creating a ticket for the first time using JiraRestClient. It works beautifully, and my code looks like this:

 

@PostConstruct
public void init() {
jiraRestClient = new AsynchronousJiraRestClientFactory()
.create(URI.create(jiraUrl), new BasicHttpAuthenticationHandler(jiraUser, jiraPassword));
}

// todo 작업중
public void createIssue(Long issueType, String issueSummary) {
IssueRestClient issueRestClient = jiraRestClient.getIssueClient();
IssueInput issueInput = new IssueInputBuilder()
.setFieldValue("customfield_10011", "Epic Name")
.setProjectKey(projectKey)
.setDescription(issueSummary)
.setSummary(issueSummary)
.setIssueType(new IssueType(null, 10000L, null, false, null, null))
.build();
issueRestClient.createIssue(issueInput).claim();
// return issueRestClient.createIssue(issueInput).claim().getKey();
}

 

In here, i don't know what is customfield_10011 and what means 10000L of IssueType.

Next is customization, so I need a document that is related to these fields. If you already have a document, would you give me the link address? Thank you.

1 answer

0 votes
Warren
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 10, 2019

Hi @윤현구 

The is just telling the code that the value is of type long.

I'm assuming that you got this code from somewhere else and didn't write it yourself. customfield_xxxxx is a way of representing a specific custom field in the API. To find the number for a custom field that you want to reference, in Jira go to the filters editor and start typing the name of the field. The dropdown will show you the cf number - see below

Screenshot_10.jpg

Does this answer your questions?

윤현구 July 10, 2019

Thanks for your answer. @Warren 

First, this code is written by myself.
The reason I added the customfield_xxxxx is in the previous error log.

 

```ErrorCollection = [errorCollection {status = 400, errors = {customfield_10011 = Epic Name is required.}, ErrorMessages = []}]}```

 

Second, I want to know what attribute id 10000 means. Is there a document or site defined for the index?

Warren
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 10, 2019

Hi @윤현구 

Right, I understand about the custom field now. What the message is saying is that the Epic Name is a required field when you create a ticket i.e. if you were using Jira's UI to create it, Epic Name appears on the Create screen and is mandatory. So what you've done in the code above is correct, although the value that you're setting it to is Epic Name.

If you've written the code, then you should know what the parameter of 10000 is for, I can't see the rest of your code so I have no idea what IssueInput and IssueType are.

윤현구 July 10, 2019

@Warren 

IssueInput and IssueType is from Jira-Rest-Client-Core.
package path is 

com.atlassian.jira.rest.client.api.domain.input.IssueInput;

and It is from my pom.xml like this

<dependency>
<groupId>com.atlassian.jira</groupId>
<artifactId>jira-rest-java-client-core</artifactId>
<version>4.0.0</version>
</dependency>
<dependency>
<groupId>com.atlassian.fugue</groupId>
<artifactId>fugue</artifactId>
<version>2.6.1</version>
</dependency>


Is it not yours?

Warren
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 11, 2019

Okay, I don't use that, I use C# to connect directly to the API, so I'm afraid I won't be able to help you with that aspect

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events