- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hey,
The Id is the correct field you should use when need to call object-related APIs (like recovery plans, protection groups, etc).
Here I suspect there is some issue with the PowerCLI cmdlets and the REST API itself.
Until the problem is fixed, you can use PowerShell to communicate with this exact API endpoint. Here is a snippet:
// Authenticate to the local site
$srmConnection = Connect-SrmSdkServer -Server $srmLocalHostName `
-User $localVcUsername `
-Password $localVcPassword `
-RemoteUser $remoteVcUsername `
-RemotePassword $remoteVcPassword
$pairings = Invoke-SrmGetPairings
$pairingId = $srmConnection.ConnectedPairing.PairingId
// Find the desired plan
$plans = Invoke-SrmGetAllRecoveryPlans -pairingId $pairingId
$plan = $plans.list | Where-Object { $_.Name -eq "PlanName1" }
$planId = $plan.Id
// Get the current API session
$sessionId = $srmConnection.SessionId
// And use it to construct request headers
$global:headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$global:headers.Add("x-dr-session", $sessionId)
$global:headers.Add("Content-Type", "application/json")
// The view mode
$viewMode = "test"
// Construct the recovery steps URL
$recoveryStepsUrl = $srmConnection.ServerUri.AbsoluteUri + "api/rest/srm/v2/pairings/${pairingId}/recovery-management/plans/${planId}/recovery-steps/${viewMode}"
// Make the call
$response = Invoke-RestMethod $recoveryStepsUrl -Method 'GET' -Headers $global:headers
// $response will contain all recovery steps
Some API examples using PowerShell and PowerCLI:
https://github.com/vmware-samples/site-recovery-manager-rest-api-examples/tree/main/power-shell
Hope this helps,
Zdravko Ivanov