Skip to end of metadata
Go to start of metadata

This tutorial teaches you how to interact with FishEye/Crucible's REST interface from a Python program.

We'll write a Python script which lists the users who are uncompleted reviewers of at least one open review.

This tutorial assumes that you have Python 2.6.3 installed. Note that the default version on Mac OS X 10.6 is 2.5.

Create a new directory to write your client in and cd into it.

First you'll need to install the python-rest-client package. Download the 0.2 distribution and unpack it in your current directory.

Set your PYTHONPATH environment variable to include the python-rest-client:

To get all open reviews we use the URL /reviews-v1/filter/{filter}, setting {filter} to allOpenReviews, and to get the incomplete reviewers for each of these reviews we use the URL /reviews-v1/{id}/reviewers/uncompleted

Icon

When JSON produces lists of objects, the structures produced depend on the number of items in the list.
If the /reviews-v1/filter URL returns a single review, the JSON will look like this:

but if several reviews are returned the JSON will be:

and if there are no reviews it will simply be:

The toList function in the code below normalises each of the responses shown above to a list:

  • No labels

2 Comments

    • Check whether your version of SQL Server is supported. See Supported Platforms.
      Note, SQL Server Express is not supported, however, it is possible to set up JIRA to work with this database. As it's not supported, we have no docs available for this configuration.
    • If you are Migrating JIRA to Another Server, create an export of your data as an XML backup. You will then be able to transfer data from your old database to your new database, as described in Switching databases.
    • Shut down JIRA before you begin, unless you are running the Setup Wizard.
    1. Create a database for JIRA to store issues in (e.g. jiradb). 
      Remember your database name, as it will be used to configure JIRA's connection to this database in subsequent steps.
      • Collation type must be case-insensitiveaccent-insensitive, and language neutral for example, 'SQL_Latin1_General_CP437_CI_AI' is a case-insensitive, accent-insensitive and language neutral collation type. If your SQL Server installation's collation type settings have not been changed from their defaults, check the collation type settings.
      • SQL Server uses Unicode encoding to store characters. This is sufficient to prevent any possible encoding problems.
    2. Create a database user which JIRA will connect as (e.g. jiradbuser). 
      Remember your database user name, as it will be used to configure JIRA's connection to this database in subsequent steps.
      • This database user should not be the database owner, but should be in the db_owner role.
    3. Create an empty 'schema' in the database (e.g. jiraschema) for the JIRA tables. 
      Remember this database schema name, as it will be used to configure JIRA's connection to this database in subsequent steps.
      • A 'schema' in SQL Server 2005 is a distinct namespace used to contain objects and is different from a traditional database schema. You are not required to create any of JIRA's tables, fields or relationships (JIRA will create these objects in your empty schema when it starts for the first time). You can read more on SQL Server 2005 schemas in the relevant Microsoft ,,??--***