import groovy json JsonSlurper def sapuser ws_jira def sappass w0rd de

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import groovy.json.JsonSlurper
def sapuser = "ws_jira"
def sappass = "P@\$\$w0rd"
def url = "https://${sapuser}:${sappass}@vmxhrd01.corp.mail.ru:443/rest_api/jira/get_mvz_resp?sap-client=300"
def connection = new URL( url ).openConnection()
def jsonText = '''
{"input":{"kostl":"SOCD-DEVMS"}}
'''
if ( connection.responseCode == connection.HTTP_OK ) {
def json = new JsonSlurper().parseText( connection.inputStream.jsonText )
// print some basic information about the video
println "Video '${json.items[0].snippet.title}' was published by " +
"'${json.items[0].snippet.channelTitle}' at '${json.items[0].snippet.publishedAt}"
} else {
println "ERROR ${connection.responseCode}"
}