Question

Creating snapshots / recovery points

  • 4 April 2020
  • 3 replies
  • 3523 views

Badge +1

Hi!

I’m trying to find a way to create automatically expiring snapshots via API. I know I can use v2 api to create normal snapshots, and with Playbooks I can create snaphots which have an expiry time. Is there a way to create recovery points (on-demand) or run playbooks via API? Thanks!

 


3 replies

Userlevel 6
Badge +5

Hey @eino so I am not sure if we can use Playbooks with rest APIs, let me search for it. But I know that we can create Playbooks using Webhooks. Here is the procedure to do so 
https://portal.nutanix.com/page/documents/details?targetId=Prism-Central-Guide-Prism-v5_17%3Amul-playbook-webhook-create-pc-t.html

 

Userlevel 6
Badge +5

So @eino , I researched a bit so running the playbook via API isn’t an issue.

 

You first create a playbook and then trigger a webhook by running a POST to the Prism Central URL. That’s even integrated into PC in the playbook section(the document I mentioned above). If you set it that way, you run a POST call  against: https://<pc>:9440/api/nutanix/v3/action_rules/trigger and add the webhook ID to the JSON call:
 

{
  "trigger_type": "incoming_webhook_trigger",
  "trigger_instance_list": [{
    "webhook_id": "90d035e1-0a40-44b8-a978-1c5b0c345f7c",
    "string1": "<STRING_1>",
    "string2": "<STRING_2>",
    "string3": "<STRING_3>",
    "string4": "<STRING_4>",
    "string5": "<STRING_5>",
    "integer1": "<INTEGER_1>",
    "integer2": "<INTEGER_2>",
    "integer3": "<INTEGER_3>",
    "integer4": "<INTEGER_4>",
    "integer5": "<INTEGER_5>",
    "entity1": "{\"type\":\"<ENTITY_TYPE>\",\"name\":\"<ENTITY_NAME>\",\"uuid\":\"<ENTITY_UUID>\"}",
    "entity2": "{\"type\":\"<ENTITY_TYPE>\",\"name\":\"<ENTITY_NAME>\",\"uuid\":\"<ENTITY_UUID>\"}"
  }]
}

So basically when you create a playbook, you can simply set a trigger and select a webhook as the trigger.

 

I hope this will help. Let me know if you need any clarifications on this. :smiley:

Userlevel 6
Badge +5

Hey @eino , just following up on your query. Did the above help?

 

Did you test the above? Let me know if you need anything.:smile:

Reply