<?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 NetApp API for snapshot restore in ONTAP Rest API Discussions</title>
    <link>https://community.netapp.com/t5/ONTAP-Rest-API-Discussions/NetApp-API-for-snapshot-restore/m-p/443943#M499</link>
    <description>&lt;P&gt;Hi Everyone,&lt;/P&gt;&lt;P&gt;&amp;nbsp;Please could someone help me with API script to DB volume restore from the latest snapshot.&lt;/P&gt;</description>
    <pubDate>Wed, 04 Jun 2025 09:49:36 GMT</pubDate>
    <dc:creator>Elan_LV</dc:creator>
    <dc:date>2025-06-04T09:49:36Z</dc:date>
    <item>
      <title>NetApp API for snapshot restore</title>
      <link>https://community.netapp.com/t5/ONTAP-Rest-API-Discussions/NetApp-API-for-snapshot-restore/m-p/443943#M499</link>
      <description>&lt;P&gt;Hi Everyone,&lt;/P&gt;&lt;P&gt;&amp;nbsp;Please could someone help me with API script to DB volume restore from the latest snapshot.&lt;/P&gt;</description>
      <pubDate>Wed, 04 Jun 2025 09:49:36 GMT</pubDate>
      <guid>https://community.netapp.com/t5/ONTAP-Rest-API-Discussions/NetApp-API-for-snapshot-restore/m-p/443943#M499</guid>
      <dc:creator>Elan_LV</dc:creator>
      <dc:date>2025-06-04T09:49:36Z</dc:date>
    </item>
    <item>
      <title>Re: NetApp API for snapshot restore</title>
      <link>https://community.netapp.com/t5/ONTAP-Rest-API-Discussions/NetApp-API-for-snapshot-restore/m-p/443970#M504</link>
      <description>&lt;P&gt;Sure, can you try something like this to restore a volume from the latest snapshot.&lt;/P&gt;&lt;LI-CODE lang="python"&gt;# Specify the uuid of the volume
vol_uuid = 'your_volume_uuid'
snapshot_name = None  # Set to None to use the latest snapshot

# Find the snapshot
snapshots = Snapshot.get_collection(vol_uuid)

latest_snapshot = None
latest_snapshot_time = 0
for snapshot in snapshots:
    if latest_snapshot == None or snapshot.create_time &amp;gt; latest_snapshot_time:
        latest_snapshot_time = snapshot.create_time
        latest_snapshot = snapshot

snapshot_name = latest_snapshot.name

# Restore the volume from the snapshot
vol = Volume(uuid=vol_uuid)
vol.patch(**{'restore_to.snapshot.name': snapshot_name})&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is a previous discussion on just restoring from a given snapshot:&amp;nbsp;&lt;A href="https://community.netapp.com/t5/ONTAP-Rest-API-Discussions/Snapshot-Restore/td-p/159284" target="_blank"&gt;https://community.netapp.com/t5/ONTAP-Rest-API-Discussions/Snapshot-Restore/td-p/159284&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 02 May 2023 23:57:16 GMT</pubDate>
      <guid>https://community.netapp.com/t5/ONTAP-Rest-API-Discussions/NetApp-API-for-snapshot-restore/m-p/443970#M504</guid>
      <dc:creator>ddegraaf</dc:creator>
      <dc:date>2023-05-02T23:57:16Z</dc:date>
    </item>
  </channel>
</rss>

