Get Started with the Cookbook
Before downloading your first script, do the following actions:
Familiarize yourself with the API Cookbook prerequisites and key concepts found in Development Prerequisites and REST General Concepts.
Use a non-production server for script development.
Familiarize yourself with the coding language.
Use the GLSRestApiUtils file to assist with recipe development.
Review Tips and Troubleshooting.
Script Development with a Non-Production Server
The example script recipes really come to life when you change them and see what happens. Running the scripts often requires new custom fields and master steps to be added to the system. You need unrestricted access to development and test servers (licensed as non-production servers) with Groovy (a coding language). You also need an AI node/automation worker installed so that you can experiment freely.
For more information and recommendations for deploying and copying scripts in development, test, and product environments, refer to Useful Tools.
Script Types
Groovy
The Cookbook Recipe Examples are written in Groovy. Many of our examples use the following Groovy concepts:
Closures: Groovy closures are essentially blocks of code that can be stored for later use.
The each method: The each method takes a closure as an argument. It then iterates through each element in a collection, performing the closure on the element, which is (by default) stored in the 'it' variable. For example:
Python
The Cookbook also provides a few examples written in Python, which uses the minidom module. The following script shows how the minidom module is used:
This same functionality can be obtained using any programming language capable of interacting with the Web API. For more information on the minidom module, refer to Python Minidom.
Use GLSRestApiUtils
In addition to the Groovy file example attached to each Cookbook recipe page, most recipes require the glsapiutil.py file, which is available on our GitHub repository. The mature glsapiutil.py library is strictly for Python 2. A newer version, glsapiutil3.py, works with Python 3.
For more information on these files, see Obtain and Use the REST API Utility Classes.
Last updated