@Grab(group='org.apache.httpcomponents', module='httpclient', version='4.1.2') import org.apache.http.client.methods.* import org.apache.http.impl.client.* import groovy.json.* httpclient = new DefaultHttpClient() // 指定のタクソノミーのボキャブラリー情報を取得 vid="3" method = new HttpGet("http://localhost/drupal/rest/taxonomy_vocabulary/${vid}") response = httpclient.execute(method) println response.getStatusLine().getStatusCode() json = new JsonSlurper().parseText(response.getEntity().getContent().text) println "名前:${json.name}" println "説明:${json.description}" println "machine_name:${json.machine_name}"
動作環境
groovy 1.8.4, JDK7 Update1, drupal 7.1.0, services-7.x-3.1, ctools-7.x-1.0-rc1, spyc-0.5
0 件のコメント:
コメントを投稿