DATA CENTER AND SERVER | CLOUD

Get Requirement version

Contents


Get Requirements version


The following script will get the version of the Requirements installed.

 Click here to expand...
Function
def get_requirements_version(host_url, username, password):
    """
    This method is used to get R4J version
    """

    # The REST API path to get R4J version
    path_uri = '/rest/com.easesolutions.jira.plugins.requirements/1.0/version'

    # Send a GET request to get R4J version
    # Return the result of the GET request
    try:
		return requests.get(host_url + path_uri, auth=HTTPBasicAuth(username, password))
	except requests.exceptions.RequestException as e:
    	print e
Main
# Store the result of the GET request to [response]
response = get_requirements_version(HOST_URL, USERNAME, PASSWORD)

# Check response if R4J version is returned
if response.status_code == 200:

    # Print the JSON response of the GET request
    print response.text

else:
    print 'Error code: ', response.status_code
    print response.text

Refer to Constant variable for information of the following constant variable: [HOST_URL, USERNAME, PASSWORD]

Output
{"version":"3.2.0-local-build"}