Created
June 13, 2013 14:08
-
-
Save manute/5773960 to your computer and use it in GitHub Desktop.
Rest Client groovy for get all documents in scribd
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import groovy.json.* | |
import groovyx.net.http.* | |
import static groovyx.net.http.ContentType.* | |
import groovy.xml.* | |
final API_URL = "http://api.scribd.com/api" | |
final API_KEY = "api_key_scribd" | |
def restScribd = new RESTClient(API_URL) | |
def resp = restScribd.get(query:[method:'docs.getList',api_key:API_KEY], | |
contentType: TEXT, | |
headers : [Accept : 'application/xml'] ) | |
println resp.status | |
def respXML = resp.data.text | |
println respXML | |
def root = new XmlSlurper().parseText(respXML) | |
root.resultset.result.each { | |
println it.title | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment