Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.


Panel
titleContents

Table of Contents
maxLevel2
minLevel2

...

Panel

Get Requirements version


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

Expand
Function
Code Block
languagepy
themeConfluence
linenumberstrue
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
Code Block
languagepy
themeConfluence
linenumberstrue
# 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
Code Block
languagetext
themeConfluence
{"version":"3.2.0-local-build"}



...