VMware Workspace ONE Community
GiorgioFalcone
Enthusiast
Enthusiast

How start rest api script

Hi,

 

I would like to automate via rest api some operations that my colleagues do manually.
I just learned a little of nodeJS and XHR and they should be enough to create some scripts.

 

I don't know how to login to the console. I red the rest api manual and the help page at https://server/api/help/#!/apis , but I don't get on how to connect to the server.

 

Could anyone help me with the commands?
Like: what url do I neet to contact and what do I need to put in the request header.

 

Thank you in advance
Giorgio
Labels (1)
Reply
0 Kudos
4 Replies
LuisCanto
Contributor
Contributor

Hello,
You need to generate an API Key from the console and to have an admin user who will connecto trough the API. Then you need to send a HTTPS GET/POST/PUT/DELETE request with some auth headers.

Look for REST API Quick start in the WMWare KB section.
Reply
0 Kudos
JamesCorrJamesC
Enthusiast
Enthusiast

Would powershell be an option for you?
Reply
0 Kudos
GiorgioFalcone
Enthusiast
Enthusiast

Hi James,

I searched online for examples of basic auth via http and with some copy & paste I managed to connect via rest api and do what I needed to do. I used nodejs and fetch

Thank for help
Giorgio
Reply
0 Kudos
admin
Immortal
Immortal

Hello,

It's kind of easy to start, as they said on the top you need to create REST API tenant code (Key) in the advanced settings, then you'll need a admin user and an admin role. I'll suggest to create one specific role for the API access and the operations you want automate.

In order to connect you need to put tenant code  and user-pass on the header of the request. user-pass needs to be encoded.

I'll recommend to use Post-Man or Insomnia apps in order to test your API connection.

Regards.

Reply
0 Kudos