CLion Help

Tutorial: Configuring Generic Task Server

In this section:

Overview

The Generic connector has been developed as a mechanism enabling the users to configure integration with the servers that CLion does not officially support. At the moment, this mechanism:

  • supports the services with REST API.
  • does not support pagination in server responses.
  • allows the following ways of client authentication:
  • supports GET and POST requests. At this moment POST requests can contain only form-encoded data, specified as query parameters in the corresponding URL

Note that a client can only send requests to a server and retrieve responses according to a certain template.

This tutorial is created for the JIRA 5.0 server. However, configuring a generic server described below is valid for any higher version of JIRA, including JIRA OnDemand.

Prerequisites

Make sure that the following prerequisites are met:

  • You are working with CLion version 1 or later.

    If you still do not have CLion, download it from . To install CLion, follow the instructions, depending on your platform.

  • You have a JIRA account.

Specifying JIRA as the task server

Off we go.

First, open Settings/Preferences dialog, as described in the section Accessing Settings, expand the node Tools, and, under Tasks, click Servers.

In this page, click add, and choose Generic:

task_generic_server

Next, in the General tab, specify URL of the server, select the check box Use HTTP Authentication, and type your user name and password.

Leave the Commit Message tab as is, and then click the Server Configuration tab.

Configuring the task server

Now it's time of the most interesting things. Look at the three fields in this tab:

  • The first field, Login URL, is disabled, because the check box Use HTTP authentication in the General tab has been selected.
  • The second field Tasks list URL makes it possible to obtain the list of issues from the server (this list is asked for when you open a task).

    In this field, specify the variable {serverUrl} that corresponds to the server URL, specified in the General tab, then type the path /rest/api/2/search and expression ?maxResults={max}&jql={JQL_Query} .

    Pay attention to the template variable {JQL_Query}, which is not defined so far. To define it, click the button Manage Template Variables, then in the Template Variables dialog box that opens, click add and type the name and value of this template variable:

    task_generic_server_template_variables1

    Defining a template variable leads to including it in the suggestion list:

    task_generic_server_template_variables

    Mind the check box Show on first tab in the Template Variables dialog box. If this check box is selected (as it's done in this tutorial), the template variable and its value shows on the General tab of the Servers page.

  • The third field Single task URL makes it possible to obtain a detailed information about a specific issue by its ID. This field is optional, when the check box Each task in separate request is cleared, as it's done here.

    Nevertheless, let's specify this field as well. Here you type the following:
    variable {serverUrl} that corresponds to the server URL, specified in the General tab, then type the path /rest/api/2/issue/ and then the variable {id}.

Mind code completion in all these fields!

task_server_code_completion

Choosing the response type and using selectors

Next, choose the response type and specify how information about an issue will be extracted from the server response. This is done in the table of selectors in the lower part of the Server Configuration tab.

CLion suggests three response types: XML, JSON and text.

  • If the server responds in XML format, then the selectors are described in XPath (radio button XML).
  • If the server responds in JSON format, then the selectors are described in JSONPath (radio button JSON).
  • If the server responds in plain text format, then the selectors are described as regular expressions(radio button Text).

In this tutorial, let's click the radio button JSON and describe selectors using JSONPath.

The first three selectors are mandatory:

  • tasks: this selector denotes the path in the server response to the descriptions of specific issues.
  • id: this selector denotes the path to a unique ID in the description of a specific issue.
  • summary: this selector denotes the path to a title of an issue within its description.

To fill out the table, use server responses. For JIRA, for example, one can observe the server responses immediately in browser, following a link in the format http://<server URL>:<port>/rest/api/2/search .

Obtaining issues from the server

Oof! Finally, let's check the correctness of settings by clicking the Test button:

task_generic_server_connection_successful

Then apply changes and close the Settings dialog.

On the main menu, choose Tools | Tasks & Contexts | Open Task, or click the Open task button:

task_generic_server_open_task

In the list of tasks, choose the one you want to open, and hit Enter:

task_generic_server_open_task1

Summary

In this tutorial, we have:

  • assigned JIRA as the generic task server.
  • configured this task server.
  • specified response type and selectors.
  • made sure that connection is successful.
  • retrieved issues from the configured server.

See Also

Last modified: 7 May 2015