From vSphere 6.7 onwards VMware introduced a section called the Developer Center where it provides a location for you to browse through the API structure and understand how to call and use the API. There is a section called "Code Capture" where once you set it up you can record your steps that you perform in GUI and then it will translate those steps to code.
How to get started?
- In vSphere click on Menu and select Developer Center
- Select Code Capture tab and if you have not enabled code capture before then you should see the screen below. Click on the slider to enable code capture
- Once you have enabled code capture you should see the start record button and also on the top right you should see a record icon button. At this point you can either press start record button or navigate to where you want to record and then press the record icon button. The record icon should flash and change as you are recording.
- Once you have finished press the record icon on the top right and it should bring you back to the code capture screen where you can see the code in PowerCLI for creating a datacenter. To view the code in a different language click on PowerCLI
- You can now copy or download the code to be used. As you have now enabled code capture you can capture the code anytime by pressing the record icon on the top right of the screen. You will get the prompt below when you first do it and you can select the option to not show the warning again