Using groovy how to call an existing endpoint and pass in 2 parameters
I have an existing endpoint request, what I need to do is call an existing endpoint request and pass in 2 parameters using Groovy.
I figured it out see below for my example
import groovyx.net.http.HTTPBuilder
import static groovyx.net.http.ContentType.*
import static groovyx.net.http.Method.*
def r = "[1,"createCompany",1,1,{"1":{"rec":{"3":{"str":"2017-02-07"},"4":{"str":"US"},"5":{"rec":{"1":{"i64":255130}}},"6":{"tf":0},"7":{"tf":1},"8":{"i64":1},"9":{"str":"QATestCompany_X14864936528160001"},"10":{"str":"_newcompany"},"11":{"i64":1}}}}]"
def http = new HTTPBuilder('https://myservice.service.us.com/')
http.request( POST ) {
uri.path = 'clientservice/thrift/json'
requestContentType = "application/json"
body = r
response.success = { resp ->
log.info "POST response status: ${resp.statusLine}"
}
}