Posted By

javadude on 12/26/09


Tagged

snipplr groovy xml-rpc


Versions (?)

XML-RPC Access to Snipplr with Groovy


 / Published in: Groovy
 

URL: http://www.bighugesystems.com/wordpress/?p=42

  1. import groovy.net.xmlrpc.*
  2. import java.net.ServerSocket
  3.  
  4. def serverProxy = new XMLRPCServerProxy("http://snipplr.com/xml-rpc.php")
  5.  
  6. // check api key
  7. // returns 1 if valid
  8. serverProxy.user.checkkey("[yourkey]")
  9.  
  10. // returns all languages on Snipplr as map
  11. def langMap = serverProxy.languages.list("[yourkey]","")
  12. langMap.each { println it.value }
  13.  
  14. // returns list of (your own!) snippets
  15. def snippets = serverProxy.snippet.list("[yourkey]","groovy")
  16. println "You have ${snippets.size()} snippets and favorites"
  17. snippets.each { println it }
  18.  
  19. // access a specific snippet
  20. def snippet = serverProxy.snippet.get("25410")
  21. println snippet
  22. // individual attributes
  23. println snippet.source
  24. println snippet.tags
  25. println snippet.created

Report this snippet  

You need to login to post a comment.