VMware Cloud Community
billdossett
Hot Shot
Hot Shot
Jump to solution

VCF API and postman

Hi,

I am trying to automate password rotation using the SDDC manager.  This is probably more my ineptness at curl and postman, but I can't seem to get a token from the SDDC manager in postman.  I can curl it from a linux command line, get the token and then use it in postman - but ultimately I want to take the postman code into a python script that I can run as part of the automation that will get the token, then use the token to get all the passwords after a password rotation and store them in CyberArk.

So I curl

curl -X POST -H "Content-Type: application/json" -d '{"username": "administrator@vsphere.local","password": "VMware123!"}' --insecure https://10.0.0.4/v1/tokens

and this returns me a token - I can then use that in postman.  But when I try to put the above command into postman or translate it into a request in python, I just get

"errorCode""VCF_RUNTIME_ERROR",
    "arguments": [],
    "message""Something went wrong. Please retry or contact the service provider and provide the reference token.",
    "referenceToken""773RKU"
}
 
I am using basic auth and this is what the curl command from postman looks like when I look at the curl code.
 
curl --location --request POST 'https://10.0.9.4/v1/tokens' \
--header 'Accept: application/json' \
--header 'Authorization: Basic xxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
 
i have x'd out the user/password hash here....  but as far as I can tell this is basically the same as the first curl command above...  I have also tried putting the user and pass into the data - but no matter what I try I get the same error message.  Hoping someone could help with this here, but maybe I need to post something on a postman forum somewhere.   I have also imported the swagger file from the SDDC manager, but I can't get the tokens api to work from that either, same error message.
 
Thanks for any ideas at all, I am stuck.
 
Bill
 
 
Bill Dossett
Reply
0 Kudos
1 Solution

Accepted Solutions
Campos69
Enthusiast
Enthusiast
Jump to solution

VMware Cloud Foundation has a number of Public APIs, the documentation around this can easily be found by logging into the SDDC Manager UI and selecting the Developer Center. From here you can even execute an API on the running system.

myhtspace

View solution in original post

3 Replies
Campos69
Enthusiast
Enthusiast
Jump to solution

VMware Cloud Foundation has a number of Public APIs, the documentation around this can easily be found by logging into the SDDC Manager UI and selecting the Developer Center. From here you can even execute an API on the running system.

myhtspace

billdossett
Hot Shot
Hot Shot
Jump to solution

thanks, I hadn't noticed the explorer... it had the snippet of code I needed to put into the body.

Bill Dossett
Tags (1)
Reply
0 Kudos
NFerrar
Enthusiast
Enthusiast
Jump to solution

This is handy to if you want to pull all the SDDC Manager APIs into Postman: Create VMware Cloud Foundation API Collection in Postman – My Cloudy World (my-cloudy-world.com)

Reply
0 Kudos