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