Tutorials - Setting up the prerequisites
The following steps describe how to set up your environment to run the various tutorials.
Step 1 - Clone the GitHub repository
Fetch tutorial samples from GitHub and run git clone to create a local copy of the source code.
Step 2 - Obtain access to Control-M Automation API
Control-M Automation API is a REST API interface over HTTPS. You can either install Control-M Workbench or access a Control-M instance where you must have Control-M credentials.
Step 3 - Install Control-M Automation CLI
To run the tutorials you need a working Control-M CLI. Refer to the Control-M Automation CLI installation guide. Follow the steps for the relevant platform.
Step 4 - Set up a Control-M environment
The Control-M Automation CLI requires an environment to run the commands. An Environment is a combination of an endPoint, username, and password.
An endPoint is the URI for Control-M Automation API. The endpoint has the following format:
If you installed Control-M Workbench, use the following command to add an environment for the Workbench:
If you accessed a Control-M instance, use the following command to add an environment. In this example, the environment is named devEnvironment:
Step 5 - Set the environment as default
When you set up your first environment, it is automatically set as the default environment that is used by any API commands that you invoke. In such a case, you can skip this step. Later, after defining additional environments, perform this step to set the default environment of your choice.
In the following example, the Control-M Workbench is set as the default environment. The returned response lists the single environment that is currently defined and notifies you that it is set as the default environment.
info: current environment: workbench
info: environments: {
"workbench": {
"endPoint": "https://localhost:8443/automation-api",
"user": "workbench"
}
}
In the following example, devEnvironment (a Control-M instance) is set as the default environment, and the returned response lists all existing environments.
info: current environment: devEnvironment
info: environments: {
"local": {
"endPoint": "http://localhost:48080/",
"user": ""
},
"devEnvironment": {
"endPoint": "https://<controlmEndPointHost>:8443/automation-api",
"user": "<controlmUser>"
}
}
Step 6 - Verify the setup by logging in to a session
After setting up the Control-M environment for the CLI, ensure that the user associated with the default environment can successfully log in to a CLI session. For a workbench environment, the user is named workbench. For any other Control-M environment, the user is specified during environment setup.
To log in to a CLI session, use the Session Service. The response returns the user name, a token for the session, and the version of the CLI, as shown in the following example:
{
"username": "emuser",
"token": "d6ad05ecbee1dd74bf100447ed2be5d6_D749761E",
"version": "9.18.2"
Step 7 - Access documentation
You can access the REST API documentation for this environment:
To access this web-based API documentation: