Forums

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

Regarding jira Custom plugin (Rest endpoint and fragments)

Shubhangi Nikam January 4, 2024

Hi Team
I am developing Rest end points and fragments in Jira using custom plugin
following doubts I have listed below:


1.issueservice: found in jira server but, is it available in Jira cloud if yes how can we use in custom plugin
2.using jira properties (JSD) sd.public.comment - how can we set in our custom plugin
3. How to get comment body without tags in jira cloud in custom plugin (rest Api)
4.how to use the validate Transition in jira cloud which is using issueservice inteface to get transitions
5. how to get list of all categories in scheme using Rest Api’s
6.how can we perform operations on inward and outward issues
7. source and destination objects (how to get the info in Jira custom plugin)

please resolve my above doubts on priority

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 5, 2024

Welcome to the Atlassian Community!

Your use of the word "fragments" suggests you are looking at Scriptrunner for Server/DC, because there are no other frequently used apps that use that word (the SR team are looking at improving the language in fragments)

Jira Cloud and Jira Server/DC diverged almost a decade ago.  It is better to think of them as two separate systems which do issue tracking and have compatible data (including a lot of config), rather than the same software.

You don't need issueservice in Cloud, you need to look at the REST calls to create issues remotely.  The rest of your questions are much the same - have a look at the REST API for Cloud.

Shubhangi Nikam January 8, 2024

thanks for the reply

Shubhangi Nikam January 8, 2024

Hi @Nic Brough -Adaptavist- 

I am using connect springboot to develop this plugin

In my custom plugin I need to copy the last attachment  of one Issue to another issue 

using java (springboot)

could you please  share the code regarding this, would be helpful 

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 9, 2024

You need to look at the REST API to do this (springboot is not relevant, Java can make REST calls).

Shubhangi Nikam January 22, 2024

Hi @Nic Brough -Adaptavist- 

In my custom plugin I am adding last comment to through java, but getting null data 

public String addComment(String issueKey, String outwordIssueKey) throws JsonProcessingException {
//JsonNode issue = getIssue(issueKey);
JsonNode lastComment = getLastComment(issueKey);

System.out.println(lastComment);
String commentBody = lastComment.get("comments").get(0).get("author").get("body").asText();
System.out.println(commentBody);

HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_JSON);
headers.setAccept(Collections.singletonList(MediaType.APPLICATION_JSON));
String issueUrl ="/rest/api/2/issue/"+outwordIssueKey+"/comment";
JsonNodeFactory jnf = JsonNodeFactory.instance;
ObjectNode payload = jnf.objectNode();
{
payload.put("body",lastComment.get("comments").get("body"));
ObjectNode visibility = payload.putObject("visibility");
{
visibility.put("identifier", "Administrators");

}
}
HttpEntity<Object> commentData = new HttpEntity<>(payload, headers);
ResponseEntity<String> createComment = restTemplate.postForEntity(issueUrl,commentData,String.class);
System.out.println("##########################$");
System.out.println(createComment);
return "sucessss";
}

this code I am attaching please suggest, why getting null data.

please do this on priority

Regards, 

Shubhangi Nikam

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 23, 2024

What library are you using that provides "lastComment"?  Is it one of the last comment apps?

Shubhangi Nikam January 23, 2024
public JsonNode getLastComment(String issueKey) throws JsonProcessingException {
String commentData = "/rest/api/2/issue/" + issueKey + "/comment?orderBy=-created&maxResults=1";
String comment = restTemplate.getForObject(commentData, String.class);
JsonNode comInfo = objectMapper.readTree(comment);
System.out.println("coming in seviceImpl");
System.out.println("*****************************");
JsonNode cominfo = objectMapper.readTree(comment);
System.out.println(cominfo);
return comInfo;
Shubhangi Nikam January 23, 2024

this library or api providing me last comment, as i mentioned in my above code

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 24, 2024

That code seems to be reading all comments, via another library that provides "readTree" function.  You'll need to check the documentation for that.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
FREE
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events