Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

How to invoke REST from JIRA Script Runner Behaviour

Yves Martin
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.
February 22, 2018

 Hello

I am following Adaptavist Script Runner documentation to add a behaviour in ServiceDesk (but I guess it would be the same for JIRA core),

and I would like to query a REST endpoint to retreive information to append into custom field description, parameter comes from another form field, reporter in my use case.

I have found no REST endpoint client invocation code snippet except in the specific "select list conversions" example.

What is the best way to invoke a custom REST endpoint to retrieve a single value as a behaviour ?

1 answer

Suggest an answer

Log in or Sign up to answer
0 votes
Neta Elyakim
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.
May 1, 2018

https://scriptrunner.adaptavist.com/latest/jira/behaviours-conversions.html#_walkthrough_external_rest_service

 

See "Behaviour" on this page- you can send rest request with behaviour and convert the JSON respond to select list values

Yves Martin
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.
May 2, 2018

I request for a way to query a REST endpoint "manually" within specific client-side Behaviour script code, so that it works from Service Desk customer portal create screen (as "select list conversion" does not work there yet).

I am looking for some kind of "REST request factory" Groovy snippet I may use to invoke my own Script Runner endpoint and retrieve results...

Neta Elyakim
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.
May 2, 2018

Do you need help with the REST or the Behaviour?

Behaviour works in service desk portal -https://scriptrunner.adaptavist.com/latest/jira/behaviours-servicedesk.html

You want the customer to enter the rest request and then he will see the result with behaviour ?  

Please explain more about the process

Yves Martin
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 31, 2018

I expect my behaviour script to call a REST endpoint (whatever it is) and process JSON return... but I have found no example or scriptlet about it - and I am not comfortable with Groovy to guess how to do it.

By the way, I gave up my REST endpoints designed to be registered in "select list conversion" (not available in ServiceDesk yet) and move SQL queries directly into behaviour scripts.

But I am still interested in behaviour script example to invoke REST method and parse JSON anwser.

Maikes
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 23, 2019

I 'm with the same situation. Someone can help ? 

How to invoke and the coorrelation between behaviour and REST end Points in script runner ?? 

Thank you

TAGS
AUG Leaders

Atlassian Community Events