Rest APIs:
1) GET: https://{vcenter}/api/vcenter/topology/nodes
2) GET: https://{vcenter}/api/vcenter/topology/replication-status
Web Service sample java code:
Here is the sample code to get all linked vCenters by using userAgent , here userAgent is the name of user agent or application. In my case I opened my linked VC atleast onetime with web client, so userAgent comparing with "web-client" in the code.
Set<String> vcList = new HashSet<String>();
System.out.println(serviceInstance.getAboutInfo().getInstanceUuid());
SessionManager sessionMgr = serviceInstance.getSessionManager();
UserSession[] userSessions = sessionMgr.getSessionList();
for (UserSession userSession:userSessions) {
if (userSession.getUserName().contains("vsphere-webclient")) {
vcList.add(userSession.getIpAddress());
}
}