<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: What is the REST equivalent of the OnTAP CLI command &amp;quot;cluster ring show&amp;quot; in ONTAP Rest API Discussions</title>
    <link>https://community.netapp.com/t5/ONTAP-Rest-API-Discussions/What-is-the-REST-equivalent-of-the-OnTAP-CLI-command-quot-cluster-ring-show-quot/m-p/448239#M593</link>
    <description>&lt;P&gt;Hi Scott,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I don't believe there is a public API for this command. You will need to to use the private REST CLI for this. Please see the code below. I tested this successfully in a lab:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;Param(
   [Parameter(Mandatory = $True, HelpMessage = "The cluster name or IP Address")]
   [String]$Cluster,
   [Parameter(Mandatory = $True, HelpMessage = "The Credentials to authenticate to the cluster")]
   [System.Management.Automation.PSCredential]$Credential
)
#'------------------------------------------------------------------------------
#'Set the certificate policy and TLS version.
#'------------------------------------------------------------------------------
Add-Type @"
   using System.Net;
   using System.Security.Cryptography.X509Certificates;
   public class TrustAllCertsPolicy : ICertificatePolicy {
   public bool CheckValidationResult(
   ServicePoint srvPoint, X509Certificate certificate,
   WebRequest request, int certificateProblem) {
      return true;
   }
}
"@
[System.Net.ServicePointManager]::SecurityProtocol  = [System.Net.SecurityProtocolType]'Tls12'
[System.Net.ServicePointManager]::CertificatePolicy = New-Object TrustAllCertsPolicy
#'------------------------------------------------------------------------------
Function Get-NcAuthorization{
   [Alias("Get-NcAuth")]
   [CmdletBinding()]
   Param(
      [Parameter(Mandatory = $True, HelpMessage = "The Credential to authenticate to the cluster")]
      [ValidateNotNullOrEmpty()]
      [System.Management.Automation.PSCredential]$Credential
   )
   #'---------------------------------------------------------------------------
   #'Set the authentication header to connect to the cluster.
   #'---------------------------------------------------------------------------
   $auth    = [System.Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes($Credential.UserName + ':' + $Credential.GetNetworkCredential().Password))
   $headers = @{
      "Authorization" = "Basic $auth"
      "Accept"        = "application/json"
      "Content-Type"  = "application/json"
   }
   Return $headers;
}#'End Function Get-NcAuthorization.
#'------------------------------------------------------------------------------
#'Invoke the command via the private REST CLI.
#'------------------------------------------------------------------------------
$headers         = Get-NcAuth -Credential $Credential
[String]$command = "set diag`;cluster ring show -fields unitname, epoch, db-epoch, db-trnxs, master, online"
[String]$uri     = "https://$Cluster/api/private/cli/cluster/ring?fields=unitname,epoch,db-epoch,db-trnxs,master,online"
Write-Host "Executing Command`: $command"
Try{
   $response = Invoke-RestMethod -Method GET -Uri $uri -Headers $headers -ErrorAction Stop
}Catch{
   Write-Warning -Message $("Failed Executing Command`: $command. Error " + $_.Exception.Message)
   Break;
}
#'------------------------------------------------------------------------------
#'Display the records.
#'------------------------------------------------------------------------------
If($Null -eq $response -Or $response.num_records -eq 0){
   Write-Warning -Message "No records were returned from executing command`: $command"
}Else{
   $response.records
}
#'------------------------------------------------------------------------------&lt;/LI-CODE&gt;&lt;P&gt;To invoke the code use the following syntax:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;PS C:\Scripts\PowerShell\Projects\ClusterRingShow&amp;gt; $credential = Get-Credential -Credential admin

Windows PowerShell credential request
Enter your credentials.
Password for user admin: ********************

PS C:\Scripts\PowerShell\Projects\ClusterRingShow&amp;gt; .\ClusterRingShow.ps1 -Cluster 10.20.30.40 -Credential $credential&lt;/LI-CODE&gt;&lt;P&gt;Hope that helps&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;/Matt&lt;/P&gt;</description>
    <pubDate>Tue, 17 Oct 2023 01:20:48 GMT</pubDate>
    <dc:creator>mbeattie</dc:creator>
    <dc:date>2023-10-17T01:20:48Z</dc:date>
    <item>
      <title>What is the REST equivalent of the OnTAP CLI command "cluster ring show"</title>
      <link>https://community.netapp.com/t5/ONTAP-Rest-API-Discussions/What-is-the-REST-equivalent-of-the-OnTAP-CLI-command-quot-cluster-ring-show-quot/m-p/448231#M592</link>
      <description>&lt;P&gt;Looking to query the "epoch" values for the&amp;nbsp;mgmt, vldb, vifmgr, bcomd, crs, availd units via the OnTAP REST API. Doing this as part of a "health check" type process.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please advise.&lt;/P&gt;</description>
      <pubDate>Wed, 04 Jun 2025 09:44:22 GMT</pubDate>
      <guid>https://community.netapp.com/t5/ONTAP-Rest-API-Discussions/What-is-the-REST-equivalent-of-the-OnTAP-CLI-command-quot-cluster-ring-show-quot/m-p/448231#M592</guid>
      <dc:creator>SCOTT_LINDLEY</dc:creator>
      <dc:date>2025-06-04T09:44:22Z</dc:date>
    </item>
    <item>
      <title>Re: What is the REST equivalent of the OnTAP CLI command "cluster ring show"</title>
      <link>https://community.netapp.com/t5/ONTAP-Rest-API-Discussions/What-is-the-REST-equivalent-of-the-OnTAP-CLI-command-quot-cluster-ring-show-quot/m-p/448239#M593</link>
      <description>&lt;P&gt;Hi Scott,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I don't believe there is a public API for this command. You will need to to use the private REST CLI for this. Please see the code below. I tested this successfully in a lab:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;Param(
   [Parameter(Mandatory = $True, HelpMessage = "The cluster name or IP Address")]
   [String]$Cluster,
   [Parameter(Mandatory = $True, HelpMessage = "The Credentials to authenticate to the cluster")]
   [System.Management.Automation.PSCredential]$Credential
)
#'------------------------------------------------------------------------------
#'Set the certificate policy and TLS version.
#'------------------------------------------------------------------------------
Add-Type @"
   using System.Net;
   using System.Security.Cryptography.X509Certificates;
   public class TrustAllCertsPolicy : ICertificatePolicy {
   public bool CheckValidationResult(
   ServicePoint srvPoint, X509Certificate certificate,
   WebRequest request, int certificateProblem) {
      return true;
   }
}
"@
[System.Net.ServicePointManager]::SecurityProtocol  = [System.Net.SecurityProtocolType]'Tls12'
[System.Net.ServicePointManager]::CertificatePolicy = New-Object TrustAllCertsPolicy
#'------------------------------------------------------------------------------
Function Get-NcAuthorization{
   [Alias("Get-NcAuth")]
   [CmdletBinding()]
   Param(
      [Parameter(Mandatory = $True, HelpMessage = "The Credential to authenticate to the cluster")]
      [ValidateNotNullOrEmpty()]
      [System.Management.Automation.PSCredential]$Credential
   )
   #'---------------------------------------------------------------------------
   #'Set the authentication header to connect to the cluster.
   #'---------------------------------------------------------------------------
   $auth    = [System.Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes($Credential.UserName + ':' + $Credential.GetNetworkCredential().Password))
   $headers = @{
      "Authorization" = "Basic $auth"
      "Accept"        = "application/json"
      "Content-Type"  = "application/json"
   }
   Return $headers;
}#'End Function Get-NcAuthorization.
#'------------------------------------------------------------------------------
#'Invoke the command via the private REST CLI.
#'------------------------------------------------------------------------------
$headers         = Get-NcAuth -Credential $Credential
[String]$command = "set diag`;cluster ring show -fields unitname, epoch, db-epoch, db-trnxs, master, online"
[String]$uri     = "https://$Cluster/api/private/cli/cluster/ring?fields=unitname,epoch,db-epoch,db-trnxs,master,online"
Write-Host "Executing Command`: $command"
Try{
   $response = Invoke-RestMethod -Method GET -Uri $uri -Headers $headers -ErrorAction Stop
}Catch{
   Write-Warning -Message $("Failed Executing Command`: $command. Error " + $_.Exception.Message)
   Break;
}
#'------------------------------------------------------------------------------
#'Display the records.
#'------------------------------------------------------------------------------
If($Null -eq $response -Or $response.num_records -eq 0){
   Write-Warning -Message "No records were returned from executing command`: $command"
}Else{
   $response.records
}
#'------------------------------------------------------------------------------&lt;/LI-CODE&gt;&lt;P&gt;To invoke the code use the following syntax:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;PS C:\Scripts\PowerShell\Projects\ClusterRingShow&amp;gt; $credential = Get-Credential -Credential admin

Windows PowerShell credential request
Enter your credentials.
Password for user admin: ********************

PS C:\Scripts\PowerShell\Projects\ClusterRingShow&amp;gt; .\ClusterRingShow.ps1 -Cluster 10.20.30.40 -Credential $credential&lt;/LI-CODE&gt;&lt;P&gt;Hope that helps&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;/Matt&lt;/P&gt;</description>
      <pubDate>Tue, 17 Oct 2023 01:20:48 GMT</pubDate>
      <guid>https://community.netapp.com/t5/ONTAP-Rest-API-Discussions/What-is-the-REST-equivalent-of-the-OnTAP-CLI-command-quot-cluster-ring-show-quot/m-p/448239#M593</guid>
      <dc:creator>mbeattie</dc:creator>
      <dc:date>2023-10-17T01:20:48Z</dc:date>
    </item>
    <item>
      <title>Re: What is the REST equivalent of the OnTAP CLI command "cluster ring show"</title>
      <link>https://community.netapp.com/t5/ONTAP-Rest-API-Discussions/What-is-the-REST-equivalent-of-the-OnTAP-CLI-command-quot-cluster-ring-show-quot/m-p/448252#M595</link>
      <description>&lt;P&gt;Thanks, somehow I didn't think about the private REST CLI. I really prefer using a publicly published and long-term supported endpoint, but this is still better than the "screen-scraping" I've been doing. I translated the above into a format that my Perl module will understand and implemented it, I'll stick with it until (hopefully) NetApp implements a public endpoint.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm more than a little disappointed that there isn't yet a 1:1 parity between CLI commands and REST endpoints. I seem to recall that this was one of the original design goals but perhaps staffing cuts got in the way. It's distressing to note that the ZAPI/OnTAPi calls were far closer to 1:1 than REST is, especially given that REST has been "in the works" as long as it has. That and I've found far more bugs in the existing REST endpoints than I did in the well over 10 years I spent using ZAPI.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Well, I guess that I got my rant in for the day. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; I'll mark the post as "Accept as Solution" and hope that the NetApp Engineering Team gets wind of this and makes sure it's on the implementation list.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for the assistance!&lt;/P&gt;</description>
      <pubDate>Tue, 17 Oct 2023 18:17:23 GMT</pubDate>
      <guid>https://community.netapp.com/t5/ONTAP-Rest-API-Discussions/What-is-the-REST-equivalent-of-the-OnTAP-CLI-command-quot-cluster-ring-show-quot/m-p/448252#M595</guid>
      <dc:creator>SCOTT_LINDLEY</dc:creator>
      <dc:date>2023-10-17T18:17:23Z</dc:date>
    </item>
    <item>
      <title>Re: What is the REST equivalent of the OnTAP CLI command "cluster ring show"</title>
      <link>https://community.netapp.com/t5/ONTAP-Rest-API-Discussions/What-is-the-REST-equivalent-of-the-OnTAP-CLI-command-quot-cluster-ring-show-quot/m-p/448254#M596</link>
      <description>&lt;P&gt;Hi Scott,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Glad that solution works for you (even if not ideal it's definitely better than CLI screen scraping). I can certainly empathize with your viewpoint and will definitely forward your feedback. Thanks&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;/Matt&lt;/P&gt;</description>
      <pubDate>Wed, 18 Oct 2023 02:22:26 GMT</pubDate>
      <guid>https://community.netapp.com/t5/ONTAP-Rest-API-Discussions/What-is-the-REST-equivalent-of-the-OnTAP-CLI-command-quot-cluster-ring-show-quot/m-p/448254#M596</guid>
      <dc:creator>mbeattie</dc:creator>
      <dc:date>2023-10-18T02:22:26Z</dc:date>
    </item>
  </channel>
</rss>

