Forums

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

where to start for integrating jira with some product ?

Santosh Penjarla January 8, 2019

https://docs.atlassian.com/software/jira/docs/api/7.6.1/

 

I found above documentation for api - 7.6.1 version and in that documentation many packages are present so I didnt understand where to start in order to create issues in the project , create issues with custom fields ... etc

Previously I have used JiraRestClient to connect and create issues .

 

looking forward for help 

 

with regards

Santosh PenjArla

1 answer

0 votes
Nic Brough -Adaptavist-
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.
January 8, 2019

Are you trying to create issues from outside Jira (i.e. another system using REST, like JRJC) or are you doing it internally, in an add-on (App) you are writing?

Santosh Penjarla January 8, 2019

from outside JIRA using REST

Santosh Penjarla January 8, 2019
import com.atlassian.jira.rest.client.IssueRestClient;
import com.atlassian.jira.rest.client.JiraRestClient;
import com.atlassian.jira.rest.client.domain.*;
import com.atlassian.jira.rest.client.domain.input.IssueInput;
import com.atlassian.jira.rest.client.domain.input.IssueInputBuilder;
import com.atlassian.jira.rest.client.internal.async.AsynchronousJiraRestClientFactory;
import com.atlassian.util.concurrent.Promise;
import com.google.common.collect.Lists;

import java.net.URI;
import java.net.URISyntaxException;
import java.util.ArrayList;

public class MyJiraClient {
protected String userName;
protected String password;
protected String url;
protected JiraRestClient jiraRestClient;
public MyJiraClient(String user,String pass,String url){
this.userName = user;
this.password = pass;
this.url = url;
this.jiraRestClient = getJiraRestClient();
}
public URI getURI(){
return URI.create(this.url);
}
public JiraRestClient getJiraRestClient(){
JiraRestClient jiraRestClient;
jiraRestClient = null;
try{
jiraRestClient = new AsynchronousJiraRestClientFactory().createWithBasicHttpAuthentication(getURI(),this.userName,this.password);
}
catch(Exception e){
System.out.println(e);
}
return jiraRestClient;
}
public String createIssue(String projectKey, String issueSummary) {
IssueRestClient issueClient = this.jiraRestClient.getIssueClient();
BasicProject basicProj = new BasicProject(this.getURI(),projectKey,issueSummary);

BasicIssueType issueType = new BasicIssueType(this.getURI(),10002L,"Task",false);
IssueInput newIssue = new IssueInputBuilder(basicProj,issueType,issueSummary).build();
try{
pIssue= issueClient.createIssue(newIssue);
}
catch(Exception e){}
return pIssue.claim().getKey();
}
public static void main(String[] args) throws URISyntaxException {
String userName = "username";
String password = "password";
String url = "https://myDomain.atlassian.net/";
MyJiraClient jiraClient = new MyJiraClient(userName, password, url);
String issueKey = jiraClient.createIssue("ABC", "abc");

}


 above code successfully creates issues for me 

now I want to use JIRA REST api 7.6 version and need help to start with it .

for example in the above code I have used 

createWithBasicHttpAuthentication method

for connecting similar to that how can I connect in using this api 7.6 

Santosh Penjarla January 8, 2019

@Nic Brough -Adaptavist-

hope you got what I am searching for 

can you provide me with some guidance regarding this 

Thanks in advance

 

with regards

SantoshPenjArla 

Nic Brough -Adaptavist-
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.
January 8, 2019

Um, you have working code, so I'm not sure what you're looking for now?

Santosh Penjarla January 8, 2019

The code which I shared is working but the thing is it is using jrjc-2.0.0-m2 

now I want to use jira REST - 7.6

 



JiraRestClient is present in jrjc - 2.0.0-m2
but it is not there in jira Rest - 7.6
Nic Brough -Adaptavist-
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.
January 8, 2019

Ok, so see https://docs.atlassian.com/software/jira/docs/api/REST/7.6.1/ - that will show you the authentication and possible calls you can make.

Santosh Penjarla January 8, 2019

Will try and update here

Thank you

Suggest an answer

Log in or Sign up to answer