The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

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

What is the syntax for a Groovy HTTP Request

Ernest Phillips
October 26, 2018

I am attempting to use ScriptRunner to make a REST api call. 

However, I am not certain that I have the syntax correct or where I can test to see if I am getting the data I am looking for.

 

This is the script I am working with :

 

import groovyx.net.http.*
import groovyx.net.http.ContentType.*
import groovyx.net.http.Method.*
import net.sf.json.*


def http = new HTTPBuilder('https://api.somewebsite.com')
http.get( path : '/MyPath/GoesHere/',
contentType : JSON,
query : [
token: 'MyToken',
license:'ABC123'] )
{ resp, reader -> println "response status: ${resp}"
println 'Response data: -----' }

 

0 answers

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

TAGS
AUG Leaders

Atlassian Community Events