Zerto Virtual Replication APIs : /v1/ API : Code Examples
  
Code Examples
The /v1/API does not require a session.
/v1/ cURL Code Example
Retrieve the list of APIs.
curl https://zvm_ip:9669/v1/
Returns the list of APIs.
[{"href":"https:\/\/10.100.0.51:9669\/v1\/events","rel":"down","type":"IEventsService"},{"href":"https:\/\/10.100.0.51:9669\/v1\/vpgs","rel":"down","type":"IVpgService"},{"href":"https:\/\/10.100.0.51:9669\/v1\/vms","rel":"down","type":"IVmService"},{"href":"https:\/\/10.100.0.51:9669\/v1\/vras","rel":"down","type":"IVraService"},{"href":"https:\/\/10.100.0.51:9669\/v1\/peersites","rel":"down","type":"IPeerSitesService"},{"href":"https:\/\/10.100.0.51:9669\/v1\/session","rel":"down","type":"ISessionService"},{"href":"https:\/\/10.100.0.51:9669\/v1\/tasks","rel":"down","type":"ITasksService"},{"href":"https:\/\/10.100.0.51:9669\/v1\/serviceprofiles","rel":"down","type":"IServiceProfilesService"},{"href":"https:\/\/10.100.0.51:9669\/v1\/virtualizationsites","rel":"down","type":"IVirtualizationSitesService"},{"href":"https:\/\/10.100.0.51:9669\/v1\/zorgs","rel":"down","type":"IZorgsService"},{"href":"https:\/\/10.100.0.51:9669\/v1\/localsite","rel":"down","type":"ILocalSiteService"},{"href":"https:\/\/10.100.0.51:9669\/v1\/alerts","rel":"down","type":"IAlertsService"}]
For a more code examples, see cURL Code.
/v1/ C# Code Example
Retrieve the list of APIs. For a full code example, including setting up a session, see C# Code.
/*
 * Example - get the list of APIs. This does not require a session
 */
private void ListApis() {
  string result = ExecuteHttpGet(m_baseAddress, m_format, null);
 
  Console.WriteLine("The result is a list of uri addresses each representing an API:");
  Console.WriteLine("=====================================================");
  List<StringResourceLink> uris = (List<StringResourceLink>)DeserializeObjectFromJson(result, typeof(List<StringResourceLink>));
  foreach (var stringResourceLink in uris) {
    Console.WriteLine(stringResourceLink.ResourceLocation);
  }
}