Skip to content

Instantly share code, notes, and snippets.

@NetworksAreMadeOfString
Created June 9, 2012 23:17
Show Gist options
  • Save NetworksAreMadeOfString/2903007 to your computer and use it in GitHub Desktop.
Save NetworksAreMadeOfString/2903007 to your computer and use it in GitHub Desktop.
Example of making an API request to a Chef server to get the Cookbooks list
String Path = "/cookbooks";
this.httpget = new HttpGet(this.ChefURL + Path);
List <NameValuePair> Headers = ChefAuth.GetHeaders(Path, "");
for(int i = 0; i < Headers.size(); i++)
{
this.httpget.setHeader(Headers.get(i).getName(),Headers.get(i).getValue());
}
String jsonTempString = httpClient.execute(this.httpget, responseHandler);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment