The Python Library Module

The Accelerator software package provides a Python library module called to make REST API usage from Python more convenient. The module implements a VOVRest Python class with member functions described in the following text box. These functions hide the details associated with authenticating, session handling, and error handling. More example programs follow that utilize this convenient Python library layer.

VOVRest Python Class Description

The VOVRest Python class provides an interface to the Accelerator v3 REST API.

import vov_rest_v3
Member Functions
authorize (url, username=’’, password=’’)
The vovserver scheduling server authenticates a user for a VOVRest and obtains a validating access token behind the scenes, storing it in the VOVRest object.
Positional Arguments
url – (string) the URL as returned by nc cmd vovbrowser
password -- (string) the current user password
Keyword Arguments
username – (string) user name, usually the same as the Linux user name known to vovserver. If this argument is not provided it defaults to the current user identified by $USER
Return Value
None. Raises exceptions upon failure.
submitRequest (method, url, queryParams={}, jsonData={})
Submits a REST/ HTTP request to the server.
Positional Arguments
method – (string) one of: “GET”, “POST”, “PUT”, “DELETE”, “PATCH”.
url – (string) the URL as returned by nc cmd vovbrowser -url RESTPATH.
Examples of RESTPATH are: /api/v3/jobs or /api/v3/projects/1.
Keyword Arguments
queryParams – (dictionary) keywords and values in string fromat for GET requests
jsonData – (dictionary) keywords and values in string fromat for POST requests
Return Value
(string) The HTTP request response text.
Retrieve the JSON Web Token (JWT) for the object.
Return Value: (string) the JWT string
Replace the JSON Web Token (JWT) for the object.
Positional Arguments
token – (string) the replacement JWT to be remembered in the object and used for subsequent REST requests
Return Value

REST Request Detailed Documentation

The Accelerator REST v3 API interface is described in detail under the Swagger documentation that comes with the Accelerator software. To browse the Swagger REST documentation, browse to the URL displayed as the output of this command:
nc cmd vovbrowser -url /html/vovrest.html

The information at this page will help you construct a valid REST request.

For example, browse on the Swagger documentation page to the “jobs” object. You will see that a POST request is used, and the REST URL segment is “/api/v3/jobs”.

Figure 1.

Click on the POST button for more details about the required and supported dictionary keys and values for the request. This gives you what you need to know to construct a complete and working job submit request using the VOVRest package Python functions