I am posting this, as I’m JUST starting to learn APIs.
In all my years in IT, I have avoided using APIs.
I always thought they were for someone else with a higher purpose.
So why post this?
Well, it might help someone get going with APIs, same as me.
No, this is not a tutorial.
This is me, using other persons’ efforts, and making an easy to consume use of APIs for the first time.
Seasoned API user?
Please give me some slack here, as this is just to get started….
A couple of blog posts stood out for me when learning this…
https://blog.postman.com/curl-and-postman-work-wonderfully-together/
https://www.vgemba.net/vmware/VCSA-API-Postman/
First off, you will be using software called Postman.
The free tier is enough for this summary.
So here’s my take on the actions in Postman, taken from the 2 blogs…
# In Postman, click + in the scratch area
# Run a GET using the URL of your vCenter Server
(i.e. – https://vcenterServer.lab.wei/api/vcenter/cluster)
# Server Certificate Error, disable the SSL verification (not for prod though)
# BODY comes back with UNAUTHENTICATED
# Got to AUTH Section
# Select BASIC AUTH
# Enter Credentials
# Change GET to POST
# Change URL to vCenter Server (use your FQDN)
(i.e. https://vcenterServer.lab.wei/api/session)
# BODY returns with Session ID: (COPY THIS!…you’ll soon need it)
# NOW….Let’s setup to use the API Key
# Got to AUTH Section
# Select API KEY
# For KEY ID, Enter: vmware-api-session-id
# For VALUE, paste in your Session ID
# Docs state this is a HEADER parameter, AND TO pull down, ensure HEADER is selected
# Now Let’s get some info on our vSphere Clusters!
# Change method to GET
# Change URL to (use your FQDN):
(i.e. – https://vcenterServer.lab.wei/api/vcenter/cluster)
# You should get back a response….
# Cleanup …
# Change method to DELETE
# Change URL to (use your FQDN:
https://vcenterServer.lab.wei/api/session
# Under AUTH, make sure API KEY
# Use the same key as before:
vmware-api-session-id
# Paste your same SESSION ID
# ADD TO pull down, ensure HEADER is selected