Skip to content

Latest commit

 

History

History
243 lines (181 loc) · 10.9 KB

JqlApi.md

File metadata and controls

243 lines (181 loc) · 10.9 KB

JqlApi

All URIs are relative to https://your-domain.atlassian.com

Method HTTP request Description
getAutoComplete GET /rest/api/3/jql/autocompletedata Get field reference data
getFieldAutoCompleteForQueryString GET /rest/api/3/jql/autocompletedata/suggestions Get field auto complete suggestions
migrateQueries POST /rest/api/3/jql/pdcleaner Convert user identifiers to account IDs in JQL queries
parseJqlQueries POST /rest/api/3/jql/parse Parse JQL query

getAutoComplete

JQLReferenceData getAutoComplete()

Get field reference data

Returns reference data for JQL searches. This is a downloadable version of the documentation provided in Advanced searching - fields reference and Advanced searching - functions reference, along with a list of JQL-reserved words. Use this information to assist with the programmatic creation of JQL queries or the validation of queries built in a custom query builder. This operation can be accessed anonymously. Permissions required: None.

Example

// Import classes:
//import com.xminds.jira.rest.client.ApiClient;
//import com.xminds.jira.rest.client.ApiException;
//import com.xminds.jira.rest.client.Configuration;
//import com.xminds.jira.rest.client.auth.*;
//import com.xminds.jira.rest.client.api.JqlApi;

ApiClient defaultClient = Configuration.getDefaultApiClient();

// Configure OAuth2 access token for authorization: OAuth2
OAuth OAuth2 = (OAuth) defaultClient.getAuthentication("OAuth2");
OAuth2.setAccessToken("YOUR ACCESS TOKEN");
// Configure HTTP basic authorization: basicAuth
HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth");
basicAuth.setUsername("YOUR USERNAME");
basicAuth.setPassword("YOUR PASSWORD");

JqlApi apiInstance = new JqlApi();
try {
    JQLReferenceData result = apiInstance.getAutoComplete();
    System.out.println(result);
} catch (ApiException e) {
    System.err.println("Exception when calling JqlApi#getAutoComplete");
    e.printStackTrace();
}

Parameters

This endpoint does not need any parameter.

Return type

JQLReferenceData

Authorization

OAuth2basicAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

getFieldAutoCompleteForQueryString

AutoCompleteSuggestions getFieldAutoCompleteForQueryString(fieldName, fieldValue, predicateName, predicateValue)

Get field auto complete suggestions

Returns the JQL search auto complete suggestions for a field. Suggestions can be obtained by providing: * `fieldName` to get a list of all values for the field. * `fieldName` and `fieldValue` to get a list of values containing the text in `fieldValue`. * `fieldName` and `predicateName` to get a list of all predicate values for the field. * `fieldName`, `predicateName`, and `predicateValue` to get a list of predicate values containing the text in `predicateValue`. This operation can be accessed anonymously. Permissions required: None.

Example

// Import classes:
//import com.xminds.jira.rest.client.ApiClient;
//import com.xminds.jira.rest.client.ApiException;
//import com.xminds.jira.rest.client.Configuration;
//import com.xminds.jira.rest.client.auth.*;
//import com.xminds.jira.rest.client.api.JqlApi;

ApiClient defaultClient = Configuration.getDefaultApiClient();

// Configure OAuth2 access token for authorization: OAuth2
OAuth OAuth2 = (OAuth) defaultClient.getAuthentication("OAuth2");
OAuth2.setAccessToken("YOUR ACCESS TOKEN");
// Configure HTTP basic authorization: basicAuth
HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth");
basicAuth.setUsername("YOUR USERNAME");
basicAuth.setPassword("YOUR PASSWORD");

JqlApi apiInstance = new JqlApi();
String fieldName = "fieldName_example"; // String | The name of the field.
String fieldValue = "fieldValue_example"; // String | The partial field item name entered by the user.
String predicateName = "predicateName_example"; // String | The name of the [ CHANGED operator predicate](https://confluence.atlassian.com/x/hQORLQ#Advancedsearching-operatorsreference-CHANGEDCHANGED) for which the suggestions are generated. The valid predicate operators are *by*, *from*, and *to*.
String predicateValue = "predicateValue_example"; // String | The partial predicate item name entered by the user.
try {
    AutoCompleteSuggestions result = apiInstance.getFieldAutoCompleteForQueryString(fieldName, fieldValue, predicateName, predicateValue);
    System.out.println(result);
} catch (ApiException e) {
    System.err.println("Exception when calling JqlApi#getFieldAutoCompleteForQueryString");
    e.printStackTrace();
}

Parameters

Name Type Description Notes
fieldName String The name of the field. [optional]
fieldValue String The partial field item name entered by the user. [optional]
predicateName String The name of the CHANGED operator predicate for which the suggestions are generated. The valid predicate operators are by, from, and to. [optional]
predicateValue String The partial predicate item name entered by the user. [optional]

Return type

AutoCompleteSuggestions

Authorization

OAuth2basicAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

migrateQueries

ConvertedJQLQueries migrateQueries(body)

Convert user identifiers to account IDs in JQL queries

Converts one or more JQL queries with user identifiers (username or user key) to equivalent JQL queries with account IDs. You may wish to use this operation if your system stores JQL queries and you want to make them GDPR-compliant. For more information about GDPR-related changes, see the migration guide. Permissions required: Permission to access Jira.

Example

// Import classes:
//import com.xminds.jira.rest.client.ApiClient;
//import com.xminds.jira.rest.client.ApiException;
//import com.xminds.jira.rest.client.Configuration;
//import com.xminds.jira.rest.client.auth.*;
//import com.xminds.jira.rest.client.api.JqlApi;

ApiClient defaultClient = Configuration.getDefaultApiClient();

// Configure OAuth2 access token for authorization: OAuth2
OAuth OAuth2 = (OAuth) defaultClient.getAuthentication("OAuth2");
OAuth2.setAccessToken("YOUR ACCESS TOKEN");
// Configure HTTP basic authorization: basicAuth
HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth");
basicAuth.setUsername("YOUR USERNAME");
basicAuth.setPassword("YOUR PASSWORD");

JqlApi apiInstance = new JqlApi();
JQLPersonalDataMigrationRequest body = new JQLPersonalDataMigrationRequest(); // JQLPersonalDataMigrationRequest | 
try {
    ConvertedJQLQueries result = apiInstance.migrateQueries(body);
    System.out.println(result);
} catch (ApiException e) {
    System.err.println("Exception when calling JqlApi#migrateQueries");
    e.printStackTrace();
}

Parameters

Name Type Description Notes
body JQLPersonalDataMigrationRequest

Return type

ConvertedJQLQueries

Authorization

OAuth2basicAuth

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

parseJqlQueries

ParsedJqlQueries parseJqlQueries(body, validation)

Parse JQL query

Parses and validates JQL queries. Validation is performed in context of the current user. This operation can be accessed anonymously. Permissions required: None.

Example

// Import classes:
//import com.xminds.jira.rest.client.ApiClient;
//import com.xminds.jira.rest.client.ApiException;
//import com.xminds.jira.rest.client.Configuration;
//import com.xminds.jira.rest.client.auth.*;
//import com.xminds.jira.rest.client.api.JqlApi;

ApiClient defaultClient = Configuration.getDefaultApiClient();

// Configure OAuth2 access token for authorization: OAuth2
OAuth OAuth2 = (OAuth) defaultClient.getAuthentication("OAuth2");
OAuth2.setAccessToken("YOUR ACCESS TOKEN");
// Configure HTTP basic authorization: basicAuth
HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth");
basicAuth.setUsername("YOUR USERNAME");
basicAuth.setPassword("YOUR PASSWORD");

JqlApi apiInstance = new JqlApi();
JqlQueriesToParse body = new JqlQueriesToParse(); // JqlQueriesToParse | 
String validation = "strict"; // String | How to validate the JQL query and treat the validation results. Validation options include:   *  `strict` Returns all errors. If validation fails, the query structure is not returned.  *  `warn` Returns all errors. If validation fails but the JQL query is correctly formed, the query structure is returned.  *  `none` No validation is performed. If JQL query is correctly formed, the query structure is returned.
try {
    ParsedJqlQueries result = apiInstance.parseJqlQueries(body, validation);
    System.out.println(result);
} catch (ApiException e) {
    System.err.println("Exception when calling JqlApi#parseJqlQueries");
    e.printStackTrace();
}

Parameters

Name Type Description Notes
body JqlQueriesToParse
validation String How to validate the JQL query and treat the validation results. Validation options include: * `strict` Returns all errors. If validation fails, the query structure is not returned. * `warn` Returns all errors. If validation fails but the JQL query is correctly formed, the query structure is returned. * `none` No validation is performed. If JQL query is correctly formed, the query structure is returned. [optional] [default to strict] [enum: strict, warn, none]

Return type

ParsedJqlQueries

Authorization

OAuth2basicAuth

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json