Solved

API POST : Add VM to data protection

  • 3 January 2018
  • 4 replies
  • 780 views

Badge +3
Hello, I'm beginner at Nx REST API.

I start with API GET to get value of cluster, it's no problem.

But now next project "Auto add VM to data protection script" with API POST, I can add vm to data protection by html REST API.



Next step, I want to run auto script. I have a code when I click "Try it out!"

{ "name": "DGT_name", "vms": [ { "vmHandle": xxxxx, "vmId": "xxxxx", "vmName": "VM_NAME1", "vmPowerStateOnRecovery": "Power state at time of snapshot", "consistencyGroup": "VM_NAME1", "appConsistentSnapshots": false, "vmRecoverability": [], "vmFiles": null, "relatedEntityUuids": [] } ], "nfsFiles": [], "volumeGroups": [], "vstoreId": null, "active": true, "remoteSiteNames": [], "cronSchedules": [], "minSnapshotToRetain": null, "nextSnapshotTimeUsecs": null, "pendingReplicationCount": 0, "ongoingReplicationCount": 0, "markedForRemoval": false, "hybridSchedulesCount": null, "metroAvail": null, "totalUserWrittenBytes": null, "replicationLinks": [], "syncReplications": null, "annotations": []}
I don't know how to use this code

Please give me "NX REST API using POST" example. (I'm very happy if you give me a data protection script haha)

Thank you very much.

Sorry for my poor english.
icon

Best answer by sandeepmp 3 January 2018, 14:50

View original

4 replies

Userlevel 4
Badge +19
Rinnamo

You can refer the below code.

https://github.com/nutanix/Automation/blob/master/NTNX-Protect-VM.ps1
Badge +3
Thank you, I will learn it now!

.. I have some question, can this script write in python ?
Badge
Theres one that has been created before. : https://github.com/nutanix/Connection-viaREST/blob/master/api_python_authenticate_pd.py
Userlevel 7
Badge +35
Hi @Rinnamo

Did the reply from @Winson_sou help? If yes, consider clicking the 'like' and 'best answer' link on the reply - that will help others find answers to similar questions much quicker, Thanks

Reply