groovy
RESTClient
Suche…
Einführung
Groovys HTTP-Client-Nutzung, Beispiele und Fallstricke.
GET Request
@Grab(group='org.codehaus.groovy.modules.http-builder', module='http-builder', version='0.7' )
import groovyx.net.http.RESTClient
try {
def restClient = new RESTClient("http://weathers.co")
def response = restClient.get(path: '/api.php', query: ['city': 'Prague'])
println "Status : ${response.status}"
println "Body : ${response.data.text}"
} catch (Exception e) {
println "Error : ${e.statusCode}"
println "Message : ${e.response.data}"
}
Modified text is an extract of the original Stack Overflow Documentation
Lizenziert unter CC BY-SA 3.0
Nicht angeschlossen an Stack Overflow