Skip to content

Instantly share code, notes, and snippets.

@chelnak
Last active October 6, 2015 20:07
Show Gist options
  • Select an option

  • Save chelnak/ca99bb0ef18b33d1afd1 to your computer and use it in GitHub Desktop.

Select an option

Save chelnak/ca99bb0ef18b33d1afd1 to your computer and use it in GitHub Desktop.
var endpoint = "com.vmware.vcac.core.cafe.reservation.api";
var restClient = vCACCAFEHost.createRestClient(endpoint);
System.log(restClient.getUrl());
var resourceUrl = "reservations";
var response = restClient.get(resourceUrl);
//return type is vCACCAFEServiceResponse
var body = response.getBodyAsJson();
//Reservaiton data is stored in the content array
var reservations = body['content'];
//loop through each reservation and print the name
for (var i = 0; i < reservations.length; i++) {
System.log(reservations[i].name);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment