Sample script with API calls
This section provides a sample script that uses API calls.
-
To import the utility file described in Remote access basics. It defines the connectLogin and connectLogout proxy objects.
-
A proxy defining the specific server, user, and password for the connectLogin proxy.
-
The Connect API calls you want defined as a result you can print. For example,
result = proxy.Document.get(“1”)
.
A script can include statements that display or process the results and handle any errors or exceptions that might occur. For example:
except xmlrpcFault, err: print err.faultString + " (" + str(err.faultCode) + ")" finally: connectLogout(myProxy, "aiw")
The script shown below :
-
Imports a utility file.
-
Creates a job and starts it through the workflow.
-
Displays the information it retrieves about the job and any error or exception messages.