Zerto Virtual Replication APIs : VMs that are Protected API : Code Examples
  
Code Examples
For complete code examples, see Code Samples.
/v1/vms cURL Code Example
Retrieve the list of all protected virtual machines and information about them.
curl -D responseHeader -H "Content-Type: application/json" –H "Accept: application/json -H "x-zerto-session: 9UDQD6RG7YF33QJLWQXGJV8C453N277NA22P7FSNWVZCJTWCBRHQ" https://127.0.0.1:9669/v1/vms
For a more code examples, see cURL Code.
/v1/vms C# Code Example
Retrieve the list of all protected virtual machines. For a full code example, including setting up a session, see C# Code.
/*
 * Example - get all protected virtual machines, filtering is not used
 */
private void GetVMs() {
  Console.WriteLine("\nRequest the list of protected virtual machines:");
  Console.WriteLine("================================================");
  string apiAddress = m_baseAddress + "vms";
  string result = ExecuteHttpGet(apiAddress, m_format, m_sessionId);
  List<VmApi> vms = (List<VmApi>)DeserializeObjectFromJson(result, typeof(List<VmApi>));
  Console.WriteLine("Found " + vms.Count + " protected virtual machines.");
  // Go Over all virtual machines fetching them one by one
  for (int i = 0;i < vms.Count;i++) {
    Console.WriteLine((i+1) + ". " + vms[i].Description);
  }
}