JiraLink in RestEndpoint Call (scriptrunner) didn't is not done

FROMAGE Nathan October 4, 2022

I made a macro in scriptruner, this macro is lazy loaded. I need to get the pageName and the spaceKey so i get them in the javascript of the macro and i do a call to a scriptrunner RestEndpoint.

In this RestEndpoint i made JiraLink to get issues from jira.

When i call the macro it works well but when i do a call to the RestEndpoint from another java plugin or postman the jiraLink won't return data.

Why ? Does scriptrunner RestEndpoint can be used only by scriptrunner element ? 

1 answer

0 votes
Radek Dostál
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.
October 4, 2022

No, those endpoints can be accessed like any other out of box endpoints (with the benefit of being able to put extra restriction on it, like available to specific groups only, etc.).

The question is how you are calling it and what "won't return data" means - empty body, or forbidden?

You might be making a call to Confluence - you have a distinct authentication to communicate with Confluence - such as basic, cookie, pat - but to communicate with Jira, you need different authentication data, since they're 2 different apps.

What might happen is if you have application link between the 2 apps, the ajax call from Confluence to Jira might work (not entirely sure here though.. but Confluence might be able to fill out authentication for Jira for the user automatically, but I'm not certain about it without testing).

FROMAGE Nathan October 4, 2022

For the restEndpoint call by the macro we have the requested issue but for the java one the jiralink did'nt return the issue but the requestcode still 200

Radek Dostál
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.
October 4, 2022

If you're getting 200 then it sounds like something in the endpoint's code, where it returns just a 200 without any entity in response.

You can add log.warn(String message) to that endpoint, call it, and then look up what it logged (the endpoint should have a history with logs in webUI). Maybe you're missing some parameters or it didn't evaluate something as expected.

FROMAGE Nathan October 4, 2022

The only difference between the configuration, the call and the response is the response.

JiraLinkDiff.PNG

The first one is the jiralink response from the restEndpoint call from a java plugin and the second one is the jiralink response from the restEndpoint call from a custom scriptrunner macro

Radek Dostál
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.
October 4, 2022

The same configuration and the same call cannot result in different response, if this endpoint is "static" in the sense it should always return the exact same response.

Something's different between the calls.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events