Skip to content

Instantly share code, notes, and snippets.

@manute
Created June 13, 2013 14:08
Show Gist options
  • Save manute/5773960 to your computer and use it in GitHub Desktop.
Save manute/5773960 to your computer and use it in GitHub Desktop.
Rest Client groovy for get all documents in scribd
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