Why do we need automation? The answer is simple, to save time from doing the same repetitive tasks multiple times.
Imagine you are doing a maintenance activity & you have 1 hour as the maintenance window. During this 1 hour, in every 5 minutes, you have a need to check vCenter health status. You can just think of logging in to VCSA VAMI and keep checking the summary page in every 5 minutes. Doable? Not really. Still, what if you have a requirement to check similar details for a month(s). Not at all doable, right? This is where automation kicks in.

When I thought of starting with vSphere Automation, I had no definite Start Point. All I had in my mind was, some tasks that I perform multiple times in a day & I wanted to use Python, as I feel little more comfortable with it.
My vague YouTube Search took me to Talking Code – Getting Started with the vSphere Automation SDK for Python. I then installed items like python3 & created as well as activated virtual environment for python3 as mentioned in this video. Don’t forget the export PYTHONPATH command.

I then found GitHub document which has more details about these.

Now coming to the coding part, the best place to get help would be Developer Center within HTML5 Client (Once logged into vCenter, you can click on the Main Menu drop down & you would be able to see this option) link would be like https://<vcenter_fqdn_or_ip>/ui/app/devcenter/api-explorer
Here you would be able to test APIs as well as check request, response formats, etc. Similar offline documentation can be found here.

Sample work: I would show how you can code for enabling SSH on vCenter using a python script

First of all import required modules like requests, json, ssl, sys, os, argparse

Below is to disable warnings & ignoring verification of ssl certificates (not recommended in production setups)
from requests.packages.urllib3.exceptions import InsecureRequestWarningrequests.packages.urllib3.disable_warnings(InsecureRequestWarning)
sid=requests.Session()
sid.verify=False

Define an argument parser method that would accept VCSA FQDN/IP, Username & Password. You can look for such method in sample codes.

Now we have to create a session id which we will be using in the rest of our code. We can create that using

session_response= sid.post('https://'+args.host+'/rest/com/vmware/cis/session',auth=(args.user,args.password))
session_id = session_response.json()['value']

host, user & password is what I have defined to be used in argument parser.

Below is to check ssh status

vcssh_check = sid.get('https://'+args.host+'/rest/appliance/access/ssh', headers={"vmware-api-session-id": session_id})
stat = vcssh_check.json()['value']

stat would have the value true or false, which means ssh is enabled, disabled respectively.

To enable SSH, you can create a PUT request as documented here.

Hope this article helps!