Skip to content

Instantly share code, notes, and snippets.

@farito
Created October 14, 2011 14:23
Show Gist options
  • Save farito/1287254 to your computer and use it in GitHub Desktop.
Save farito/1287254 to your computer and use it in GitHub Desktop.
Llamada a api
def getItemApi(String item){
RESTClient rest = new RESTClient()
Object resp = rest.get([uri: "http://ec2-67-202-25-72.compute-1.amazonaws.com:8080", path : '/items/MLA123456', contentType : JSON])
println resp.getStatus()
int size = resp.responseData.available();
char[] theChars = new char[size];
byte[] bytes = new byte[size];
resp.responseData.read(bytes, 0, size);
for (int i = 0; i < size;)
theChars[i] = (char)(bytes[i++]&0xff);
String result = new String(theChars);
println result
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment