You can access the VMware Workstation Pro REST API from a local machine or a remote machine.
Procedure
- Install Workstation Pro on your Windows or Linux host.
- Before you start the REST API service the first time, set up your credentials.
- In a terminal window, run the appropriate command, depending on the operating system of the host machine.
- On Windows, change directories to the Workstation Pro installation folder, and run the
vmrest.exe -C
command. - On Linux, run the
vmrest -C
command.
- On Windows, change directories to the Workstation Pro installation folder, and run the
- Enter a user name and password as prompted.
You do not need to set up credentials when you start the REST API on subsequent occasions.
The user name and password are saved to the appropriate file.Operating System File Windows %USERPROFILE%\vmrest.cfg Linux ~/.vmrestcfg
- In a terminal window, run the appropriate command, depending on the operating system of the host machine.
- Configure the REST API service for HTTP and HTTPS access.
You can configure the REST API service to provide HTTP access locally and HTTPS access both locally and remotely.
- Provide HTTP service.
- In a terminal window, run the vmrest command.
The command returns the IP address and port number from which you can access the HTTP service. The default IP address is 127.0.0.1:8697.
- Open a web browser and go to http://address-returned-by-vmrest-command.
- Click Authorize in the top-right corner of the Workstation Pro API Explorer page.
- Enter the user name and password you configured in Step 2.
- In a terminal window, run the vmrest command.
- Provide HTTPS service.
To enable remote access to Workstation Pro REST API, you must configure the REST API service to provide HTTPS service. In this situation, when you use the vmrest command to start the REST API service, you must use the -c and -k options together to specify the certificate and private key.
- In a terminal window, run a command to generate a certificate and a private key.
The example command that follows, generates a self-signed OpenSSL-based certificate and a private key.
openssl req -x509 -newkey rsa:4096 -keyout workstationapi-key.pem -out workstationapi-cert.pem -days 365 -nodes
- To start the Workstation Pro REST API service, run the command that follows. Replace the placeholders with the full path to the certificate file, full path to the private key file, and the IP address from which you want to serve the REST API.
vmrest -c certificate-file -k private-key-file -i ip-address
The command returns the IP address and port number from which you can access the HTTPS service.
- On a remote machine, open a web browser and go to https://address-returned-by-vmrest-command.
- Click Authorize in the top-right corner of the Workstation Pro API Explorer page.
- Enter the user name and password you configured in Step 2.
- In a terminal window, run a command to generate a certificate and a private key.
- Provide HTTP service.