diff options
author | Daniel Schwarz <daniel.schwarz@sonarsource.com> | 2017-11-23 15:32:43 +0100 |
---|---|---|
committer | Daniel Schwarz <bartfastiel@users.noreply.github.com> | 2017-11-29 20:24:11 +0100 |
commit | b8d9ebc1a94519ab3a0f285945c894b31de05c9a (patch) | |
tree | c2ec8846058adc7cf36e7629c8af67a1281c5fd3 | |
parent | 554fb67ddb958cdfafb6fcd40b7d50a298e8d147 (diff) | |
download | sonarqube-b8d9ebc1a94519ab3a0f285945c894b31de05c9a.tar.gz sonarqube-b8d9ebc1a94519ab3a0f285945c894b31de05c9a.zip |
Add generator of sonar-ws sources
31 files changed, 11381 insertions, 909 deletions
@@ -29,8 +29,9 @@ <module>sonar-markdown</module> <module>sonar-plugin-api</module> <module>server</module> - <module>sonar-ws-generated</module> <module>sonar-ws</module> + <module>sonar-ws-generated</module> + <module>sonar-ws-generator</module> <module>sonar-testing-harness</module> <module>plugins/sonar-xoo-plugin</module> </modules> @@ -468,6 +469,11 @@ <version>${sonarUpdateCenter.version}</version> </dependency> <dependency> + <groupId>org.sonarsource.orchestrator</groupId> + <artifactId>sonar-orchestrator</artifactId> + <version>${orchestrator.version}</version> + </dependency> + <dependency> <groupId>org.codehaus.sonar</groupId> <artifactId>sonar-squid</artifactId> <version>4.1</version> diff --git a/server/sonar-server/src/main/java/org/sonar/server/setting/ws/SettingsWsParameters.java b/server/sonar-server/src/main/java/org/sonar/server/setting/ws/SettingsWsParameters.java new file mode 100644 index 00000000000..3053afa5b9c --- /dev/null +++ b/server/sonar-server/src/main/java/org/sonar/server/setting/ws/SettingsWsParameters.java @@ -0,0 +1,4 @@ +package org.sonar.server.setting.ws; + +public class SettingsWsParameters { +} diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/settings/EncryptRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/settings/EncryptRequest.java index 331912b5d4c..b37cc452d6c 100644 --- a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/settings/EncryptRequest.java +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/settings/EncryptRequest.java @@ -19,7 +19,6 @@ */ package org.sonarqube.ws.client.settings; -import java.util.List; import javax.annotation.Generated; /** diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/settings/ListDefinitionsRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/settings/ListDefinitionsRequest.java index e804a256d30..dc04c794f56 100644 --- a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/settings/ListDefinitionsRequest.java +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/settings/ListDefinitionsRequest.java @@ -19,7 +19,6 @@ */ package org.sonarqube.ws.client.settings; -import java.util.List; import javax.annotation.Generated; /** diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/settings/ResetRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/settings/ResetRequest.java index 23b59784601..fd020907461 100644 --- a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/settings/ResetRequest.java +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/settings/ResetRequest.java @@ -35,7 +35,7 @@ public class ResetRequest { private String branch; private String component; - private String keys; + private List<String> keys; /** * Branch key @@ -67,17 +67,17 @@ public class ResetRequest { } /** - * Setting keys + * Comma-separated list of keys * * This is a mandatory parameter. * Example value: "sonar.links.scm,sonar.debt.hoursInDay" */ - public ResetRequest setKeys(String keys) { + public ResetRequest setKeys(List<String> keys) { this.keys = keys; return this; } - public String getKeys() { + public List<String> getKeys() { return keys; } } diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/settings/SetRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/settings/SetRequest.java index 4e5fd1478c4..642d4747ab9 100644 --- a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/settings/SetRequest.java +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/settings/SetRequest.java @@ -35,10 +35,10 @@ public class SetRequest { private String branch; private String component; - private String fieldValues; + private List<String> fieldValues; private String key; private String value; - private String values; + private List<String> values; /** * Branch key. Only available on following settings : sonar.leak.period @@ -74,12 +74,12 @@ public class SetRequest { * * Example value: "fieldValues={\"firstField\":\"first value\", \"secondField\":\"second value\", \"thirdField\":\"third value\"}" */ - public SetRequest setFieldValues(String fieldValues) { + public SetRequest setFieldValues(List<String> fieldValues) { this.fieldValues = fieldValues; return this; } - public String getFieldValues() { + public List<String> getFieldValues() { return fieldValues; } @@ -117,12 +117,12 @@ public class SetRequest { * * Example value: "values=firstValue&values=secondValue&values=thirdValue" */ - public SetRequest setValues(String values) { + public SetRequest setValues(List<String> values) { this.values = values; return this; } - public String getValues() { + public List<String> getValues() { return values; } } diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/settings/SettingsService.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/settings/SettingsService.java index a060004e526..35eaa1429a0 100644 --- a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/settings/SettingsService.java +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/settings/SettingsService.java @@ -22,15 +22,15 @@ package org.sonarqube.ws.client.settings; import java.util.stream.Collectors; import javax.annotation.Generated; import org.sonarqube.ws.MediaTypes; -import org.sonarqube.ws.client.BaseService; -import org.sonarqube.ws.client.GetRequest; -import org.sonarqube.ws.client.PostRequest; -import org.sonarqube.ws.client.WsConnector; import org.sonarqube.ws.Settings.CheckSecretKeyWsResponse; import org.sonarqube.ws.Settings.EncryptWsResponse; import org.sonarqube.ws.Settings.GenerateSecretKeyWsResponse; import org.sonarqube.ws.Settings.ListDefinitionsWsResponse; import org.sonarqube.ws.Settings.ValuesWsResponse; +import org.sonarqube.ws.client.BaseService; +import org.sonarqube.ws.client.GetRequest; +import org.sonarqube.ws.client.PostRequest; +import org.sonarqube.ws.client.WsConnector; /** * Manage settings. @@ -115,7 +115,7 @@ public class SettingsService extends BaseService { new PostRequest(path("reset")) .setParam("branch", request.getBranch()) .setParam("component", request.getComponent()) - .setParam("keys", request.getKeys()) + .setParam("keys", request.getKeys() == null ? null : request.getKeys().stream().collect(Collectors.joining(","))) .setMediaType(MediaTypes.JSON) ).content(); } @@ -133,10 +133,10 @@ public class SettingsService extends BaseService { new PostRequest(path("set")) .setParam("branch", request.getBranch()) .setParam("component", request.getComponent()) - .setParam("fieldValues", request.getFieldValues()) + .setParam("fieldValues", request.getFieldValues() == null ? null : request.getFieldValues().stream().collect(Collectors.joining(","))) .setParam("key", request.getKey()) .setParam("value", request.getValue()) - .setParam("values", request.getValues()) + .setParam("values", request.getValues() == null ? null : request.getValues().stream().collect(Collectors.joining(","))) .setMediaType(MediaTypes.JSON) ).content(); } @@ -154,7 +154,7 @@ public class SettingsService extends BaseService { new GetRequest(path("values")) .setParam("branch", request.getBranch()) .setParam("component", request.getComponent()) - .setParam("keys", request.getKeys()), + .setParam("keys", request.getKeys() == null ? null : request.getKeys().stream().collect(Collectors.joining(","))), ValuesWsResponse.parser()); } } diff --git a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/settings/ValuesRequest.java b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/settings/ValuesRequest.java index db511b00ddc..0a268de8336 100644 --- a/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/settings/ValuesRequest.java +++ b/sonar-ws-generated/src/main/java/org/sonarqube/ws/client/settings/ValuesRequest.java @@ -35,7 +35,7 @@ public class ValuesRequest { private String branch; private String component; - private String keys; + private List<String> keys; /** * Branch key @@ -71,12 +71,12 @@ public class ValuesRequest { * * Example value: "sonar.test.inclusions,sonar.dbcleaner.cleanDirectory" */ - public ValuesRequest setKeys(String keys) { + public ValuesRequest setKeys(List<String> keys) { this.keys = keys; return this; } - public String getKeys() { + public List<String> getKeys() { return keys; } } diff --git a/sonar-ws-generator/pom.xml b/sonar-ws-generator/pom.xml new file mode 100644 index 00000000000..b52b94a7c95 --- /dev/null +++ b/sonar-ws-generator/pom.xml @@ -0,0 +1,101 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.sonarsource.sonarqube</groupId> + <artifactId>sonarqube</artifactId> + <version>7.0-SNAPSHOT</version> + </parent> + + <artifactId>sonar-ws-generator</artifactId> + <name>SonarQube :: Web Service :: Generator</name> + <description>Generate source files of sonar-ws</description> + + <properties> + <sonar.exclusions>src/**/*</sonar.exclusions> + </properties> + + <dependencies> + <dependency> + <groupId>org.apache.velocity</groupId> + <artifactId>velocity</artifactId> + <version>1.7</version> + </dependency> + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>log4j-over-slf4j</artifactId> + <version>1.7.25</version> + </dependency> + <dependency> + <groupId>org.sonarsource.orchestrator</groupId> + <artifactId>sonar-orchestrator</artifactId> + </dependency> + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>sonar-ws</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>com.google.code.gson</groupId> + <artifactId>gson</artifactId> + <version>2.8.2</version> + </dependency> + <dependency> + <groupId>com.google.guava</groupId> + <artifactId>guava</artifactId> + </dependency> + <dependency> + <groupId>com.google.code.findbugs</groupId> + <artifactId>jsr305</artifactId> + <scope>provided</scope> + </dependency> + </dependencies> + + <build> + <plugins> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>build-helper-maven-plugin</artifactId> + <executions> + <execution> + <id>add-source</id> + <phase>generate-sources</phase> + <goals> + <goal>add-source</goal> + </goals> + <configuration> + <sources> + <source>target/generated-sources/results</source> + </sources> + </configuration> + </execution> + </executions> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-assembly-plugin</artifactId> + <executions> + <execution> + <id>assemble-all</id> + <phase>package</phase> + <goals> + <goal>single</goal> + </goals> + <configuration> + <descriptorRefs> + <descriptorRef>jar-with-dependencies</descriptorRef> + </descriptorRefs> + <archive> + <manifest> + <mainClass>org.sonarqube.wsgenerator.Generator</mainClass> + </manifest> + </archive> + </configuration> + </execution> + </executions> + </plugin> + </plugins> + </build> + +</project> diff --git a/sonar-ws-generator/run.sh b/sonar-ws-generator/run.sh new file mode 100755 index 00000000000..4513503eec6 --- /dev/null +++ b/sonar-ws-generator/run.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +# Example: +# run.sh /path/to/orchestrator.properties + +set -euo pipefail + +mvn clean package -Prun-ws-generator +java -Dorchestrator.configUrl=file://$* -jar target/sonar-ws-generator-*-SNAPSHOT-jar-with-dependencies.jar diff --git a/sonar-ws-generator/src/main/java/org/sonarqube/wsgenerator/ApiDefinitionDownloader.java b/sonar-ws-generator/src/main/java/org/sonarqube/wsgenerator/ApiDefinitionDownloader.java new file mode 100644 index 00000000000..2d8259db71a --- /dev/null +++ b/sonar-ws-generator/src/main/java/org/sonarqube/wsgenerator/ApiDefinitionDownloader.java @@ -0,0 +1,51 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 SonarSource SA + * mailto:info AT sonarsource DOT com + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +package org.sonarqube.wsgenerator; + +import com.sonar.orchestrator.Orchestrator; +import com.sonar.orchestrator.http.HttpCall; +import com.sonar.orchestrator.http.HttpResponse; + +public class ApiDefinitionDownloader { + + public static void main(String[] args) { + System.out.println(downloadApiDefinition()); + } + + public static String downloadApiDefinition() { + String orchestratorUrl = System.getProperty("orchestrator.configUrl"); + if (orchestratorUrl == null) { + throw new IllegalStateException("Please run with -Dorchestrator.configUrl=file:///path/to/your/orchestrator.properties"); + } + Orchestrator orchestrator = Orchestrator + .builderEnv() + .setSonarVersion("DEV") + .build(); + + orchestrator.start(); + try { + HttpCall httpCall = orchestrator.getServer().newHttpCall("api/webservices/list").setParam("include_internals", "true"); + HttpResponse response = httpCall.execute(); + return response.getBodyAsString(); + } finally { + orchestrator.stop(); + } + } +} diff --git a/sonar-ws-generator/src/main/java/org/sonarqube/wsgenerator/CodeFormatter.java b/sonar-ws-generator/src/main/java/org/sonarqube/wsgenerator/CodeFormatter.java new file mode 100644 index 00000000000..8a610263887 --- /dev/null +++ b/sonar-ws-generator/src/main/java/org/sonarqube/wsgenerator/CodeFormatter.java @@ -0,0 +1,124 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 SonarSource SA + * mailto:info AT sonarsource DOT com + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +package org.sonarqube.wsgenerator; + +import com.google.gson.Gson; +import com.google.gson.JsonArray; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import java.io.BufferedReader; +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.StringWriter; +import java.io.Writer; +import java.util.Properties; +import org.apache.commons.io.FileUtils; +import org.apache.velocity.VelocityContext; +import org.apache.velocity.app.VelocityEngine; + +import static java.nio.charset.StandardCharsets.UTF_8; + +public class CodeFormatter { + + public static void format(String json) { + JsonObject jsonElement = new Gson().fromJson(json, JsonObject.class); + JsonArray webServices = (JsonArray) jsonElement.get("webServices"); + + Helper helper = new Helper(); + + for (JsonElement webServiceElement : webServices) { + JsonObject webService = (JsonObject) webServiceElement; + + VelocityContext webServiceContext = new VelocityContext(); + webServiceContext.put("webService", webServiceElement); + webServiceContext.put("helper", helper); + + String webServiceCode = applyTemplate("webService.vm", webServiceContext); + String webServicePath = webService.get("path").getAsString(); + writeSourceFile(helper.file(webServicePath), webServiceCode); + writeSourceFile(helper.packageInfoFile(webServicePath), applyTemplate("package-info.vm", webServiceContext)); + + for (JsonElement actionElement : (JsonArray) webService.get("actions")) { + JsonObject action = (JsonObject) actionElement; + + JsonArray params = (JsonArray) action.get("params"); + if (params == null || params.size() < 1) { + continue; + } + + VelocityContext actionContext = new VelocityContext(); + actionContext.put("webService", webServiceElement); + actionContext.put("action", actionElement); + actionContext.put("helper", helper); + + String requestCode = applyTemplate("request.vm", actionContext); + writeSourceFile(helper.requestFile(webServicePath, action.get("key").getAsString()), requestCode); + } + } + } + + private static void writeSourceFile(String file, String code) { + try { + FileUtils.writeStringToFile(new File(file), code, UTF_8); + } catch (IOException e) { + throw new IllegalStateException(e); + } + } + + private static String applyTemplate(String templateName, VelocityContext context) { + VelocityEngine velocity = new VelocityEngine(); + Properties properties = new Properties(); + properties.setProperty("resource.loader", "class"); + properties.setProperty("class.resource.loader.class", "org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader"); + velocity.init(properties); + + Writer writer = new StringWriter(); + velocity.mergeTemplate(templateName, "UTF-8", context, writer); + try { + writer.flush(); + } catch (IOException e) { + throw new IllegalStateException(e); + } + + return writer.toString(); + } + + public static void main(String[] args) { + String json = readFromInputStream(Generator.class.getResourceAsStream("/snapshot-of-api.json")); + format(json); + } + + private static String readFromInputStream(InputStream inputStream) { + StringBuilder resultStringBuilder = new StringBuilder(); + try { + try (BufferedReader br = new BufferedReader(new InputStreamReader(inputStream))) { + String line; + while ((line = br.readLine()) != null) { + resultStringBuilder.append(line).append("\n"); + } + } + } catch (IOException e) { + throw new IllegalStateException(e); + } + return resultStringBuilder.toString(); + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/setting/SettingsWsParameters.java b/sonar-ws-generator/src/main/java/org/sonarqube/wsgenerator/Generator.java index a4ccc5c8926..f30ff05ef4d 100644 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/setting/SettingsWsParameters.java +++ b/sonar-ws-generator/src/main/java/org/sonarqube/wsgenerator/Generator.java @@ -17,26 +17,12 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package org.sonarqube.ws.client.setting; +package org.sonarqube.wsgenerator; -public class SettingsWsParameters { - public static final String CONTROLLER_SETTINGS = "api/settings"; +public class Generator { - public static final String ACTION_LIST_DEFINITIONS = "list_definitions"; - public static final String ACTION_VALUES = "values"; - public static final String ACTION_SET = "set"; - public static final String ACTION_RESET = "reset"; - - public static final String PARAM_COMPONENT = "component"; - public static final String PARAM_BRANCH = "branch"; - public static final String PARAM_KEYS = "keys"; - public static final String PARAM_KEY = "key"; - public static final String PARAM_VALUE = "value"; - public static final String PARAM_VALUES = "values"; - public static final String PARAM_FIELD_VALUES = "fieldValues"; - - private SettingsWsParameters() { - // Only static stuff + public static void main(String[] args) { + String json = ApiDefinitionDownloader.downloadApiDefinition(); + CodeFormatter.format(json); } - } diff --git a/sonar-ws-generator/src/main/java/org/sonarqube/wsgenerator/Helper.java b/sonar-ws-generator/src/main/java/org/sonarqube/wsgenerator/Helper.java new file mode 100644 index 00000000000..67bf96f17b7 --- /dev/null +++ b/sonar-ws-generator/src/main/java/org/sonarqube/wsgenerator/Helper.java @@ -0,0 +1,177 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 SonarSource SA + * mailto:info AT sonarsource DOT com + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +package org.sonarqube.wsgenerator; + +import com.google.common.base.CaseFormat; +import com.google.gson.JsonPrimitive; +import java.io.BufferedReader; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +public class Helper { + + private static final String OUTPUT_DIR = "target/generated-sources/results"; + private final Map<String, List<String[]>> responseTypes; + + public Helper() { + InputStream inputStream = Helper.class.getResourceAsStream("/responseClasses.config"); + responseTypes = new BufferedReader(new InputStreamReader(inputStream)) + .lines() + .map(line -> line.split("\\s+")) + .collect(Collectors.groupingBy(arr -> arr[0])); + } + + public String packageName(String path) { + return "org.sonarqube.ws.client." + rawName(path).toLowerCase(); + } + + private String rawName(String path) { + String x = path.replaceFirst("^api\\/", ""); + if (x.contains("_")) { + return CaseFormat.LOWER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, x.toLowerCase()); + } + return capitalizeFirstLetter(x); + } + + public String className(String path) { + String name = rawName(path); + return capitalizeFirstLetter(name) + "Service"; + } + + private String capitalizeFirstLetter(String name) { + return name.substring(0, 1).toUpperCase() + name.substring(1); + } + + private String lowercaseFirstLetter(String name) { + return name.substring(0, 1).toLowerCase() + name.substring(1); + } + + public String responseType(String path, String action) { + return responseTypeFullyQualified(path, action).replaceFirst("^.*\\.", ""); + } + + private String responseTypeFullyQualified(String path, String action) { + String fullPath = path + "/" + action; + List<String[]> responseTypesConfig = responseTypes.get(fullPath); + String fullyQualified; + if (responseTypesConfig == null) { + fullyQualified = guessResponseType(path, action); + responseTypes.put(fullPath, Collections.singletonList(new String[] {fullPath, fullyQualified})); + } else { + fullyQualified = responseTypesConfig.get(0)[1]; + } + return fullyQualified; + } + + private String guessResponseType(String path, String action) { + return guessResponseOuterClassName(path).flatMap( + potentialClassName -> guessResponseInnerClassName(action).flatMap(potentialInnerClassName -> { + try { + String guess = "org.sonarqube.ws." + potentialClassName + "$" + potentialInnerClassName; + Helper.class.forName(guess); + return Stream.of(guess.replaceFirst("\\$", ".")); + } catch (ClassNotFoundException e) { + } + return Stream.empty(); + })).findFirst().orElseGet(() -> { + return "String"; + }); + } + + private Stream<String> guessResponseInnerClassName(String action) { + return Stream.of( + rawName(action) + "Response", + rawName(action) + "WsResponse", + "Ws" + rawName(action) + "Response"); + } + + private Stream<String> guessResponseOuterClassName(String path) { + return Stream.of( + rawName(path), + rawName(path).replaceFirst("Qualityprofiles", "QualityProfiles"), + "Ws" + rawName(path), + "Ws" + rawName(path).replaceFirst("Qualitygates", "QualityGates"), + "Ws" + rawName(path).replaceFirst("ProjectBranches", "Branches"), + rawName(path) + "Ws"); + } + + public String responseTypeImport(String path, String action) { + String fullyQualified = responseTypeFullyQualified(path, action); + if ("String".equals(fullyQualified)) { + return null; + } + return "import " + fullyQualified + ";"; + } + + public String methodName(String path, String action) { + return lowercaseFirstLetter(rawName(action)); + } + + public String requestType(String path, String action) { + return rawName(action) + "Request"; + } + + public String parameterGetter(String parameter) { + return "get" + rawName(parameter); + } + + public String parameterSetter(String parameter) { + return "set" + rawName(parameter); + } + + public String setterParameter(String parameter) { + return lowercaseFirstLetter(rawName(parameter)); + } + + public String setterParameterType(String parameter, JsonPrimitive parameterDescription) { + if (parameter.equals("values") || parameter.equals("fieldValues") || parameter.equals("keys")) { + return "List<String>"; + } + if (parameterDescription != null && parameterDescription.getAsString().matches(".*[Cc]omma.?separated.*|.*[Ll]ist of.*")) { + return "List<String>"; + } + return "String"; + } + + public String apiDocUrl(String path) { + return "https://next.sonarqube.com/sonarqube/web_api/" + path; + } + + public String apiDocUrl(String path, String action) { + return apiDocUrl(path) + "/" + action; + } + + public String file(String path) { + return OUTPUT_DIR + "/org/sonarqube/ws/client/" + rawName(path).toLowerCase() + "/" + className(path) + ".java"; + } + + public String packageInfoFile(String path) { + return OUTPUT_DIR + "/org/sonarqube/ws/client/" + rawName(path).toLowerCase() + "/package-info.java"; + } + + public String requestFile(String path, String action) { + return OUTPUT_DIR + "/org/sonarqube/ws/client/" + rawName(path).toLowerCase() + "/" + requestType(path, action) + ".java"; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/setting/package-info.java b/sonar-ws-generator/src/main/java/org/sonarqube/wsgenerator/package-info.java index 7018fdce9d9..f051ebe5722 100644 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/setting/package-info.java +++ b/sonar-ws-generator/src/main/java/org/sonarqube/wsgenerator/package-info.java @@ -17,10 +17,8 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ - - @ParametersAreNonnullByDefault -package org.sonarqube.ws.client.setting; +package org.sonarqube.wsgenerator; import javax.annotation.ParametersAreNonnullByDefault; diff --git a/sonar-ws-generator/src/main/resources/package-info.vm b/sonar-ws-generator/src/main/resources/package-info.vm new file mode 100644 index 00000000000..d55120ebbbb --- /dev/null +++ b/sonar-ws-generator/src/main/resources/package-info.vm @@ -0,0 +1,24 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 SonarSource SA + * mailto:info AT sonarsource DOT com + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +@ParametersAreNonnullByDefault +package $helper.packageName($webService.path.asString); + +import javax.annotation.ParametersAreNonnullByDefault; + diff --git a/sonar-ws-generator/src/main/resources/request.vm b/sonar-ws-generator/src/main/resources/request.vm new file mode 100644 index 00000000000..bd84997e881 --- /dev/null +++ b/sonar-ws-generator/src/main/resources/request.vm @@ -0,0 +1,91 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 SonarSource SA + * mailto:info AT sonarsource DOT com + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +package $helper.packageName($webService.path.asString); + +import java.util.List; +import javax.annotation.Generated; + +/** + * $action.description.asString + * +#if ($action.internal) + * This is part of the internal API. +#end +#if ($action.post) + * This is a POST request. +#else + * This is a GET request. +#end +#if ($action.hasResponseExample) + * @see <a href="$helper.apiDocUrl($webService.path.asString, $action.key.asString)">Further information about this action online (including a response example)</a> +#else + * @see <a href="$helper.apiDocUrl($webService.path.asString, $action.key.asString)">Further information about this action online</a> +#end +#if ($action.since.asString) + * @since $action.since.asString +#end + */ +@Generated("sonar-ws-generator") +public class $helper.requestType($webService.path.asString, $action.key.asString) { + +#foreach($param in $action.params) + private $helper.setterParameterType($param.key.asString, $param.description) ${helper.setterParameter($param.key.asString)}; +#end +#foreach($param in $action.params) + + /** +#if ($param.description.asString) + * $param.description.asString + * +#end +#if ($param.required.asBoolean) + * This is a mandatory parameter. +#end +#if ($param.internal.asBoolean) + * This is part of the internal API. +#end +#if ($param.exampleValue) + * Example value: $param.exampleValue +#end +#if ($param.possibleValues) + * Possible values: + * <ul> +#foreach($possibleValue in $param.possibleValues) + * <li>$possibleValue</li> +#end + * </ul> +#end +#if ($param.deprecatedSince.asString) + * @deprecated since $param.deprecatedSince.asString +#end + */ +#if ($param.deprecatedSince.asString) + @Deprecated +#end + public $helper.requestType($webService.path.asString, $action.key.asString) ${helper.parameterSetter($param.key.asString)}($helper.setterParameterType($param.key.asString, $param.description) ${helper.setterParameter($param.key.asString)}) { + this.${helper.setterParameter($param.key.asString)} = ${helper.setterParameter($param.key.asString)}; + return this; + } + + public $helper.setterParameterType($param.key.asString, $param.description) ${helper.parameterGetter($param.key.asString)}() { + return ${helper.setterParameter($param.key.asString)}; + } +#end +} diff --git a/sonar-ws-generator/src/main/resources/responseClasses.config b/sonar-ws-generator/src/main/resources/responseClasses.config new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/sonar-ws-generator/src/main/resources/responseClasses.config diff --git a/sonar-ws-generator/src/main/resources/snapshot-of-api.json b/sonar-ws-generator/src/main/resources/snapshot-of-api.json new file mode 100644 index 00000000000..c6f421ea15b --- /dev/null +++ b/sonar-ws-generator/src/main/resources/snapshot-of-api.json @@ -0,0 +1,10672 @@ +{ + "webServices": [ + { + "path": "api/analysis_reports", + "description": "Get details about Compute Engine tasks.", + "actions": [ + { + "key": "is_queue_empty", + "description": "Check if the queue of Compute Engine is empty", + "since": "5.1", + "internal": true, + "post": false, + "hasResponseExample": true, + "changelog": [] + } + ] + }, + { + "path": "api/authentication", + "description": "Handle authentication.", + "actions": [ + { + "key": "login", + "description": "Authenticate a user.", + "since": "6.0", + "internal": false, + "post": true, + "hasResponseExample": false, + "changelog": [], + "params": [ + { + "key": "login", + "description": "Login of the user", + "required": true, + "internal": false + }, + { + "key": "password", + "description": "Password of the user", + "required": true, + "internal": false + } + ] + }, + { + "key": "logout", + "description": "Logout a user.", + "since": "6.3", + "internal": false, + "post": true, + "hasResponseExample": false, + "changelog": [] + }, + { + "key": "validate", + "description": "Check credentials.", + "since": "3.3", + "internal": false, + "post": false, + "hasResponseExample": true, + "changelog": [] + } + ] + }, + { + "path": "api/ce", + "description": "Get information on Compute Engine tasks.", + "actions": [ + { + "key": "activity", + "description": "Search for tasks.<br> Requires the system administration permission, or project administration permission if componentId is set.", + "since": "5.2", + "internal": false, + "post": false, + "hasResponseExample": true, + "changelog": [ + { + "description": "fields \"branch\" and \"branchType\" added", + "version": "6.6" + }, + { + "description": "field \"logs\" is deprecated and its value is always false", + "version": "6.1" + }, + { + "description": "it's no more possible to specify the page parameter.", + "version": "5.5" + } + ], + "params": [ + { + "key": "componentId", + "description": "Id of the component (project) to filter on", + "required": false, + "internal": false, + "exampleValue": "AU-TpxcA-iU5OvuD2FL0" + }, + { + "key": "componentQuery", + "description": "Limit search to: <ul><li>component names that contain the supplied string</li><li>component keys that are exactly the same as the supplied string</li></ul>Must not be set together with componentId.<br />Deprecated and replaced by 'q'", + "required": false, + "internal": false, + "exampleValue": "Apache", + "deprecatedSince": "5.5" + }, + { + "key": "maxExecutedAt", + "description": "Maximum date of end of task processing (inclusive)", + "required": false, + "internal": false, + "exampleValue": "2017-11-10T10:01:57+0100" + }, + { + "key": "minSubmittedAt", + "description": "Minimum date of task submission (inclusive)", + "required": false, + "internal": false, + "exampleValue": "2017-11-10T10:01:57+0100" + }, + { + "key": "onlyCurrents", + "description": "Filter on the last tasks (only the most recent finished task by project)", + "required": false, + "internal": false, + "defaultValue": "false", + "possibleValues": [ + "true", + "false", + "yes", + "no" + ] + }, + { + "key": "p", + "description": "Deprecated parameter", + "required": false, + "internal": false, + "deprecatedSince": "5.5", + "deprecatedKey": "pageIndex", + "deprecatedKeySince": "5.4" + }, + { + "key": "ps", + "description": "Page size. Must be greater than 0 and less than 1000", + "required": false, + "internal": false, + "defaultValue": "100", + "exampleValue": "20", + "deprecatedKey": "pageSize", + "deprecatedKeySince": "5.2", + "maximumValue": 1000 + }, + { + "key": "q", + "description": "Limit search to: <ul><li>component names that contain the supplied string</li><li>component keys that are exactly the same as the supplied string</li><li>task ids that are exactly the same as the supplied string</li></ul>Must not be set together with componentId", + "since": "5.5", + "required": false, + "internal": false, + "exampleValue": "Apache" + }, + { + "key": "status", + "description": "Comma separated list of task statuses", + "required": false, + "internal": false, + "defaultValue": "SUCCESS,FAILED,CANCELED", + "exampleValue": "IN_PROGRESS,SUCCESS", + "possibleValues": [ + "SUCCESS", + "FAILED", + "CANCELED", + "PENDING", + "IN_PROGRESS" + ] + }, + { + "key": "type", + "description": "Task type", + "required": false, + "internal": false, + "exampleValue": "REPORT", + "possibleValues": [ + "REPORT" + ] + } + ] + }, + { + "key": "activity_status", + "description": "Return CE activity related metrics.<br>Requires 'Administer System' permission or 'Administer' rights on the specified project.", + "since": "5.5", + "internal": true, + "post": false, + "hasResponseExample": true, + "changelog": [ + { + "description": "New field 'inProgress' in response", + "version": "6.6" + } + ], + "params": [ + { + "key": "componentId", + "description": "Id of the component (project) to filter on", + "required": false, + "internal": false, + "exampleValue": "AU-TpxcA-iU5OvuD2FL0" + }, + { + "key": "componentKey", + "description": "Key of the component (project) to filter on", + "required": false, + "internal": false, + "exampleValue": "my_project" + } + ] + }, + { + "key": "cancel", + "description": "Cancels a pending task.<br/>In-progress tasks cannot be canceled.<br/>Requires one of the following permissions:<ul><li>'Administer System'</li><li>'Administer' rights on the project related to the task</li></ul>", + "since": "5.2", + "internal": true, + "post": true, + "hasResponseExample": false, + "changelog": [], + "params": [ + { + "key": "id", + "description": "Id of the task to cancel.", + "required": true, + "internal": false, + "exampleValue": "AU-Tpxb--iU5OvuD2FLy" + } + ] + }, + { + "key": "cancel_all", + "description": "Cancels all pending tasks. Requires system administration permission. In-progress tasks are not canceled.", + "since": "5.2", + "internal": true, + "post": true, + "hasResponseExample": false, + "changelog": [] + }, + { + "key": "component", + "description": "Get the pending tasks, in-progress tasks and the last executed task of a given component (usually a project).<br>Requires the following permission: 'Browse' on the specified component.<br>Either 'componentId' or 'component' must be provided.", + "since": "5.2", + "internal": false, + "post": false, + "hasResponseExample": true, + "changelog": [ + { + "description": "fields \"branch\" and \"branchType\" added", + "version": "6.6" + }, + { + "description": "field \"logs\" is deprecated and its value is always false", + "version": "6.1" + } + ], + "params": [ + { + "key": "component", + "required": false, + "internal": false, + "exampleValue": "my_project", + "deprecatedKey": "componentKey", + "deprecatedKeySince": "6.6" + }, + { + "key": "componentId", + "required": false, + "internal": false, + "exampleValue": "AU-Tpxb--iU5OvuD2FLy", + "deprecatedSince": "6.6" + } + ] + }, + { + "key": "submit", + "description": "Submits a scanner report to the queue. Report is processed asynchronously. Requires analysis permission. If the project does not exist, then the provisioning permission is also required.", + "since": "5.2", + "internal": true, + "post": true, + "hasResponseExample": true, + "changelog": [], + "params": [ + { + "key": "characteristic", + "description": "Optional characteristic of the analysis. Can be repeated to define multiple characteristics.", + "since": "6.6", + "required": false, + "internal": false, + "exampleValue": "branchType=long" + }, + { + "key": "organization", + "description": "Key of the organization the project belongs to", + "since": "6.3", + "required": false, + "internal": true, + "exampleValue": "my-org" + }, + { + "key": "projectBranch", + "description": "Optional branch of project", + "required": false, + "internal": false, + "exampleValue": "branch-1.x" + }, + { + "key": "projectKey", + "description": "Key of project", + "required": true, + "internal": false, + "exampleValue": "my_project", + "maximumLength": 400 + }, + { + "key": "projectName", + "description": "Optional name of the project, used only if the project does not exist yet.", + "required": false, + "internal": false, + "exampleValue": "My Project", + "maximumLength": 2000 + }, + { + "key": "report", + "description": "Report file. Format is not an API, it changes among SonarQube versions.", + "required": true, + "internal": false + } + ] + }, + { + "key": "task", + "description": "Give Compute Engine task details such as type, status, duration and associated component.<br />Requires 'Administer System' or 'Execute Analysis' permission.<br/>Since 6.1, field \"logs\" is deprecated and its value is always false.", + "since": "5.2", + "internal": false, + "post": false, + "hasResponseExample": true, + "changelog": [ + { + "description": "fields \"branch\" and \"branchType\" added", + "version": "6.6" + } + ], + "params": [ + { + "key": "additionalFields", + "description": "Comma-separated list of the optional fields to be returned in response.", + "since": "6.1", + "required": false, + "internal": false, + "possibleValues": [ + "stacktrace", + "scannerContext" + ] + }, + { + "key": "id", + "description": "Id of task", + "required": true, + "internal": false, + "exampleValue": "AU-Tpxb--iU5OvuD2FLy" + } + ] + }, + { + "key": "task_types", + "description": "List available task types", + "since": "5.5", + "internal": true, + "post": false, + "hasResponseExample": true, + "changelog": [] + }, + { + "key": "worker_count", + "description": "Return number of Compute Engine workers.<br/>Requires the system administration permission", + "since": "6.5", + "internal": true, + "post": false, + "hasResponseExample": true, + "changelog": [] + } + ] + }, + { + "path": "api/components", + "since": "4.2", + "description": "Get information about a component (file, directory, project, ...) and its ancestors or descendants. Update a project or module key.", + "actions": [ + { + "key": "app", + "description": "Coverage data required for rendering the component viewer.<br>Requires the following permission: 'Browse'.", + "since": "4.4", + "internal": true, + "post": false, + "hasResponseExample": true, + "changelog": [], + "params": [ + { + "key": "branch", + "description": "Branch key", + "since": "6.6", + "required": false, + "internal": true, + "exampleValue": "feature/my_branch" + }, + { + "key": "component", + "description": "Component key", + "since": "6.4", + "required": false, + "internal": false, + "exampleValue": "my_project" + }, + { + "key": "componentId", + "description": "Component ID", + "required": false, + "internal": false, + "exampleValue": "AU-Tpxb--iU5OvuD2FLy", + "deprecatedSince": "6.4", + "deprecatedKey": "uuid", + "deprecatedKeySince": "6.4" + } + ] + }, + { + "key": "search", + "description": "Search for components", + "since": "6.3", + "internal": false, + "post": false, + "hasResponseExample": true, + "changelog": [], + "params": [ + { + "key": "language", + "description": "Language key. If provided, only components for the given language are returned.", + "required": false, + "internal": false, + "exampleValue": "" + }, + { + "key": "organization", + "description": "Organization key", + "since": "6.3", + "required": false, + "internal": true, + "exampleValue": "my-org" + }, + { + "key": "p", + "description": "1-based page number", + "required": false, + "internal": false, + "defaultValue": "1", + "exampleValue": "42", + "deprecatedKey": "pageIndex", + "deprecatedKeySince": "5.2" + }, + { + "key": "ps", + "description": "Page size. Must be greater than 0.", + "required": false, + "internal": false, + "defaultValue": "100", + "exampleValue": "20", + "deprecatedKey": "pageSize", + "deprecatedKeySince": "5.2" + }, + { + "key": "q", + "description": "Limit search to: <ul><li>component names that contain the supplied string</li><li>component keys that are exactly the same as the supplied string</li></ul>", + "required": false, + "internal": false, + "exampleValue": "sonar" + }, + { + "key": "qualifiers", + "description": "Comma-separated list of component qualifiers. Filter the results with the specified qualifiers. Possible values are:<ul><li>BRC - Sub-projects</li><li>DIR - Directories</li><li>FIL - Files</li><li>TRK - Projects</li><li>UTS - Test Files</li></ul>", + "required": true, + "internal": false, + "possibleValues": [ + "BRC", + "DIR", + "FIL", + "TRK", + "UTS" + ] + } + ] + }, + { + "key": "search_projects", + "description": "Search for projects", + "since": "6.2", + "internal": true, + "post": false, + "hasResponseExample": true, + "changelog": [ + { + "description": "The 'filter' parameter now allows 'NO_DATA' as value for numeric metrics", + "version": "6.5" + }, + { + "description": "Added the option 'analysisDate' for the 'sort' parameter", + "version": "6.5" + }, + { + "description": "Value 'leakPeriodDate' is added to parameter 'f'", + "version": "6.5" + }, + { + "description": "The 'languages' parameter accepts 'filter' to filter by language", + "version": "6.4" + }, + { + "description": "The 'visibility' field is added", + "version": "6.4" + } + ], + "params": [ + { + "key": "asc", + "description": "Ascending sort", + "required": false, + "internal": false, + "defaultValue": "true", + "possibleValues": [ + "true", + "false", + "yes", + "no" + ] + }, + { + "key": "f", + "description": "Comma-separated list of the fields to be returned in response", + "since": "6.4", + "required": false, + "internal": false, + "possibleValues": [ + "analysisDate", + "leakPeriodDate" + ] + }, + { + "key": "facets", + "description": "Comma-separated list of the facets to be computed. No facet is computed by default.", + "required": false, + "internal": false, + "possibleValues": [ + "alert_status", + "coverage", + "duplicated_lines_density", + "languages", + "ncloc", + "new_coverage", + "new_duplicated_lines_density", + "new_lines", + "new_maintainability_rating", + "new_reliability_rating", + "new_security_rating", + "reliability_rating", + "security_rating", + "sqale_rating", + "tags" + ] + }, + { + "key": "filter", + "description": "Filter of projects on name, key, measure value, quality gate, language, tag or whether a project is a favorite or not.<br>The filter must be encoded to form a valid URL (for example '=' must be replaced by '%3D').<br>Examples of use:<ul> <li>to filter my favorite projects with a failed quality gate and a coverage greater than or equals to 60% and a coverage strictly lower than 80%:<br> <code>filter=\"alert_status = ERROR and isFavorite and coverage >= 60 and coverage < 80\"</code></li> <li>to filter projects with a reliability, security and maintainability rating equals or worse than B:<br> <code>filter=\"reliability_rating>=2 and security_rating>=2 and sqale_rating>=2\"</code></li> <li>to filter projects without duplication data:<br> <code>filter=\"duplicated_lines_density = NO_DATA\"</code></li></ul>To filter on project name or key, use the 'query' keyword, for instance : <code>filter='query = \"Sonar\"'</code>.<br><br>To filter on a numeric metric, provide the metric key.<br>These are the supported metric keys:<br><ul><li>alert_status</li><li>coverage</li><li>duplicated_lines_density</li><li>lines</li><li>ncloc</li><li>ncloc_language_distribution</li><li>new_coverage</li><li>new_duplicated_lines_density</li><li>new_lines</li><li>new_maintainability_rating</li><li>new_reliability_rating</li><li>new_security_rating</li><li>reliability_rating</li><li>security_rating</li><li>sqale_rating</li></ul><br>To filter on a rating, provide the corresponding metric key (ex: reliability_rating for reliability rating).<br>The possible values are:<ul> <li>'1' for rating A</li> <li>'2' for rating B</li> <li>'3' for rating C</li> <li>'4' for rating D</li> <li>'5' for rating E</li></ul>To filter on a Quality Gate status use the metric key 'alert_status'. Only the '=' operator can be used.<br>The possible values are:<ul> <li>'OK' for Passed</li> <li>'WARN' for Warning</li> <li>'ERROR' for Failed</li></ul>To filter on language keys use the language key: <ul> <li>to filter on a single language you can use 'language = java'</li> <li>to filter on several languages you must use 'language IN (java, js)'</li></ul>Use the WS api/languages/list to find the key of a language.<br> To filter on tags use the 'tag' keyword:<ul> <li>to filter on one tag you can use <code>tag = finance</code></li> <li>to filter on several tags you must use <code>tag in (offshore, java)</code></li></ul>", + "required": false, + "internal": false + }, + { + "key": "organization", + "description": "the organization to search projects in", + "since": "6.3", + "required": false, + "internal": true + }, + { + "key": "p", + "description": "1-based page number", + "required": false, + "internal": false, + "defaultValue": "1", + "exampleValue": "42", + "deprecatedKey": "pageIndex", + "deprecatedKeySince": "5.2" + }, + { + "key": "ps", + "description": "Page size. Must be greater than 0 and less than 500", + "required": false, + "internal": false, + "defaultValue": "100", + "exampleValue": "20", + "deprecatedKey": "pageSize", + "deprecatedKeySince": "5.2", + "maximumValue": 500 + }, + { + "key": "s", + "description": "Sort projects by numeric metric key, quality gate status (using 'alert_status'), last analysis date (using 'analysisDate'), or by project name.", + "since": "6.4", + "required": false, + "internal": false, + "defaultValue": "name", + "possibleValues": [ + "alert_status", + "analysisDate", + "coverage", + "duplicated_lines_density", + "lines", + "name", + "ncloc", + "ncloc_language_distribution", + "new_coverage", + "new_duplicated_lines_density", + "new_lines", + "new_maintainability_rating", + "new_reliability_rating", + "new_security_rating", + "reliability_rating", + "security_rating", + "sqale_rating" + ] + } + ] + }, + { + "key": "show", + "description": "Returns a component (file, directory, project, view…) and its ancestors. The ancestors are ordered from the parent to the root project. The 'componentId' or 'component' parameter must be provided.<br>Requires the following permission: 'Browse' on the project of the specified component.", + "since": "5.4", + "internal": false, + "post": false, + "hasResponseExample": true, + "changelog": [ + { + "description": "'branch' is added to the response", + "version": "6.6" + }, + { + "description": "'version' is added to the response", + "version": "6.6" + }, + { + "description": "Leak period date is added to the response", + "version": "6.5" + }, + { + "description": "Analysis date has been added to the response", + "version": "6.4" + }, + { + "description": "The field 'id' is deprecated in the response", + "version": "6.4" + }, + { + "description": "The 'visibility' field is added to the response", + "version": "6.4" + } + ], + "params": [ + { + "key": "branch", + "description": "Branch key", + "since": "6.6", + "required": false, + "internal": true, + "exampleValue": "feature/my_branch" + }, + { + "key": "component", + "description": "Component key", + "required": false, + "internal": false, + "exampleValue": "my_project", + "deprecatedKey": "key", + "deprecatedKeySince": "6.4" + }, + { + "key": "componentId", + "description": "Component id", + "required": false, + "internal": false, + "exampleValue": "AU-Tpxb--iU5OvuD2FLy", + "deprecatedSince": "6.4", + "deprecatedKey": "id", + "deprecatedKeySince": "6.4" + } + ] + }, + { + "key": "suggestions", + "description": "Internal WS for the top-right search engine. The result will contain component search results, grouped by their qualifiers.<p>Each result contains:<ul><li>the organization key</li><li>the component key</li><li>the component's name (unescaped)</li><li>optionally a display name, which puts emphasis to matching characters (this text contains html tags and parts of the html-escaped name)</li></ul>", + "since": "4.2", + "internal": true, + "post": false, + "hasResponseExample": true, + "changelog": [ + { + "description": "Parameter 's' is optional", + "version": "6.4" + } + ], + "params": [ + { + "key": "more", + "description": "Category, for which to display the next 20 results (skipping the first 6 results)", + "since": "6.4", + "required": false, + "internal": false, + "possibleValues": [ + "VW", + "SVW", + "APP", + "TRK", + "BRC", + "FIL", + "UTS" + ] + }, + { + "key": "recentlyBrowsed", + "description": "Comma separated list of component keys, that have recently been browsed by the user. Only the first 50 items will be used. Order is not taken into account.", + "since": "6.4", + "required": false, + "internal": false, + "exampleValue": "org.sonarsource:sonarqube,some.other:project", + "maxValuesAllowed": 50 + }, + { + "key": "s", + "description": "Search query with a minimum of two characters. Can contain several search tokens, separated by spaces. Search tokens with only one character will be ignored.", + "required": false, + "internal": false, + "exampleValue": "sonar" + } + ] + }, + { + "key": "tree", + "description": "Navigate through components based on the chosen strategy. The componentId or the component parameter must be provided.<br>Requires the following permission: 'Browse' on the specified project.<br>When limiting search with the q parameter, directories are not returned.", + "since": "5.4", + "internal": false, + "post": false, + "hasResponseExample": true, + "changelog": [ + { + "description": "The field 'id' is deprecated in the response", + "version": "6.4" + } + ], + "params": [ + { + "key": "asc", + "description": "Ascending sort", + "required": false, + "internal": false, + "defaultValue": "true", + "possibleValues": [ + "true", + "false", + "yes", + "no" + ] + }, + { + "key": "branch", + "description": "Branch key", + "since": "6.6", + "required": false, + "internal": true, + "exampleValue": "feature/my_branch" + }, + { + "key": "component", + "description": "Base component key. The search is based on this component.", + "required": false, + "internal": false, + "exampleValue": "my_project", + "deprecatedKey": "baseComponentKey", + "deprecatedKeySince": "6.4" + }, + { + "key": "componentId", + "description": "Base component id. The search is based on this component.", + "required": false, + "internal": false, + "exampleValue": "AU-TpxcA-iU5OvuD2FLz", + "deprecatedSince": "6.4", + "deprecatedKey": "baseComponentId", + "deprecatedKeySince": "6.4" + }, + { + "key": "p", + "description": "1-based page number", + "required": false, + "internal": false, + "defaultValue": "1", + "exampleValue": "42", + "deprecatedKey": "pageIndex", + "deprecatedKeySince": "5.2" + }, + { + "key": "ps", + "description": "Page size. Must be greater than 0 and less than 500", + "required": false, + "internal": false, + "defaultValue": "100", + "exampleValue": "20", + "deprecatedKey": "pageSize", + "deprecatedKeySince": "5.2", + "maximumValue": 500 + }, + { + "key": "q", + "description": "Limit search to: <ul><li>component names that contain the supplied string</li><li>component keys that are exactly the same as the supplied string</li></ul>Must have at least 3 characters", + "required": false, + "internal": false, + "exampleValue": "FILE_NAM" + }, + { + "key": "qualifiers", + "description": "Comma-separated list of component qualifiers. Filter the results with the specified qualifiers. Possible values are:<ul><li>BRC - Sub-projects</li><li>DIR - Directories</li><li>FIL - Files</li><li>TRK - Projects</li><li>UTS - Test Files</li></ul>", + "required": false, + "internal": false, + "possibleValues": [ + "BRC", + "DIR", + "FIL", + "TRK", + "UTS" + ] + }, + { + "key": "s", + "description": "Comma-separated list of sort fields", + "required": false, + "internal": false, + "defaultValue": "name", + "exampleValue": "name, path", + "deprecatedKey": "sort", + "deprecatedKeySince": "5.4", + "possibleValues": [ + "name", + "path", + "qualifier" + ] + }, + { + "key": "strategy", + "description": "Strategy to search for base component descendants:<ul><li>children: return the children components of the base component. Grandchildren components are not returned</li><li>all: return all the descendants components of the base component. Grandchildren are returned.</li><li>leaves: return all the descendant components (files, in general) which don't have other children. They are the leaves of the component tree.</li></ul>", + "required": false, + "internal": false, + "defaultValue": "all", + "possibleValues": [ + "all", + "children", + "leaves" + ] + } + ] + } + ] + }, + { + "path": "api/custom_measures", + "since": "5.2", + "description": "Manage custom measures for a project. See also api/metrics.", + "actions": [ + { + "key": "create", + "description": "Create a custom measure.<br /> The project id or the project key must be provided (only project and module custom measures can be created). The metric id or the metric key must be provided.<br/>Requires 'Administer System' permission or 'Administer' permission on the project.", + "since": "5.2", + "internal": false, + "post": true, + "hasResponseExample": false, + "changelog": [], + "params": [ + { + "key": "description", + "description": "Description", + "required": false, + "internal": false, + "exampleValue": "Team size growing." + }, + { + "key": "metricId", + "description": "Metric id", + "required": false, + "internal": false, + "exampleValue": "16" + }, + { + "key": "metricKey", + "description": "Metric key", + "required": false, + "internal": false, + "exampleValue": "ncloc" + }, + { + "key": "projectId", + "description": "Project id", + "required": false, + "internal": false, + "exampleValue": "ce4c03d6-430f-40a9-b777-ad877c00aa4d" + }, + { + "key": "projectKey", + "description": "Project key", + "required": false, + "internal": false, + "exampleValue": "my_project" + }, + { + "key": "value", + "description": "Measure value. Value type depends on metric type:<ul><li>INT - type: integer</li><li>FLOAT - type: double</li><li>PERCENT - type: double</li><li>BOOL - the possible values are true or false</li><li>STRING - type: string</li><li>MILLISEC - type: integer</li><li>DATA - type: string</li><li>LEVEL - the possible values are OK, WARN, ERROR</li><li>DISTRIB - type: string</li><li>RATING - type: double</li><li>WORK_DUR - long representing the number of minutes</li></ul>", + "required": true, + "internal": false, + "exampleValue": "47" + } + ] + }, + { + "key": "delete", + "description": "Delete a custom measure.<br /> Requires 'Administer System' permission or 'Administer' permission on the project.", + "since": "5.2", + "internal": false, + "post": true, + "hasResponseExample": false, + "changelog": [], + "params": [ + { + "key": "id", + "description": "Id", + "required": true, + "internal": false, + "exampleValue": "24" + } + ] + }, + { + "key": "metrics", + "description": "List all custom metrics for which no custom measure already exists on a given project.<br /> The project id or project key must be provided.<br />Requires 'Administer System' permission or 'Administer' permission on the project.", + "since": "5.2", + "internal": true, + "post": false, + "hasResponseExample": true, + "changelog": [], + "params": [ + { + "key": "projectId", + "description": "Project id", + "required": false, + "internal": false, + "exampleValue": "ce4c03d6-430f-40a9-b777-ad877c00aa4d" + }, + { + "key": "projectKey", + "description": "Project key", + "required": false, + "internal": false, + "exampleValue": "my_project" + } + ] + }, + { + "key": "search", + "description": "List custom measures. The project id or project key must be provided.<br />Requires 'Administer System' permission or 'Administer' permission on the project.", + "since": "5.2", + "internal": false, + "post": false, + "hasResponseExample": true, + "changelog": [], + "params": [ + { + "key": "f", + "description": "Comma-separated list of the fields to be returned in response. All the fields are returned by default.", + "required": false, + "internal": false, + "possibleValues": [ + "projectId", + "projectKey", + "value", + "description", + "metric", + "createdAt", + "updatedAt", + "user", + "pending" + ] + }, + { + "key": "p", + "description": "1-based page number", + "required": false, + "internal": false, + "defaultValue": "1", + "exampleValue": "42", + "deprecatedKey": "pageIndex", + "deprecatedKeySince": "5.2" + }, + { + "key": "projectId", + "description": "Project id", + "required": false, + "internal": false, + "exampleValue": "ce4c03d6-430f-40a9-b777-ad877c00aa4d" + }, + { + "key": "projectKey", + "description": "Project key", + "required": false, + "internal": false, + "exampleValue": "my_project" + }, + { + "key": "ps", + "description": "Page size. Must be greater than 0 and less than 500", + "required": false, + "internal": false, + "defaultValue": "100", + "exampleValue": "20", + "deprecatedKey": "pageSize", + "deprecatedKeySince": "5.2", + "maximumValue": 500 + } + ] + }, + { + "key": "update", + "description": "Update a custom measure. Value and/or description must be provided<br />Requires 'Administer System' permission or 'Administer' permission on the project.", + "since": "5.2", + "internal": false, + "post": true, + "hasResponseExample": false, + "changelog": [], + "params": [ + { + "key": "description", + "required": false, + "internal": false, + "exampleValue": "Team size growing." + }, + { + "key": "id", + "description": "id", + "required": true, + "internal": false, + "exampleValue": "42" + }, + { + "key": "value", + "description": "Measure value. Value type depends on metric type:<ul><li>INT - type: integer</li><li>FLOAT - type: double</li><li>PERCENT - type: double</li><li>BOOL - the possible values are true or false</li><li>STRING - type: string</li><li>MILLISEC - type: integer</li><li>DATA - type: string</li><li>LEVEL - the possible values are OK, WARN, ERROR</li><li>DISTRIB - type: string</li><li>RATING - type: double</li><li>WORK_DUR - long representing the number of minutes</li></ul>", + "required": false, + "internal": false, + "exampleValue": "true" + } + ] + } + ] + }, + { + "path": "api/duplications", + "since": "4.4", + "description": "Get duplication information for a project.", + "actions": [ + { + "key": "show", + "description": "Get duplications. Require Browse permission on file's project", + "since": "4.4", + "internal": false, + "post": false, + "hasResponseExample": true, + "changelog": [ + { + "description": "The fields 'uuid', 'projectUuid', 'subProjectUuid' are deprecated in the response.", + "version": "6.5" + } + ], + "params": [ + { + "key": "branch", + "description": "Branch key", + "required": false, + "internal": true, + "exampleValue": "feature/my_branch" + }, + { + "key": "key", + "description": "File key", + "required": false, + "internal": false, + "exampleValue": "my_project:/src/foo/Bar.php" + }, + { + "key": "uuid", + "description": "File ID. If provided, 'key' must not be provided.", + "required": false, + "internal": false, + "exampleValue": "584a89f2-8037-4f7b-b82c-8b45d2d63fb2", + "deprecatedSince": "6.5" + } + ] + } + ] + }, + { + "path": "api/editions", + "since": "6.7", + "description": "Manage SonarSource commercial editions.", + "actions": [ + { + "key": "apply_license", + "description": "Apply changes to SonarQube to match the specified license. Clear error message of previous automatic install of an edition, if there is any. Require 'Administer System' permission.", + "since": "6.7", + "internal": false, + "post": true, + "hasResponseExample": true, + "changelog": [], + "params": [ + { + "key": "license", + "description": "the license", + "since": "6.7", + "required": true, + "internal": false + } + ] + }, + { + "key": "clear_error_message", + "description": "Clear error message of last install of an edition (if any). Require 'Administer System' permission.", + "since": "6.7", + "internal": false, + "post": true, + "hasResponseExample": false, + "changelog": [] + }, + { + "key": "form_data", + "description": "Provide data to prefill license request forms: the server ID and the total number of lines of code.", + "since": "6.7", + "internal": true, + "post": false, + "hasResponseExample": true, + "changelog": [] + }, + { + "key": "preview", + "description": "Preview the changes to SonarQube to match the specified license. Requires 'Administer System' permission.", + "since": "6.7", + "internal": false, + "post": true, + "hasResponseExample": true, + "changelog": [], + "params": [ + { + "key": "license", + "description": "the license", + "since": "6.7", + "required": true, + "internal": false + } + ] + }, + { + "key": "status", + "description": "Provide status of SonarSource commercial edition of the current SonarQube. Requires 'Administer System' permission.", + "since": "6.7", + "internal": false, + "post": false, + "hasResponseExample": true, + "changelog": [] + }, + { + "key": "uninstall", + "description": "Uninstall the currently installed edition. Requires 'Administer System' permission.", + "since": "6.7", + "internal": false, + "post": true, + "hasResponseExample": false, + "changelog": [] + } + ] + }, + { + "path": "api/emails", + "since": "6.1", + "description": "Manage emails", + "actions": [ + { + "key": "send", + "description": "Test email configuration by sending an email<br>Requires 'Administer System' permission.", + "since": "6.1", + "internal": true, + "post": true, + "hasResponseExample": false, + "changelog": [], + "params": [ + { + "key": "message", + "description": "Content of the email", + "required": true, + "internal": false + }, + { + "key": "subject", + "description": "Subject of the email", + "required": false, + "internal": false, + "exampleValue": "Test Message from SonarQube" + }, + { + "key": "to", + "description": "Email address", + "required": true, + "internal": false, + "exampleValue": "john@doo.com" + } + ] + } + ] + }, + { + "path": "api/favorites", + "since": "6.3", + "description": "Manage user favorites", + "actions": [ + { + "key": "add", + "description": "Add a component (project, directory, file etc.) as favorite for the authenticated user.<br>Requires authentication and the following permission: 'Browse' on the project of the specified component.", + "since": "6.3", + "internal": false, + "post": true, + "hasResponseExample": false, + "changelog": [], + "params": [ + { + "key": "component", + "description": "Component key", + "required": true, + "internal": false, + "exampleValue": "my_project:/src/foo/Bar.php" + } + ] + }, + { + "key": "remove", + "description": "Remove a component (project, directory, file etc.) as favorite for the authenticated user.<br>Requires authentication.", + "since": "6.3", + "internal": false, + "post": true, + "hasResponseExample": false, + "changelog": [], + "params": [ + { + "key": "component", + "description": "Component key", + "required": true, + "internal": false, + "exampleValue": "my_project" + } + ] + }, + { + "key": "search", + "description": "Search for the authenticated user favorites.<br>Requires authentication.", + "since": "6.3", + "internal": false, + "post": false, + "hasResponseExample": true, + "changelog": [], + "params": [ + { + "key": "p", + "description": "1-based page number", + "required": false, + "internal": false, + "defaultValue": "1", + "exampleValue": "42", + "deprecatedKey": "pageIndex", + "deprecatedKeySince": "5.2" + }, + { + "key": "ps", + "description": "Page size. Must be greater than 0 and less than 500", + "required": false, + "internal": false, + "defaultValue": "100", + "exampleValue": "20", + "deprecatedKey": "pageSize", + "deprecatedKeySince": "5.2", + "maximumValue": 500 + } + ] + } + ] + }, + { + "path": "api/favourites", + "since": "2.6", + "description": "Removed since 6.3, please use api/favorites instead", + "actions": [ + { + "key": "index", + "description": "The web service is removed and you're invited to use api/favorites instead", + "since": "2.6", + "deprecatedSince": "6.3", + "internal": false, + "post": false, + "hasResponseExample": true, + "changelog": [] + } + ] + }, + { + "path": "api/issues", + "since": "3.6", + "description": "Read and update issues.", + "actions": [ + { + "key": "add_comment", + "description": "Add a comment.<br/>Requires authentication and the following permission: 'Browse' on the project of the specified issue.", + "since": "3.6", + "internal": false, + "post": true, + "hasResponseExample": true, + "changelog": [ + { + "description": "the database ids of the components are removed from the response", + "version": "6.5" + }, + { + "description": "the response field components.uuid is deprecated. Use components.key instead.", + "version": "6.5" + }, + { + "description": "the response returns the issue with all its details", + "version": "6.3" + } + ], + "params": [ + { + "key": "issue", + "description": "Issue key", + "required": true, + "internal": false, + "exampleValue": "AU-Tpxb--iU5OvuD2FLy" + }, + { + "key": "text", + "description": "Comment text", + "required": true, + "internal": false, + "exampleValue": "Won't fix because it doesn't apply to the context" + } + ] + }, + { + "key": "assign", + "description": "Assign/Unassign an issue. Requires authentication and Browse permission on project", + "since": "3.6", + "internal": false, + "post": true, + "hasResponseExample": true, + "changelog": [ + { + "description": "the database ids of the components are removed from the response", + "version": "6.5" + }, + { + "description": "the response field components.uuid is deprecated. Use components.key instead.", + "version": "6.5" + } + ], + "params": [ + { + "key": "assignee", + "description": "Login of the assignee. When not set, it will unassign the issue. Use '_me' to assign to current user", + "required": false, + "internal": false, + "exampleValue": "admin" + }, + { + "key": "issue", + "description": "Issue key", + "required": true, + "internal": false, + "exampleValue": "AU-Tpxb--iU5OvuD2FLy" + }, + { + "key": "me", + "description": "(deprecated) Assign the issue to the logged-in user. Replaced by the parameter assignee=_me", + "required": false, + "internal": false, + "deprecatedSince": "5.2", + "possibleValues": [ + "true", + "false", + "yes", + "no" + ] + } + ] + }, + { + "key": "authors", + "description": "Search SCM accounts which match a given query", + "since": "5.1", + "internal": false, + "post": false, + "hasResponseExample": true, + "changelog": [], + "params": [ + { + "key": "ps", + "description": "The size of the list to return", + "required": false, + "internal": false, + "defaultValue": "10", + "exampleValue": "25" + }, + { + "key": "q", + "description": "A pattern to match SCM accounts against", + "required": false, + "internal": false, + "exampleValue": "luke" + } + ] + }, + { + "key": "bulk_change", + "description": "Bulk change on issues.<br/>Requires authentication.", + "since": "3.7", + "internal": false, + "post": true, + "hasResponseExample": true, + "changelog": [ + { + "description": "'actions' parameter is ignored", + "version": "6.3" + } + ], + "params": [ + { + "key": "add_tags", + "description": "Add tags", + "required": false, + "internal": false, + "exampleValue": "security,java8", + "deprecatedKey": "add_tags.tags", + "deprecatedKeySince": "6.2" + }, + { + "key": "assign", + "description": "To assign the list of issues to a specific user (login), or un-assign all the issues", + "required": false, + "internal": false, + "exampleValue": "john.smith", + "deprecatedKey": "assign.assignee", + "deprecatedKeySince": "6.2" + }, + { + "key": "comment", + "description": "To add a comment to a list of issues", + "required": false, + "internal": false, + "exampleValue": "Here is my comment" + }, + { + "key": "do_transition", + "description": "Transition", + "required": false, + "internal": false, + "exampleValue": "reopen", + "deprecatedKey": "do_transition.transition", + "deprecatedKeySince": "6.2", + "possibleValues": [ + "confirm", + "unconfirm", + "reopen", + "resolve", + "falsepositive", + "wontfix", + "close" + ] + }, + { + "key": "issues", + "description": "Comma-separated list of issue keys", + "required": true, + "internal": false, + "exampleValue": "AU-Tpxb--iU5OvuD2FLy,AU-TpxcA-iU5OvuD2FLz" + }, + { + "key": "plan", + "description": "In 5.5, action plans are dropped. Has no effect. To plan the list of issues to a specific action plan (key), or unlink all the issues from an action plan", + "required": false, + "internal": false, + "deprecatedSince": "5.5" + }, + { + "key": "remove_tags", + "description": "Remove tags", + "required": false, + "internal": false, + "exampleValue": "security,java8", + "deprecatedKey": "remove_tags.tags", + "deprecatedKeySince": "6.2" + }, + { + "key": "sendNotifications", + "since": "4.0", + "required": false, + "internal": false, + "defaultValue": "false", + "possibleValues": [ + "true", + "false", + "yes", + "no" + ] + }, + { + "key": "set_severity", + "description": "To change the severity of the list of issues", + "required": false, + "internal": false, + "exampleValue": "BLOCKER", + "deprecatedKey": "set_severity.severity", + "deprecatedKeySince": "6.2", + "possibleValues": [ + "INFO", + "MINOR", + "MAJOR", + "CRITICAL", + "BLOCKER" + ] + }, + { + "key": "set_type", + "description": "To change the type of the list of issues", + "since": "5.5", + "required": false, + "internal": false, + "exampleValue": "BUG", + "deprecatedKey": "set_type.type", + "deprecatedKeySince": "6.2", + "possibleValues": [ + "CODE_SMELL", + "BUG", + "VULNERABILITY" + ] + } + ] + }, + { + "key": "changelog", + "description": "Display changelog of an issue.<br/>Requires the 'Browse' permission on the project of the specified issue.", + "since": "4.1", + "internal": false, + "post": false, + "hasResponseExample": true, + "changelog": [ + { + "description": "changes on effort is expressed with the raw value in minutes (instead of the duration previously)", + "version": "6.3" + } + ], + "params": [ + { + "key": "issue", + "description": "Issue key", + "required": true, + "internal": false, + "exampleValue": "AU-Tpxb--iU5OvuD2FLy" + } + ] + }, + { + "key": "component_tags", + "description": "List tags for the issues under a given component (including issues on the descendants of the component)", + "since": "5.1", + "internal": true, + "post": false, + "hasResponseExample": true, + "changelog": [], + "params": [ + { + "key": "componentUuid", + "description": "A component UUID", + "required": true, + "internal": false, + "exampleValue": "7d8749e8-3070-4903-9188-bdd82933bb92" + }, + { + "key": "createdAfter", + "description": "To retrieve tags on issues created after the given date (inclusive). <br>Either a date (server timezone) or datetime can be provided.", + "required": false, + "internal": false, + "exampleValue": "2017-10-19 or 2017-10-19T13:00:00+0200" + }, + { + "key": "ps", + "description": "The maximum size of the list to return", + "required": false, + "internal": false, + "defaultValue": "10", + "exampleValue": "25" + } + ] + }, + { + "key": "delete_comment", + "description": "Delete a comment.<br/>Requires authentication and the following permission: 'Browse' on the project of the specified issue.", + "since": "3.6", + "internal": false, + "post": true, + "hasResponseExample": true, + "changelog": [ + { + "description": "the response field components.uuid is deprecated. Use components.key instead.", + "version": "6.5" + }, + { + "description": "the database ids of the components are removed from the response", + "version": "6.5" + }, + { + "description": "the response returns the issue with all its details", + "version": "6.3" + }, + { + "description": "the 'key' parameter is renamed 'comment'", + "version": "6.3" + } + ], + "params": [ + { + "key": "comment", + "description": "Comment key", + "since": "6.3", + "required": true, + "internal": false, + "exampleValue": "AU-Tpxb--iU5OvuD2FLy", + "deprecatedKey": "key", + "deprecatedKeySince": "6.3" + } + ] + }, + { + "key": "do_transition", + "description": "Do workflow transition on an issue. Requires authentication and Browse permission on project.<br/>The transitions 'wontfix' and 'falsepositive' require the permission 'Administer Issues'.", + "since": "3.6", + "internal": false, + "post": true, + "hasResponseExample": true, + "changelog": [ + { + "description": "the database ids of the components are removed from the response", + "version": "6.5" + }, + { + "description": "the response field components.uuid is deprecated. Use components.key instead.", + "version": "6.5" + } + ], + "params": [ + { + "key": "issue", + "description": "Issue key", + "required": true, + "internal": false, + "exampleValue": "AU-Tpxb--iU5OvuD2FLy" + }, + { + "key": "transition", + "description": "Transition", + "required": true, + "internal": false, + "possibleValues": [ + "confirm", + "unconfirm", + "reopen", + "resolve", + "falsepositive", + "wontfix", + "close" + ] + } + ] + }, + { + "key": "edit_comment", + "description": "Edit a comment.<br/>Requires authentication and the following permission: 'Browse' on the project of the specified issue.", + "since": "3.6", + "internal": false, + "post": true, + "hasResponseExample": true, + "changelog": [ + { + "description": "the database ids of the components are removed from the response", + "version": "6.5" + }, + { + "description": "the response field components.uuid is deprecated. Use components.key instead.", + "version": "6.5" + }, + { + "description": "the response returns the issue with all its details", + "version": "6.3" + }, + { + "description": "the 'key' parameter has been renamed comment", + "version": "6.3" + } + ], + "params": [ + { + "key": "comment", + "description": "Comment key", + "since": "6.3", + "required": true, + "internal": false, + "exampleValue": "AU-Tpxb--iU5OvuD2FLy", + "deprecatedKey": "key", + "deprecatedKeySince": "6.3" + }, + { + "key": "text", + "description": "Comment text", + "required": true, + "internal": false, + "exampleValue": "Won't fix because it doesn't apply to the context" + } + ] + }, + { + "key": "search", + "description": "Search for issues.<br>At most one of the following parameters can be provided at the same time: componentKeys, componentUuids, components, componentRootUuids, componentRoots.<br>Requires the 'Browse' permission on the specified project(s).", + "since": "3.6", + "internal": false, + "post": false, + "hasResponseExample": true, + "changelog": [ + { + "description": "parameters 'projects', 'projectUuids', 'moduleUuids', 'directories', 'fileUuids' are marked as internal", + "version": "6.5" + }, + { + "description": "response field 'email' is renamed 'avatar'", + "version": "6.3" + }, + { + "description": "response fields 'reporter' and 'actionPlan' are removed (drop of action plan and manual issue features)", + "version": "5.5" + }, + { + "description": "parameters 'reporters', 'actionPlans' and 'planned' are dropped and therefore ignored (drop of action plan and manual issue features)", + "version": "5.5" + }, + { + "description": "response field 'debt' is renamed 'effort'", + "version": "5.5" + } + ], + "params": [ + { + "key": "additionalFields", + "description": "Comma-separated list of the optional fields to be returned in response. Action plans are dropped in 5.5, it is not returned in the response.", + "since": "5.2", + "required": false, + "internal": false, + "possibleValues": [ + "_all", + "comments", + "languages", + "actionPlans", + "rules", + "transitions", + "actions", + "users" + ] + }, + { + "key": "asc", + "description": "Ascending sort", + "required": false, + "internal": false, + "defaultValue": "true", + "possibleValues": [ + "true", + "false", + "yes", + "no" + ] + }, + { + "key": "assigned", + "description": "To retrieve assigned or unassigned issues", + "required": false, + "internal": false, + "possibleValues": [ + "true", + "false", + "yes", + "no" + ] + }, + { + "key": "assignees", + "description": "Comma-separated list of assignee logins. The value '__me__' can be used as a placeholder for user who performs the request", + "required": false, + "internal": false, + "exampleValue": "admin,usera,__me__" + }, + { + "key": "authors", + "description": "Comma-separated list of SCM accounts", + "required": false, + "internal": false, + "exampleValue": "torvalds@linux-foundation.org" + }, + { + "key": "branch", + "description": "Branch key", + "since": "6.6", + "required": false, + "internal": true, + "exampleValue": "feature/my_branch" + }, + { + "key": "componentKeys", + "description": "Comma-separated list of component keys. Retrieve issues associated to a specific list of components (and all its descendants). A component can be a portfolio, project, module, directory or file.", + "required": false, + "internal": false, + "exampleValue": "my_project" + }, + { + "key": "componentRootUuids", + "description": "If used, will have the same meaning as componentUuids AND onComponentOnly=false.", + "required": false, + "internal": false, + "deprecatedSince": "5.1" + }, + { + "key": "componentRoots", + "description": "If used, will have the same meaning as componentKeys AND onComponentOnly=false.", + "required": false, + "internal": false, + "deprecatedSince": "5.1" + }, + { + "key": "componentUuids", + "description": "To retrieve issues associated to a specific list of components their sub-components (comma-separated list of component IDs). This parameter is mostly used by the Issues page, please prefer usage of the componentKeys parameter. A component can be a project, module, directory or file.", + "required": false, + "internal": false, + "exampleValue": "584a89f2-8037-4f7b-b82c-8b45d2d63fb2", + "deprecatedSince": "6.5" + }, + { + "key": "components", + "description": "If used, will have the same meaning as componentKeys AND onComponentOnly=true.", + "required": false, + "internal": false, + "deprecatedSince": "5.1" + }, + { + "key": "createdAfter", + "description": "To retrieve issues created after the given date (inclusive). <br>Either a date (server timezone) or datetime can be provided. <br>If this parameter is set, createdSince must not be set", + "required": false, + "internal": false, + "exampleValue": "2017-10-19 or 2017-10-19T13:00:00+0200" + }, + { + "key": "createdAt", + "description": "Datetime to retrieve issues created during a specific analysis", + "required": false, + "internal": false, + "exampleValue": "2017-10-19T13:00:00+0200" + }, + { + "key": "createdBefore", + "description": "To retrieve issues created before the given date (inclusive). <br>Either a date (server timezone) or datetime can be provided.", + "required": false, + "internal": false, + "exampleValue": "2017-10-19 or 2017-10-19T13:00:00+0200" + }, + { + "key": "createdInLast", + "description": "To retrieve issues created during a time span before the current time (exclusive). Accepted units are 'y' for year, 'm' for month, 'w' for week and 'd' for day. If this parameter is set, createdAfter must not be set", + "required": false, + "internal": false, + "exampleValue": "1m2w (1 month 2 weeks)" + }, + { + "key": "directories", + "description": "To retrieve issues associated to a specific list of directories (comma-separated list of directory paths). This parameter is only meaningful when a module is selected. This parameter is mostly used by the Issues page, please prefer usage of the componentKeys parameter. ", + "since": "5.1", + "required": false, + "internal": true, + "exampleValue": "src/main/java/org/sonar/server/" + }, + { + "key": "facetMode", + "description": "Choose the returned value for facet items, either count of issues or sum of debt.<br/>Since 5.5, 'debt' mode is deprecated and replaced by 'effort'", + "required": false, + "internal": false, + "defaultValue": "count", + "possibleValues": [ + "count", + "effort", + "debt" + ] + }, + { + "key": "facets", + "description": "Comma-separated list of the facets to be computed. No facet is computed by default.<br/>Since 5.5, facet 'actionPlans' is deprecated.<br/>Since 5.5, facet 'reporters' is deprecated.", + "required": false, + "internal": false, + "possibleValues": [ + "severities", + "statuses", + "resolutions", + "actionPlans", + "projectUuids", + "rules", + "assignees", + "assigned_to_me", + "reporters", + "authors", + "moduleUuids", + "fileUuids", + "directories", + "languages", + "tags", + "types", + "createdAt" + ] + }, + { + "key": "fileUuids", + "description": "To retrieve issues associated to a specific list of files (comma-separated list of file IDs). This parameter is mostly used by the Issues page, please prefer usage of the componentKeys parameter. ", + "required": false, + "internal": true, + "exampleValue": "bdd82933-3070-4903-9188-7d8749e8bb92" + }, + { + "key": "issues", + "description": "Comma-separated list of issue keys", + "required": false, + "internal": false, + "exampleValue": "5bccd6e8-f525-43a2-8d76-fcb13dde79ef" + }, + { + "key": "languages", + "description": "Comma-separated list of languages. Available since 4.4", + "required": false, + "internal": false, + "exampleValue": "java,js" + }, + { + "key": "moduleUuids", + "description": "To retrieve issues associated to a specific list of modules (comma-separated list of module IDs). This parameter is mostly used by the Issues page, please prefer usage of the componentKeys parameter. ", + "required": false, + "internal": true, + "exampleValue": "7d8749e8-3070-4903-9188-bdd82933bb92" + }, + { + "key": "onComponentOnly", + "description": "Return only issues at a component's level, not on its descendants (modules, directories, files, etc). This parameter is only considered when componentKeys or componentUuids is set. Using the deprecated componentRoots or componentRootUuids parameters will set this parameter to false. Using the deprecated components parameter will set this parameter to true.", + "required": false, + "internal": false, + "defaultValue": "false", + "possibleValues": [ + "true", + "false", + "yes", + "no" + ] + }, + { + "key": "organization", + "description": "Organization key", + "since": "6.4", + "required": false, + "internal": true, + "exampleValue": "my-org" + }, + { + "key": "p", + "description": "1-based page number", + "required": false, + "internal": false, + "defaultValue": "1", + "exampleValue": "42", + "deprecatedKey": "pageIndex", + "deprecatedKeySince": "5.2" + }, + { + "key": "projectUuids", + "description": "To retrieve issues associated to a specific list of projects (comma-separated list of project IDs). This parameter is mostly used by the Issues page, please prefer usage of the componentKeys parameter. Portfolios are not supported. If this parameter is set, 'projects' must not be set.", + "required": false, + "internal": true, + "exampleValue": "7d8749e8-3070-4903-9188-bdd82933bb92" + }, + { + "key": "projects", + "description": "To retrieve issues associated to a specific list of projects (comma-separated list of project keys). This parameter is mostly used by the Issues page, please prefer usage of the componentKeys parameter. If this parameter is set, projectUuids must not be set.", + "required": false, + "internal": true, + "exampleValue": "my_project", + "deprecatedKey": "projectKeys", + "deprecatedKeySince": "6.5" + }, + { + "key": "ps", + "description": "Page size. Must be greater than 0 and less than 500", + "required": false, + "internal": false, + "defaultValue": "100", + "exampleValue": "20", + "deprecatedKey": "pageSize", + "deprecatedKeySince": "5.2", + "maximumValue": 500 + }, + { + "key": "resolutions", + "description": "Comma-separated list of resolutions", + "required": false, + "internal": false, + "exampleValue": "FIXED,REMOVED", + "possibleValues": [ + "FALSE-POSITIVE", + "WONTFIX", + "FIXED", + "REMOVED" + ] + }, + { + "key": "resolved", + "description": "To match resolved or unresolved issues", + "required": false, + "internal": false, + "possibleValues": [ + "true", + "false", + "yes", + "no" + ] + }, + { + "key": "rules", + "description": "Comma-separated list of coding rule keys. Format is <repository>:<rule>", + "required": false, + "internal": false, + "exampleValue": "squid:AvoidCycles" + }, + { + "key": "s", + "description": "Sort field", + "required": false, + "internal": false, + "deprecatedKey": "sort", + "deprecatedKeySince": "5.4", + "possibleValues": [ + "CREATION_DATE", + "UPDATE_DATE", + "CLOSE_DATE", + "ASSIGNEE", + "SEVERITY", + "STATUS", + "FILE_LINE" + ] + }, + { + "key": "severities", + "description": "Comma-separated list of severities", + "required": false, + "internal": false, + "exampleValue": "BLOCKER,CRITICAL", + "possibleValues": [ + "INFO", + "MINOR", + "MAJOR", + "CRITICAL", + "BLOCKER" + ] + }, + { + "key": "sinceLeakPeriod", + "description": "To retrieve issues created since the leak period.<br>If this parameter is set to a truthy value, createdAfter must not be set and one component id or key must be provided.", + "required": false, + "internal": false, + "defaultValue": "false", + "possibleValues": [ + "true", + "false", + "yes", + "no" + ] + }, + { + "key": "statuses", + "description": "Comma-separated list of statuses", + "required": false, + "internal": false, + "exampleValue": "OPEN,REOPENED", + "possibleValues": [ + "OPEN", + "CONFIRMED", + "REOPENED", + "RESOLVED", + "CLOSED" + ] + }, + { + "key": "tags", + "description": "Comma-separated list of tags.", + "required": false, + "internal": false, + "exampleValue": "security,convention" + }, + { + "key": "types", + "description": "Comma-separated list of types.", + "since": "5.5", + "required": false, + "internal": false, + "exampleValue": "CODE_SMELL,BUG", + "possibleValues": [ + "CODE_SMELL", + "BUG", + "VULNERABILITY" + ] + } + ] + }, + { + "key": "set_severity", + "description": "Change severity.<br/>Requires the following permissions:<ul> <li>'Authentication'</li> <li>'Browse' rights on project of the specified issue</li> <li>'Administer Issues' rights on project of the specified issue</li></ul>", + "since": "3.6", + "internal": false, + "post": true, + "hasResponseExample": true, + "changelog": [ + { + "description": "the database ids of the components are removed from the response", + "version": "6.5" + }, + { + "description": "the response field components.uuid is deprecated. Use components.key instead.", + "version": "6.5" + } + ], + "params": [ + { + "key": "issue", + "description": "Issue key", + "required": true, + "internal": false, + "exampleValue": "AU-Tpxb--iU5OvuD2FLy" + }, + { + "key": "severity", + "description": "New severity", + "required": true, + "internal": false, + "possibleValues": [ + "INFO", + "MINOR", + "MAJOR", + "CRITICAL", + "BLOCKER" + ] + } + ] + }, + { + "key": "set_tags", + "description": "Set tags on an issue. <br/>Requires authentication and Browse permission on project", + "since": "5.1", + "internal": false, + "post": true, + "hasResponseExample": true, + "changelog": [ + { + "description": "the database ids of the components are removed from the response", + "version": "6.5" + }, + { + "description": "the response field components.uuid is deprecated. Use components.key instead.", + "version": "6.5" + }, + { + "description": "response contains issue information instead of list of tags", + "version": "6.4" + } + ], + "params": [ + { + "key": "issue", + "description": "Issue key", + "since": "6.3", + "required": true, + "internal": false, + "exampleValue": "AU-Tpxb--iU5OvuD2FLy", + "deprecatedKey": "key", + "deprecatedKeySince": "6.3" + }, + { + "key": "tags", + "description": "Comma-separated list of tags. All tags are removed if parameter is empty or not set.", + "required": false, + "internal": false, + "exampleValue": "security,cwe,misra-c" + } + ] + }, + { + "key": "set_type", + "description": "Change type of issue, for instance from 'code smell' to 'bug'.<br/>Requires the following permissions:<ul> <li>'Authentication'</li> <li>'Browse' rights on project of the specified issue</li> <li>'Administer Issues' rights on project of the specified issue</li></ul>", + "since": "5.5", + "internal": false, + "post": true, + "hasResponseExample": true, + "changelog": [ + { + "description": "the database ids of the components are removed from the response", + "version": "6.5" + }, + { + "description": "the response field components.uuid is deprecated. Use components.key instead.", + "version": "6.5" + } + ], + "params": [ + { + "key": "issue", + "description": "Issue key", + "required": true, + "internal": false, + "exampleValue": "AU-Tpxb--iU5OvuD2FLy" + }, + { + "key": "type", + "description": "New type", + "required": true, + "internal": false, + "possibleValues": [ + "CODE_SMELL", + "BUG", + "VULNERABILITY" + ] + } + ] + }, + { + "key": "tags", + "description": "List tags matching a given query", + "since": "5.1", + "internal": false, + "post": false, + "hasResponseExample": true, + "changelog": [], + "params": [ + { + "key": "organization", + "description": "Organization key", + "since": "6.4", + "required": false, + "internal": true, + "exampleValue": "my-org" + }, + { + "key": "ps", + "description": "Page size. Must be greater than 0 and less than 100", + "required": false, + "internal": false, + "defaultValue": "10", + "exampleValue": "20", + "deprecatedKey": "pageSize", + "deprecatedKeySince": "5.2", + "maximumValue": 100 + }, + { + "key": "q", + "description": "Limit search to tags that contain the supplied string.", + "required": false, + "internal": false, + "exampleValue": "misra" + } + ] + } + ] + }, + { + "path": "api/l10n", + "since": "4.4", + "description": "Manage localization.", + "actions": [ + { + "key": "index", + "description": "Get all localization messages for a given locale", + "since": "4.4", + "internal": true, + "post": false, + "hasResponseExample": true, + "changelog": [], + "params": [ + { + "key": "locale", + "description": "BCP47 language tag, used to override the browser Accept-Language header", + "required": false, + "internal": false, + "defaultValue": "en", + "exampleValue": "fr-CH" + }, + { + "key": "ts", + "description": "Date of the last cache update.", + "required": false, + "internal": false, + "exampleValue": "2014-06-04T09:31:42+0000" + } + ] + } + ] + }, + { + "path": "api/languages", + "since": "5.1", + "description": "Get the list of programming languages supported in this instance.", + "actions": [ + { + "key": "list", + "description": "List supported programming languages", + "since": "5.1", + "internal": false, + "post": false, + "hasResponseExample": true, + "changelog": [], + "params": [ + { + "key": "ps", + "description": "The size of the list to return, 0 for all languages", + "required": false, + "internal": false, + "defaultValue": "0", + "exampleValue": "25" + }, + { + "key": "q", + "description": "A pattern to match language keys/names against", + "required": false, + "internal": false, + "exampleValue": "java" + } + ] + } + ] + }, + { + "path": "api/measures", + "since": "5.4", + "description": "Get components or children with specified measures.", + "actions": [ + { + "key": "component", + "description": "Return component with specified measures. The componentId or the component parameter must be provided.<br>Requires the following permission: 'Browse' on the project of specified component.", + "since": "5.4", + "internal": false, + "post": false, + "hasResponseExample": true, + "changelog": [ + { + "description": "the response field id is deprecated. Use key instead.", + "version": "6.6" + }, + { + "description": "the response field refId is deprecated. Use refKey instead.", + "version": "6.6" + } + ], + "params": [ + { + "key": "additionalFields", + "description": "Comma-separated list of additional fields that can be returned in the response.", + "required": false, + "internal": false, + "exampleValue": "periods,metrics", + "possibleValues": [ + "metrics", + "periods" + ] + }, + { + "key": "branch", + "description": "Branch key", + "since": "6.6", + "required": false, + "internal": true, + "exampleValue": "feature/my_branch" + }, + { + "key": "component", + "description": "Component key", + "required": false, + "internal": false, + "exampleValue": "my_project", + "deprecatedKey": "componentKey", + "deprecatedKeySince": "6.6" + }, + { + "key": "componentId", + "description": "Component id", + "required": false, + "internal": false, + "exampleValue": "AU-Tpxb--iU5OvuD2FLy", + "deprecatedSince": "6.6" + }, + { + "key": "developerId", + "description": "Deprecated parameter, used previously with the Developer Cockpit plugin. No measures are returned if parameter is set.", + "required": false, + "internal": false, + "deprecatedSince": "6.4" + }, + { + "key": "developerKey", + "description": "Deprecated parameter, used previously with the Developer Cockpit plugin. No measures are returned if parameter is set.", + "required": false, + "internal": false, + "deprecatedSince": "6.4" + }, + { + "key": "metricKeys", + "description": "Metric keys", + "required": true, + "internal": false, + "exampleValue": "ncloc,complexity,violations" + } + ] + }, + { + "key": "component_tree", + "description": "Navigate through components based on the chosen strategy with specified measures. The baseComponentId or the component parameter must be provided.<br>Requires the following permission: 'Browse' on the specified project.<br>When limiting search with the q parameter, directories are not returned.", + "since": "5.4", + "internal": false, + "post": false, + "hasResponseExample": true, + "changelog": [ + { + "description": "the response field id is deprecated. Use key instead.", + "version": "6.6" + }, + { + "description": "the response field refId is deprecated. Use refKey instead.", + "version": "6.6" + }, + { + "description": "Number of metric keys is limited to 15", + "version": "6.3" + } + ], + "params": [ + { + "key": "additionalFields", + "description": "Comma-separated list of additional fields that can be returned in the response.", + "required": false, + "internal": false, + "exampleValue": "periods,metrics", + "possibleValues": [ + "metrics", + "periods" + ] + }, + { + "key": "asc", + "description": "Ascending sort", + "required": false, + "internal": false, + "defaultValue": "true", + "possibleValues": [ + "true", + "false", + "yes", + "no" + ] + }, + { + "key": "baseComponentId", + "description": "Base component id. The search is based on this component.", + "required": false, + "internal": false, + "exampleValue": "AU-TpxcA-iU5OvuD2FLz", + "deprecatedSince": "6.6" + }, + { + "key": "branch", + "description": "Branch key", + "since": "6.6", + "required": false, + "internal": true, + "exampleValue": "feature/my_branch" + }, + { + "key": "component", + "description": "Component key. The search is based on this component.", + "required": false, + "internal": false, + "exampleValue": "my_project", + "deprecatedKey": "baseComponentKey", + "deprecatedKeySince": "6.6" + }, + { + "key": "developerId", + "description": "Deprecated parameter, used previously with the Developer Cockpit plugin. No measures are returned if parameter is set.", + "required": false, + "internal": false, + "deprecatedSince": "6.4" + }, + { + "key": "developerKey", + "description": "Deprecated parameter, used previously with the Developer Cockpit plugin. No measures are returned if parameter is set.", + "required": false, + "internal": false, + "deprecatedSince": "6.4" + }, + { + "key": "metricKeys", + "description": "Metric keys. Types DISTRIB, DATA are not allowed", + "required": true, + "internal": false, + "exampleValue": "ncloc,complexity,violations", + "maxValuesAllowed": 15 + }, + { + "key": "metricPeriodSort", + "description": "Sort measures by leak period or not ?. The 's' parameter must contain the 'metricPeriod' value.", + "since": "5.5", + "required": false, + "internal": false, + "possibleValues": [ + "1" + ] + }, + { + "key": "metricSort", + "description": "Metric key to sort by. The 's' parameter must contain the 'metric' or 'metricPeriod' value. It must be part of the 'metricKeys' parameter", + "required": false, + "internal": false, + "exampleValue": "ncloc" + }, + { + "key": "metricSortFilter", + "description": "Filter components. Sort must be on a metric. Possible values are: <ul><li>all: return all components</li><li>withMeasuresOnly: filter out components that do not have a measure on the sorted metric</li></ul>", + "required": false, + "internal": false, + "defaultValue": "all", + "possibleValues": [ + "all", + "withMeasuresOnly" + ] + }, + { + "key": "p", + "description": "1-based page number", + "required": false, + "internal": false, + "defaultValue": "1", + "exampleValue": "42", + "deprecatedKey": "pageIndex", + "deprecatedKeySince": "5.2" + }, + { + "key": "ps", + "description": "Page size. Must be greater than 0 and less than 500", + "required": false, + "internal": false, + "defaultValue": "100", + "exampleValue": "20", + "deprecatedKey": "pageSize", + "deprecatedKeySince": "5.2", + "maximumValue": 500 + }, + { + "key": "q", + "description": "Limit search to: <ul><li>component names that contain the supplied string</li><li>component keys that are exactly the same as the supplied string</li></ul>Must have at least 3 characters.", + "required": false, + "internal": false, + "exampleValue": "FILE_NAM" + }, + { + "key": "qualifiers", + "description": "Comma-separated list of component qualifiers. Filter the results with the specified qualifiers. Possible values are:<ul><li>BRC - Sub-projects</li><li>DIR - Directories</li><li>FIL - Files</li><li>TRK - Projects</li><li>UTS - Test Files</li></ul>", + "required": false, + "internal": false, + "possibleValues": [ + "BRC", + "DIR", + "FIL", + "TRK", + "UTS" + ] + }, + { + "key": "s", + "description": "Comma-separated list of sort fields", + "required": false, + "internal": false, + "defaultValue": "name", + "exampleValue": "name,path", + "deprecatedKey": "sort", + "deprecatedKeySince": "5.4", + "possibleValues": [ + "metric", + "metricPeriod", + "name", + "path", + "qualifier" + ] + }, + { + "key": "strategy", + "description": "Strategy to search for base component descendants:<ul><li>children: return the children components of the base component. Grandchildren components are not returned</li><li>all: return all the descendants components of the base component. Grandchildren are returned.</li><li>leaves: return all the descendant components (files, in general) which don't have other children. They are the leaves of the component tree.</li></ul>", + "required": false, + "internal": false, + "defaultValue": "all", + "possibleValues": [ + "all", + "children", + "leaves" + ] + } + ] + }, + { + "key": "search", + "description": "Search for project measures ordered by project names.<br>At most 100 projects can be provided.<br>Returns the projects with the 'Browse' permission.", + "since": "6.2", + "internal": true, + "post": false, + "hasResponseExample": true, + "changelog": [], + "params": [ + { + "key": "metricKeys", + "description": "Metric keys", + "required": true, + "internal": false, + "exampleValue": "ncloc,complexity,violations" + }, + { + "key": "projectKeys", + "description": "Comma-separated list of project, view or sub-view keys", + "required": true, + "internal": false, + "exampleValue": "my_project,another_project" + } + ] + }, + { + "key": "search_history", + "description": "Search measures history of a component.<br>Measures are ordered chronologically.<br>Pagination applies to the number of measures for each metric.<br>Requires the following permission: 'Browse' on the specified component", + "since": "6.3", + "internal": false, + "post": false, + "hasResponseExample": true, + "changelog": [], + "params": [ + { + "key": "branch", + "description": "Branch key", + "since": "6.6", + "required": false, + "internal": true, + "exampleValue": "feature/my_branch" + }, + { + "key": "component", + "description": "Component key", + "required": true, + "internal": false, + "exampleValue": "my_project" + }, + { + "key": "from", + "description": "Filter measures created after the given date (inclusive). <br>Either a date (server timezone) or datetime can be provided", + "required": false, + "internal": false, + "exampleValue": "2017-10-19 or 2017-10-19T13:00:00+0200" + }, + { + "key": "metrics", + "description": "Comma-separated list of metric keys", + "required": true, + "internal": false, + "exampleValue": "ncloc,coverage,new_violations" + }, + { + "key": "p", + "description": "1-based page number", + "required": false, + "internal": false, + "defaultValue": "1", + "exampleValue": "42", + "deprecatedKey": "pageIndex", + "deprecatedKeySince": "5.2" + }, + { + "key": "ps", + "description": "Page size. Must be greater than 0 and less than 1000", + "required": false, + "internal": false, + "defaultValue": "100", + "exampleValue": "20", + "deprecatedKey": "pageSize", + "deprecatedKeySince": "5.2", + "maximumValue": 1000 + }, + { + "key": "to", + "description": "Filter measures created before the given date (inclusive). <br>Either a date (server timezone) or datetime can be provided", + "required": false, + "internal": false, + "exampleValue": "2017-10-19 or 2017-10-19T13:00:00+0200" + } + ] + } + ] + }, + { + "path": "api/metrics", + "since": "2.6", + "description": "Get information on automatic metrics, and manage custom metrics. See also api/custom_measures.", + "actions": [ + { + "key": "create", + "description": "Create custom metric.<br /> Requires 'Administer System' permission.", + "since": "5.2", + "internal": false, + "post": true, + "hasResponseExample": false, + "changelog": [], + "params": [ + { + "key": "description", + "description": "Description", + "required": false, + "internal": false, + "exampleValue": "Size of the team", + "maximumLength": 255 + }, + { + "key": "domain", + "description": "Domain", + "required": false, + "internal": false, + "exampleValue": "Tests", + "maximumLength": 64 + }, + { + "key": "key", + "description": "Key", + "required": true, + "internal": false, + "exampleValue": "team_size", + "maximumLength": 64 + }, + { + "key": "name", + "description": "Name", + "required": true, + "internal": false, + "exampleValue": "Team Size", + "maximumLength": 64 + }, + { + "key": "type", + "description": "Metric type key", + "required": true, + "internal": false, + "exampleValue": "INT", + "possibleValues": [ + "INT", + "FLOAT", + "PERCENT", + "BOOL", + "STRING", + "MILLISEC", + "DATA", + "LEVEL", + "DISTRIB", + "RATING", + "WORK_DUR" + ] + } + ] + }, + { + "key": "delete", + "description": "Delete metrics and associated measures. Delete only custom metrics.<br />Ids or keys must be provided. <br />Requires 'Administer System' permission.", + "since": "5.2", + "internal": false, + "post": true, + "hasResponseExample": false, + "changelog": [], + "params": [ + { + "key": "ids", + "description": "Metrics ids to delete.", + "required": false, + "internal": false, + "exampleValue": "5, 23, 42" + }, + { + "key": "keys", + "description": "Metrics keys to delete", + "required": false, + "internal": false, + "exampleValue": "team_size, business_value" + } + ] + }, + { + "key": "domains", + "description": "List all custom metric domains.", + "since": "5.2", + "internal": false, + "post": false, + "hasResponseExample": true, + "changelog": [] + }, + { + "key": "search", + "description": "Search for metrics", + "since": "5.2", + "internal": false, + "post": false, + "hasResponseExample": true, + "changelog": [], + "params": [ + { + "key": "f", + "description": "Comma-separated list of the fields to be returned in response. All the fields are returned by default.", + "required": false, + "internal": false, + "possibleValues": [ + "name", + "description", + "domain", + "direction", + "qualitative", + "hidden", + "custom", + "decimalScale" + ] + }, + { + "key": "isCustom", + "description": "Choose custom metrics following 3 cases:<ul><li>true: only custom metrics are returned</li><li>false: only non custom metrics are returned</li><li>not specified: all metrics are returned</li></ul>", + "required": false, + "internal": false, + "exampleValue": "true" + }, + { + "key": "p", + "description": "1-based page number", + "required": false, + "internal": false, + "defaultValue": "1", + "exampleValue": "42", + "deprecatedKey": "pageIndex", + "deprecatedKeySince": "5.2" + }, + { + "key": "ps", + "description": "Page size. Must be greater than 0 and less than 500", + "required": false, + "internal": false, + "defaultValue": "100", + "exampleValue": "20", + "deprecatedKey": "pageSize", + "deprecatedKeySince": "5.2", + "maximumValue": 500 + } + ] + }, + { + "key": "types", + "description": "List all available metric types.", + "since": "5.2", + "internal": false, + "post": false, + "hasResponseExample": true, + "changelog": [] + }, + { + "key": "update", + "description": "Update a custom metric.<br /> Requires 'Administer System' permission.", + "since": "5.2", + "internal": false, + "post": true, + "hasResponseExample": false, + "changelog": [], + "params": [ + { + "key": "description", + "description": "Description", + "required": false, + "internal": false, + "exampleValue": "Size of the team", + "maximumLength": 255 + }, + { + "key": "domain", + "description": "Domain", + "required": false, + "internal": false, + "exampleValue": "Tests", + "maximumLength": 64 + }, + { + "key": "id", + "description": "Id of the custom metric to update", + "required": true, + "internal": false, + "exampleValue": "42" + }, + { + "key": "key", + "description": "Key", + "required": false, + "internal": false, + "exampleValue": "team_size", + "maximumLength": 64 + }, + { + "key": "name", + "description": "Name", + "required": false, + "internal": false, + "maximumLength": 64 + }, + { + "key": "type", + "description": "Metric type key", + "required": false, + "internal": false, + "exampleValue": "INT", + "possibleValues": [ + "INT", + "FLOAT", + "PERCENT", + "BOOL", + "STRING", + "MILLISEC", + "DATA", + "LEVEL", + "DISTRIB", + "RATING", + "WORK_DUR" + ] + } + ] + } + ] + }, + { + "path": "api/navigation", + "since": "5.2", + "description": "Get information required to build navigation UI components", + "actions": [ + { + "key": "component", + "description": "Get information concerning component navigation for the current user. Requires the 'Browse' permission on the component's project.", + "since": "5.2", + "internal": true, + "post": false, + "hasResponseExample": true, + "changelog": [ + { + "description": "The 'visibility' field is added", + "version": "6.4" + } + ], + "params": [ + { + "key": "branch", + "description": "Branch key", + "required": false, + "internal": true, + "exampleValue": "feature/my_branch" + }, + { + "key": "component", + "description": "A component key.", + "required": false, + "internal": false, + "exampleValue": "my_project", + "deprecatedKey": "componentKey", + "deprecatedKeySince": "6.4" + } + ] + }, + { + "key": "global", + "description": "Get information concerning global navigation for the current user.", + "since": "5.2", + "internal": true, + "post": false, + "hasResponseExample": true, + "changelog": [] + }, + { + "key": "organization", + "description": "Get information concerning organization navigation for the current user", + "since": "6.3", + "internal": true, + "post": false, + "hasResponseExample": true, + "changelog": [ + { + "description": "The field 'projectVisibility' is added", + "version": "6.4" + } + ], + "params": [ + { + "key": "organization", + "description": "the organization key", + "required": true, + "internal": false, + "exampleValue": "my-org" + } + ] + }, + { + "key": "settings", + "description": "Get configuration information for the settings page:<ul> <li>List plugin-contributed pages</li> <li>Show update center (or not)</li></ul>", + "since": "5.2", + "internal": true, + "post": false, + "hasResponseExample": true, + "changelog": [] + } + ] + }, + { + "path": "api/notifications", + "since": "6.3", + "description": "Manage notifications of the authenticated user", + "actions": [ + { + "key": "add", + "description": "Add a notification for the authenticated user.<br>Requires one of the following permissions:<ul> <li>Authentication if no login is provided. If a project is provided, requires the 'Browse' permission on the specified project.</li> <li>System administration if a login is provided. If a project is provided, requires the 'Browse' permission on the specified project.</li></ul>", + "since": "6.3", + "internal": false, + "post": true, + "hasResponseExample": false, + "changelog": [], + "params": [ + { + "key": "channel", + "description": "Channel through which the notification is sent. For example, notifications can be sent by email.", + "required": false, + "internal": false, + "defaultValue": "EmailNotificationChannel", + "possibleValues": [ + "EmailNotificationChannel" + ] + }, + { + "key": "login", + "description": "User login", + "since": "6.4", + "required": false, + "internal": false + }, + { + "key": "project", + "description": "Project key", + "required": false, + "internal": false, + "exampleValue": "my_project" + }, + { + "key": "type", + "description": "Notification type. Possible values are for:<ul> <li>Global notifications: CeReportTaskFailure, ChangesOnMyIssue, NewAlerts, NewFalsePositiveIssue, NewIssues, SQ-MyNewIssues</li> <li>Per project notifications: CeReportTaskFailure, ChangesOnMyIssue, NewAlerts, NewFalsePositiveIssue, NewIssues, SQ-MyNewIssues</li></ul>", + "required": true, + "internal": false, + "exampleValue": "SQ-MyNewIssues" + } + ] + }, + { + "key": "list", + "description": "List notifications of the authenticated user.<br>Requires one of the following permissions:<ul> <li>Authentication if no login is provided</li> <li>System administration if a login is provided</li></ul>", + "since": "6.3", + "internal": false, + "post": false, + "hasResponseExample": true, + "changelog": [], + "params": [ + { + "key": "login", + "description": "User login", + "since": "6.4", + "required": false, + "internal": false + } + ] + }, + { + "key": "remove", + "description": "Remove a notification for the authenticated user.<br>Requires one of the following permissions:<ul> <li>Authentication if no login is provided</li> <li>System administration if a login is provided</li></ul>", + "since": "6.3", + "internal": false, + "post": true, + "hasResponseExample": false, + "changelog": [], + "params": [ + { + "key": "channel", + "description": "Channel through which the notification is sent. For example, notifications can be sent by email.", + "required": false, + "internal": false, + "defaultValue": "EmailNotificationChannel", + "possibleValues": [ + "EmailNotificationChannel" + ] + }, + { + "key": "login", + "description": "User login", + "since": "6.4", + "required": false, + "internal": false + }, + { + "key": "project", + "description": "Project key", + "required": false, + "internal": false, + "exampleValue": "my_project" + }, + { + "key": "type", + "description": "Notification type. Possible values are for:<ul> <li>Global notifications: CeReportTaskFailure, ChangesOnMyIssue, NewAlerts, NewFalsePositiveIssue, NewIssues, SQ-MyNewIssues</li> <li>Per project notifications: CeReportTaskFailure, ChangesOnMyIssue, NewAlerts, NewFalsePositiveIssue, NewIssues, SQ-MyNewIssues</li></ul>", + "required": true, + "internal": false, + "exampleValue": "SQ-MyNewIssues" + } + ] + } + ] + }, + { + "path": "api/orchestrator", + "description": "Orchestrator web service", + "actions": [ + { + "key": "reset", + "description": "Reset data", + "since": "Orchestrator 3.4", + "internal": true, + "post": true, + "hasResponseExample": false, + "changelog": [] + } + ] + }, + { + "path": "api/organizations", + "since": "6.2", + "description": "Manage organizations.", + "actions": [ + { + "key": "add_member", + "description": "Add a user as a member of an organization.<br>Requires 'Administer System' permission on the specified organization.", + "since": "6.4", + "internal": true, + "post": true, + "hasResponseExample": true, + "changelog": [], + "params": [ + { + "key": "login", + "description": "User login", + "required": true, + "internal": false, + "exampleValue": "ray.bradbury" + }, + { + "key": "organization", + "description": "Organization key", + "required": true, + "internal": false, + "exampleValue": "my-org" + } + ] + }, + { + "key": "create", + "description": "Create an organization.<br />Requires 'Administer System' permission unless any logged in user is allowed to create an organization (see appropriate setting). Organization support must be enabled.", + "since": "6.2", + "internal": true, + "post": true, + "hasResponseExample": true, + "changelog": [], + "params": [ + { + "key": "avatar", + "description": "URL of the organization avatar.<br/> It must be less than 256 chars long.", + "required": false, + "internal": false, + "exampleValue": "https://www.foo.com/foo.png", + "maximumLength": 256 + }, + { + "key": "description", + "description": "Description of the organization.<br/> It must be less than 256 chars long.", + "required": false, + "internal": false, + "exampleValue": "The Foo company produces quality software for Bar.", + "maximumLength": 256 + }, + { + "key": "key", + "description": "Key of the organization. <br />The key is unique to the whole SonarQube. <br/>When not specified, the key is computed from the name. <br />Otherwise, it must be between 2 and 32 chars long. All chars must be lower-case letters (a to z), digits or dash (but dash can neither be trailing nor heading)", + "required": false, + "internal": false, + "exampleValue": "foo-company", + "maximumLength": 32 + }, + { + "key": "name", + "description": "Name of the organization. <br />It must be between 2 and 64 chars longs.", + "required": true, + "internal": false, + "exampleValue": "Foo Company", + "maximumLength": 64 + }, + { + "key": "url", + "description": "URL of the organization.<br/> It must be less than 256 chars long.", + "required": false, + "internal": false, + "exampleValue": "https://www.foo.com", + "maximumLength": 256 + } + ] + }, + { + "key": "delete", + "description": "Delete an organization.<br/>Require 'Administer System' permission on the specified organization. Organization support must be enabled.", + "since": "6.2", + "internal": true, + "post": true, + "hasResponseExample": false, + "changelog": [], + "params": [ + { + "key": "organization", + "description": "Organization key", + "required": true, + "internal": false, + "exampleValue": "foo-company", + "deprecatedKey": "key", + "deprecatedKeySince": "6.4" + } + ] + }, + { + "key": "enable_support", + "description": "Enable support of organizations.<br />'Administer System' permission is required. The logged-in user will be flagged as root and will be able to manage organizations and other root users.", + "since": "6.3", + "internal": true, + "post": true, + "hasResponseExample": false, + "changelog": [ + { + "description": "Create default 'Members' group", + "version": "6.4" + } + ] + }, + { + "key": "remove_member", + "description": "Remove a member from an organization.<br>Requires 'Administer System' permission on the specified organization.", + "since": "6.4", + "internal": true, + "post": true, + "hasResponseExample": false, + "changelog": [], + "params": [ + { + "key": "login", + "description": "User login", + "required": true, + "internal": false, + "exampleValue": "ray.bradbury" + }, + { + "key": "organization", + "description": "Organization key", + "required": true, + "internal": false, + "exampleValue": "my-org" + } + ] + }, + { + "key": "search", + "description": "Search for organizations", + "since": "6.2", + "internal": true, + "post": false, + "hasResponseExample": true, + "changelog": [ + { + "description": "Paging fields have been added to the response", + "version": "6.4" + } + ], + "params": [ + { + "key": "organizations", + "description": "Comma-separated list of organization keys", + "since": "6.3", + "required": false, + "internal": false, + "exampleValue": "my-org-1,foocorp" + }, + { + "key": "p", + "description": "1-based page number", + "required": false, + "internal": false, + "defaultValue": "1", + "exampleValue": "42", + "deprecatedKey": "pageIndex", + "deprecatedKeySince": "5.2" + }, + { + "key": "ps", + "description": "Page size. Must be greater than 0.", + "required": false, + "internal": false, + "defaultValue": "25", + "exampleValue": "20", + "deprecatedKey": "pageSize", + "deprecatedKeySince": "5.2" + } + ] + }, + { + "key": "search_members", + "description": "Search members of an organization", + "since": "6.4", + "internal": true, + "post": false, + "hasResponseExample": true, + "changelog": [], + "params": [ + { + "key": "organization", + "description": "Organization key", + "required": false, + "internal": true + }, + { + "key": "p", + "description": "1-based page number", + "required": false, + "internal": false, + "defaultValue": "1", + "exampleValue": "42", + "deprecatedKey": "pageIndex", + "deprecatedKeySince": "5.2" + }, + { + "key": "ps", + "description": "Page size. Must be greater than 0 and less than 500", + "required": false, + "internal": false, + "defaultValue": "50", + "exampleValue": "20", + "deprecatedKey": "pageSize", + "deprecatedKeySince": "5.2", + "maximumValue": 500 + }, + { + "key": "q", + "description": "Limit search to names or logins that contain the supplied string.", + "required": false, + "internal": false, + "exampleValue": "orwe" + }, + { + "key": "selected", + "description": "Depending on the value, show only selected items (selected=selected) or deselected items (selected=deselected).", + "required": false, + "internal": true, + "defaultValue": "selected", + "possibleValues": [ + "selected", + "deselected" + ] + } + ] + }, + { + "key": "search_my_organizations", + "description": "List keys of the organizations for which the currently authenticated user has the System Administer permission for.", + "since": "6.3", + "internal": true, + "post": false, + "hasResponseExample": true, + "changelog": [] + }, + { + "key": "update", + "description": "Update an organization.<br/>Require 'Administer System' permission. Organization support must be enabled.", + "since": "6.2", + "internal": true, + "post": true, + "hasResponseExample": false, + "changelog": [], + "params": [ + { + "key": "avatar", + "description": "URL of the organization avatar.<br/> It must be less than 256 chars long.", + "required": false, + "internal": false, + "exampleValue": "https://www.foo.com/foo.png", + "maximumLength": 256 + }, + { + "key": "description", + "description": "Description of the organization.<br/> It must be less than 256 chars long.", + "required": false, + "internal": false, + "exampleValue": "The Foo company produces quality software for Bar.", + "maximumLength": 256 + }, + { + "key": "key", + "description": "Organization key", + "required": true, + "internal": false, + "exampleValue": "foo-company" + }, + { + "key": "name", + "description": "Name of the organization. <br />It must be between 2 and 64 chars longs.", + "required": false, + "internal": false, + "exampleValue": "Foo Company", + "maximumLength": 64 + }, + { + "key": "url", + "description": "URL of the organization.<br/> It must be less than 256 chars long.", + "required": false, + "internal": false, + "exampleValue": "https://www.foo.com", + "maximumLength": 256 + } + ] + }, + { + "key": "update_project_visibility", + "description": "Update the default visibility for new projects of the specified organization.", + "since": "6.4", + "internal": true, + "post": true, + "hasResponseExample": false, + "changelog": [], + "params": [ + { + "key": "organization", + "description": "Organization key", + "required": true, + "internal": false, + "exampleValue": "foo-company" + }, + { + "key": "projectVisibility", + "description": "Default visibility for projects", + "required": true, + "internal": false, + "possibleValues": [ + "private", + "public" + ] + } + ] + } + ] + }, + { + "path": "api/permissions", + "since": "3.7", + "description": "Manage permission templates, and the granting and revoking of permissions at the global and project levels.", + "actions": [ + { + "key": "add_group", + "description": "Add permission to a group.<br /> This service defaults to global permissions, but can be limited to project permissions by providing project id or project key.<br /> The group name or group id must be provided. <br />Requires one of the following permissions:<ul><li>'Administer System'</li><li>'Administer' rights on the specified project</li></ul>", + "since": "5.2", + "internal": false, + "post": true, + "hasResponseExample": false, + "changelog": [], + "params": [ + { + "key": "groupId", + "description": "Group id", + "required": false, + "internal": false, + "exampleValue": "42" + }, + { + "key": "groupName", + "description": "Group name or 'anyone' (case insensitive)", + "required": false, + "internal": false, + "exampleValue": "sonar-administrators" + }, + { + "key": "organization", + "description": "Key of organization, used when group name is set", + "since": "6.2", + "required": false, + "internal": true, + "exampleValue": "my-org" + }, + { + "key": "permission", + "description": "Permission<ul><li>Possible values for global permissions: admin, profileadmin, gateadmin, scan, provisioning</li><li>Possible values for project permissions admin, codeviewer, issueadmin, scan, user</li></ul>", + "required": true, + "internal": false + }, + { + "key": "projectId", + "description": "Project id", + "required": false, + "internal": false, + "exampleValue": "ce4c03d6-430f-40a9-b777-ad877c00aa4d" + }, + { + "key": "projectKey", + "description": "Project key", + "required": false, + "internal": false, + "exampleValue": "my_project" + } + ] + }, + { + "key": "add_group_to_template", + "description": "Add a group to a permission template.<br /> The group id or group name must be provided. <br />Requires the following permission: 'Administer System'.", + "since": "5.2", + "internal": false, + "post": true, + "hasResponseExample": false, + "changelog": [], + "params": [ + { + "key": "groupId", + "description": "Group id", + "required": false, + "internal": false, + "exampleValue": "42" + }, + { + "key": "groupName", + "description": "Group name or 'anyone' (case insensitive)", + "required": false, + "internal": false, + "exampleValue": "sonar-administrators" + }, + { + "key": "organization", + "description": "Key of organization, used when group name is set", + "required": false, + "internal": true, + "exampleValue": "my-org" + }, + { + "key": "permission", + "description": "Permission<ul><li>Possible values for project permissions admin, codeviewer, issueadmin, scan, user</li></ul>", + "required": true, + "internal": false, + "possibleValues": [ + "admin", + "codeviewer", + "issueadmin", + "scan", + "user" + ] + }, + { + "key": "templateId", + "description": "Template id", + "required": false, + "internal": false, + "exampleValue": "AU-Tpxb--iU5OvuD2FLy" + }, + { + "key": "templateName", + "description": "Template name", + "required": false, + "internal": false, + "exampleValue": "Default Permission Template for Projects" + } + ] + }, + { + "key": "add_project_creator_to_template", + "description": "Add a project creator to a permission template.<br>Requires the following permission: 'Administer System'.", + "since": "6.0", + "internal": false, + "post": true, + "hasResponseExample": false, + "changelog": [], + "params": [ + { + "key": "organization", + "description": "Key of organization, used when group name is set", + "required": false, + "internal": true, + "exampleValue": "my-org" + }, + { + "key": "permission", + "description": "Permission<ul><li>Possible values for project permissions admin, codeviewer, issueadmin, scan, user</li></ul>", + "required": true, + "internal": false, + "possibleValues": [ + "admin", + "codeviewer", + "issueadmin", + "scan", + "user" + ] + }, + { + "key": "templateId", + "description": "Template id", + "required": false, + "internal": false, + "exampleValue": "AU-Tpxb--iU5OvuD2FLy" + }, + { + "key": "templateName", + "description": "Template name", + "required": false, + "internal": false, + "exampleValue": "Default Permission Template for Projects" + } + ] + }, + { + "key": "add_user", + "description": "Add permission to a user.<br /> This service defaults to global permissions, but can be limited to project permissions by providing project id or project key.<br />Requires one of the following permissions:<ul><li>'Administer System'</li><li>'Administer' rights on the specified project</li></ul>", + "since": "5.2", + "internal": false, + "post": true, + "hasResponseExample": false, + "changelog": [], + "params": [ + { + "key": "login", + "description": "User login", + "required": true, + "internal": false, + "exampleValue": "g.hopper" + }, + { + "key": "organization", + "description": "Key of organization, cannot be used at the same time with projectId and projectKey", + "since": "6.2", + "required": false, + "internal": true, + "exampleValue": "my-org" + }, + { + "key": "permission", + "description": "Permission<ul><li>Possible values for global permissions: admin, profileadmin, gateadmin, scan, provisioning</li><li>Possible values for project permissions admin, codeviewer, issueadmin, scan, user</li></ul>", + "required": true, + "internal": false + }, + { + "key": "projectId", + "description": "Project id", + "required": false, + "internal": false, + "exampleValue": "ce4c03d6-430f-40a9-b777-ad877c00aa4d" + }, + { + "key": "projectKey", + "description": "Project key", + "required": false, + "internal": false, + "exampleValue": "my_project" + } + ] + }, + { + "key": "add_user_to_template", + "description": "Add a user to a permission template.<br /> Requires the following permission: 'Administer System'.", + "since": "5.2", + "internal": false, + "post": true, + "hasResponseExample": false, + "changelog": [], + "params": [ + { + "key": "login", + "description": "User login", + "required": true, + "internal": false, + "exampleValue": "g.hopper" + }, + { + "key": "organization", + "description": "Key of organization, used when group name is set", + "required": false, + "internal": true, + "exampleValue": "my-org" + }, + { + "key": "permission", + "description": "Permission<ul><li>Possible values for project permissions admin, codeviewer, issueadmin, scan, user</li></ul>", + "required": true, + "internal": false, + "possibleValues": [ + "admin", + "codeviewer", + "issueadmin", + "scan", + "user" + ] + }, + { + "key": "templateId", + "description": "Template id", + "required": false, + "internal": false, + "exampleValue": "AU-Tpxb--iU5OvuD2FLy" + }, + { + "key": "templateName", + "description": "Template name", + "required": false, + "internal": false, + "exampleValue": "Default Permission Template for Projects" + } + ] + }, + { + "key": "apply_template", + "description": "Apply a permission template to one project.<br>The project id or project key must be provided.<br>The template id or name must be provided.<br>Requires the following permission: 'Administer System'.", + "since": "5.2", + "internal": false, + "post": true, + "hasResponseExample": false, + "changelog": [], + "params": [ + { + "key": "organization", + "description": "Key of organization, used when group name is set", + "required": false, + "internal": true, + "exampleValue": "my-org" + }, + { + "key": "projectId", + "description": "Project id", + "required": false, + "internal": false, + "exampleValue": "ce4c03d6-430f-40a9-b777-ad877c00aa4d" + }, + { + "key": "projectKey", + "description": "Project key", + "required": false, + "internal": false, + "exampleValue": "my_project" + }, + { + "key": "templateId", + "description": "Template id", + "required": false, + "internal": false, + "exampleValue": "AU-Tpxb--iU5OvuD2FLy" + }, + { + "key": "templateName", + "description": "Template name", + "required": false, + "internal": false, + "exampleValue": "Default Permission Template for Projects" + } + ] + }, + { + "key": "bulk_apply_template", + "description": "Apply a permission template to several projects.<br />The template id or name must be provided.<br />Requires the following permission: 'Administer System'.", + "since": "5.5", + "internal": false, + "post": true, + "hasResponseExample": false, + "changelog": [], + "params": [ + { + "key": "analyzedBefore", + "description": "Filter the projects for which last analysis is older than the given date (exclusive).<br> Either a date (server timezone) or datetime can be provided.", + "since": "6.6", + "required": false, + "internal": false, + "exampleValue": "2017-10-19 or 2017-10-19T13:00:00+0200" + }, + { + "key": "onProvisionedOnly", + "description": "Filter the projects that are provisioned", + "since": "6.6", + "required": false, + "internal": false, + "defaultValue": "false", + "possibleValues": [ + "true", + "false", + "yes", + "no" + ] + }, + { + "key": "organization", + "description": "Key of organization, used when group name is set", + "required": false, + "internal": true, + "exampleValue": "my-org" + }, + { + "key": "projects", + "description": "Comma-separated list of project keys", + "since": "6.6", + "required": false, + "internal": false, + "exampleValue": "my_project,another_project" + }, + { + "key": "q", + "description": "Limit search to: <ul><li>project names that contain the supplied string</li><li>project keys that are exactly the same as the supplied string</li></ul>", + "required": false, + "internal": false, + "exampleValue": "apac" + }, + { + "key": "qualifiers", + "description": "Comma-separated list of component qualifiers. Filter the results with the specified qualifiers. Possible values are:<ul><li>TRK - Projects</li></ul>", + "required": false, + "internal": false, + "defaultValue": "TRK", + "deprecatedKey": "qualifier", + "deprecatedKeySince": "6.6", + "possibleValues": [ + "TRK" + ] + }, + { + "key": "templateId", + "description": "Template id", + "required": false, + "internal": false, + "exampleValue": "AU-Tpxb--iU5OvuD2FLy" + }, + { + "key": "templateName", + "description": "Template name", + "required": false, + "internal": false, + "exampleValue": "Default Permission Template for Projects" + }, + { + "key": "visibility", + "description": "Filter the projects that should be visible to everyone (public), or only specific user/groups (private).<br/>If no visibility is specified, the default project visibility of the organization will be used.", + "since": "6.6", + "required": false, + "internal": true, + "possibleValues": [ + "private", + "public" + ] + } + ] + }, + { + "key": "create_template", + "description": "Create a permission template.<br />Requires the following permission: 'Administer System'.", + "since": "5.2", + "internal": false, + "post": true, + "hasResponseExample": true, + "changelog": [], + "params": [ + { + "key": "description", + "description": "Description", + "required": false, + "internal": false, + "exampleValue": "Permissions for all projects related to the financial service" + }, + { + "key": "name", + "description": "Name", + "required": true, + "internal": false, + "exampleValue": "Financial Service Permissions" + }, + { + "key": "organization", + "description": "Key of organization, used when group name is set", + "since": "6.2", + "required": false, + "internal": true, + "exampleValue": "my-org" + }, + { + "key": "projectKeyPattern", + "description": "Project key pattern. Must be a valid Java regular expression", + "required": false, + "internal": false, + "exampleValue": ".*\\.finance\\..*" + } + ] + }, + { + "key": "delete_template", + "description": "Delete a permission template.<br />Requires the following permission: 'Administer System'.", + "since": "5.2", + "internal": false, + "post": true, + "hasResponseExample": false, + "changelog": [], + "params": [ + { + "key": "organization", + "description": "Key of organization, used when group name is set", + "required": false, + "internal": true, + "exampleValue": "my-org" + }, + { + "key": "templateId", + "description": "Template id", + "required": false, + "internal": false, + "exampleValue": "AU-Tpxb--iU5OvuD2FLy" + }, + { + "key": "templateName", + "description": "Template name", + "required": false, + "internal": false, + "exampleValue": "Default Permission Template for Projects" + } + ] + }, + { + "key": "groups", + "description": "Limit search to group names that contain the supplied string. Must have at least 3 characters.<br/>When this parameter is not set, only groups having at least one permission are returned.", + "since": "5.2", + "internal": true, + "post": false, + "hasResponseExample": true, + "changelog": [], + "params": [ + { + "key": "organization", + "description": "Key of organization, used when group name is set", + "since": "6.2", + "required": false, + "internal": true, + "exampleValue": "my-org" + }, + { + "key": "p", + "description": "1-based page number", + "required": false, + "internal": false, + "defaultValue": "1", + "exampleValue": "42", + "deprecatedKey": "pageIndex", + "deprecatedKeySince": "5.2" + }, + { + "key": "permission", + "description": "Permission<ul><li>Possible values for global permissions: admin, profileadmin, gateadmin, scan, provisioning</li><li>Possible values for project permissions admin, codeviewer, issueadmin, scan, user</li></ul>", + "required": false, + "internal": false + }, + { + "key": "projectId", + "description": "Project id", + "required": false, + "internal": false, + "exampleValue": "ce4c03d6-430f-40a9-b777-ad877c00aa4d" + }, + { + "key": "projectKey", + "description": "Project key", + "required": false, + "internal": false, + "exampleValue": "my_project" + }, + { + "key": "ps", + "description": "Page size. Must be greater than 0 and less than 100", + "required": false, + "internal": false, + "defaultValue": "20", + "exampleValue": "20", + "deprecatedKey": "pageSize", + "deprecatedKeySince": "5.2", + "maximumValue": 100 + }, + { + "key": "q", + "description": "Limit search to names that contain the supplied string.", + "required": false, + "internal": false, + "exampleValue": "sonar" + } + ] + }, + { + "key": "remove_group", + "description": "Remove a permission from a group.<br /> This service defaults to global permissions, but can be limited to project permissions by providing project id or project key.<br /> The group id or group name must be provided, not both.<br />Requires one of the following permissions:<ul><li>'Administer System'</li><li>'Administer' rights on the specified project</li></ul>", + "since": "5.2", + "internal": false, + "post": true, + "hasResponseExample": false, + "changelog": [], + "params": [ + { + "key": "groupId", + "description": "Group id", + "required": false, + "internal": false, + "exampleValue": "42" + }, + { + "key": "groupName", + "description": "Group name or 'anyone' (case insensitive)", + "required": false, + "internal": false, + "exampleValue": "sonar-administrators" + }, + { + "key": "organization", + "description": "Key of organization, used when group name is set", + "since": "6.2", + "required": false, + "internal": true, + "exampleValue": "my-org" + }, + { + "key": "permission", + "description": "Permission<ul><li>Possible values for global permissions: admin, profileadmin, gateadmin, scan, provisioning</li><li>Possible values for project permissions admin, codeviewer, issueadmin, scan, user</li></ul>", + "required": true, + "internal": false + }, + { + "key": "projectId", + "description": "Project id", + "required": false, + "internal": false, + "exampleValue": "ce4c03d6-430f-40a9-b777-ad877c00aa4d" + }, + { + "key": "projectKey", + "description": "Project key", + "required": false, + "internal": false, + "exampleValue": "my_project" + } + ] + }, + { + "key": "remove_group_from_template", + "description": "Remove a group from a permission template.<br /> The group id or group name must be provided. <br />Requires the following permission: 'Administer System'.", + "since": "5.2", + "internal": false, + "post": true, + "hasResponseExample": false, + "changelog": [], + "params": [ + { + "key": "groupId", + "description": "Group id", + "required": false, + "internal": false, + "exampleValue": "42" + }, + { + "key": "groupName", + "description": "Group name or 'anyone' (case insensitive)", + "required": false, + "internal": false, + "exampleValue": "sonar-administrators" + }, + { + "key": "organization", + "description": "Key of organization, used when group name is set", + "required": false, + "internal": true, + "exampleValue": "my-org" + }, + { + "key": "permission", + "description": "Permission<ul><li>Possible values for project permissions admin, codeviewer, issueadmin, scan, user</li></ul>", + "required": true, + "internal": false, + "possibleValues": [ + "admin", + "codeviewer", + "issueadmin", + "scan", + "user" + ] + }, + { + "key": "templateId", + "description": "Template id", + "required": false, + "internal": false, + "exampleValue": "AU-Tpxb--iU5OvuD2FLy" + }, + { + "key": "templateName", + "description": "Template name", + "required": false, + "internal": false, + "exampleValue": "Default Permission Template for Projects" + } + ] + }, + { + "key": "remove_project_creator_from_template", + "description": "Remove a project creator from a permission template.<br>Requires the following permission: 'Administer System'.", + "since": "6.0", + "internal": false, + "post": true, + "hasResponseExample": false, + "changelog": [], + "params": [ + { + "key": "organization", + "description": "Key of organization, used when group name is set", + "required": false, + "internal": true, + "exampleValue": "my-org" + }, + { + "key": "permission", + "description": "Permission<ul><li>Possible values for project permissions admin, codeviewer, issueadmin, scan, user</li></ul>", + "required": true, + "internal": false, + "possibleValues": [ + "admin", + "codeviewer", + "issueadmin", + "scan", + "user" + ] + }, + { + "key": "templateId", + "description": "Template id", + "required": false, + "internal": false, + "exampleValue": "AU-Tpxb--iU5OvuD2FLy" + }, + { + "key": "templateName", + "description": "Template name", + "required": false, + "internal": false, + "exampleValue": "Default Permission Template for Projects" + } + ] + }, + { + "key": "remove_user", + "description": "Remove permission from a user.<br /> This service defaults to global permissions, but can be limited to project permissions by providing project id or project key.<br /> Requires one of the following permissions:<ul><li>'Administer System'</li><li>'Administer' rights on the specified project</li></ul>", + "since": "5.2", + "internal": false, + "post": true, + "hasResponseExample": false, + "changelog": [], + "params": [ + { + "key": "login", + "description": "User login", + "required": true, + "internal": false, + "exampleValue": "g.hopper" + }, + { + "key": "organization", + "description": "Key of organization, used when group name is set", + "since": "6.2", + "required": false, + "internal": true, + "exampleValue": "my-org" + }, + { + "key": "permission", + "description": "Permission<ul><li>Possible values for global permissions: admin, profileadmin, gateadmin, scan, provisioning</li><li>Possible values for project permissions admin, codeviewer, issueadmin, scan, user</li></ul>", + "required": true, + "internal": false + }, + { + "key": "projectId", + "description": "Project id", + "required": false, + "internal": false, + "exampleValue": "ce4c03d6-430f-40a9-b777-ad877c00aa4d" + }, + { + "key": "projectKey", + "description": "Project key", + "required": false, + "internal": false, + "exampleValue": "my_project" + } + ] + }, + { + "key": "remove_user_from_template", + "description": "Remove a user from a permission template.<br /> Requires the following permission: 'Administer System'.", + "since": "5.2", + "internal": false, + "post": true, + "hasResponseExample": false, + "changelog": [], + "params": [ + { + "key": "login", + "description": "User login", + "required": true, + "internal": false, + "exampleValue": "g.hopper" + }, + { + "key": "organization", + "description": "Key of organization, used when group name is set", + "required": false, + "internal": true, + "exampleValue": "my-org" + }, + { + "key": "permission", + "description": "Permission<ul><li>Possible values for project permissions admin, codeviewer, issueadmin, scan, user</li></ul>", + "required": true, + "internal": false, + "possibleValues": [ + "admin", + "codeviewer", + "issueadmin", + "scan", + "user" + ] + }, + { + "key": "templateId", + "description": "Template id", + "required": false, + "internal": false, + "exampleValue": "AU-Tpxb--iU5OvuD2FLy" + }, + { + "key": "templateName", + "description": "Template name", + "required": false, + "internal": false, + "exampleValue": "Default Permission Template for Projects" + } + ] + }, + { + "key": "search_global_permissions", + "description": "List global permissions. <br />Requires the following permission: 'Administer System'", + "since": "5.2", + "deprecatedSince": "6.5", + "internal": false, + "post": false, + "hasResponseExample": true, + "changelog": [], + "params": [ + { + "key": "organization", + "description": "Key of organization, used when group name is set", + "since": "6.2", + "required": false, + "internal": true, + "exampleValue": "my-org" + } + ] + }, + { + "key": "search_project_permissions", + "description": "List project permissions. A project can be a technical project, a view or a developer.<br />Requires one of the following permissions:<ul><li>'Administer System'</li><li>'Administer' rights on the specified project</li></ul>", + "since": "5.2", + "deprecatedSince": "6.5", + "internal": false, + "post": false, + "hasResponseExample": true, + "changelog": [], + "params": [ + { + "key": "p", + "description": "1-based page number", + "required": false, + "internal": false, + "defaultValue": "1", + "exampleValue": "42", + "deprecatedKey": "pageIndex", + "deprecatedKeySince": "5.2" + }, + { + "key": "projectId", + "description": "Project id", + "required": false, + "internal": false, + "exampleValue": "ce4c03d6-430f-40a9-b777-ad877c00aa4d" + }, + { + "key": "projectKey", + "description": "Project key", + "required": false, + "internal": false, + "exampleValue": "my_project" + }, + { + "key": "ps", + "description": "Page size. Must be greater than 0.", + "required": false, + "internal": false, + "defaultValue": "25", + "exampleValue": "20", + "deprecatedKey": "pageSize", + "deprecatedKeySince": "5.2" + }, + { + "key": "q", + "description": "Limit search to: <ul><li>project names that contain the supplied string</li><li>project keys that are exactly the same as the supplied string</li></ul>", + "required": false, + "internal": false, + "exampleValue": "apac" + }, + { + "key": "qualifier", + "description": "Project qualifier. Filter the results with the specified qualifier. Possible values are:<ul><li>TRK - Projects</li></ul>", + "since": "5.3", + "required": false, + "internal": false, + "possibleValues": [ + "TRK" + ] + } + ] + }, + { + "key": "search_templates", + "description": "List permission templates.<br />Requires the following permission: 'Administer System'.", + "since": "5.2", + "internal": false, + "post": false, + "hasResponseExample": true, + "changelog": [], + "params": [ + { + "key": "organization", + "description": "Key of organization, used when group name is set", + "since": "6.2", + "required": false, + "internal": true, + "exampleValue": "my-org" + }, + { + "key": "q", + "description": "Limit search to permission template names that contain the supplied string.", + "required": false, + "internal": false, + "exampleValue": "defau" + } + ] + }, + { + "key": "set_default_template", + "description": "Set a permission template as default.<br />Requires the following permission: 'Administer System'.", + "since": "5.2", + "internal": false, + "post": true, + "hasResponseExample": false, + "changelog": [], + "params": [ + { + "key": "organization", + "description": "Key of organization, used when group name is set", + "required": false, + "internal": true, + "exampleValue": "my-org" + }, + { + "key": "qualifier", + "description": "Project qualifier. Filter the results with the specified qualifier. Possible values are:<ul><li>TRK - Projects</li></ul>", + "required": false, + "internal": false, + "defaultValue": "TRK", + "possibleValues": [ + "TRK" + ] + }, + { + "key": "templateId", + "description": "Template id", + "required": false, + "internal": false, + "exampleValue": "AU-Tpxb--iU5OvuD2FLy" + }, + { + "key": "templateName", + "description": "Template name", + "required": false, + "internal": false, + "exampleValue": "Default Permission Template for Projects" + } + ] + }, + { + "key": "template_groups", + "description": "Lists the groups with their permission as individual groups rather than through user affiliation on the chosen template.<br />This service defaults to all groups, but can be limited to groups with a specific permission by providing the desired permission.<br>Requires the following permission: 'Administer System'.", + "since": "5.2", + "internal": true, + "post": false, + "hasResponseExample": true, + "changelog": [], + "params": [ + { + "key": "organization", + "description": "Key of organization, used when group name is set", + "required": false, + "internal": true, + "exampleValue": "my-org" + }, + { + "key": "p", + "description": "1-based page number", + "required": false, + "internal": false, + "defaultValue": "1", + "exampleValue": "42", + "deprecatedKey": "pageIndex", + "deprecatedKeySince": "5.2" + }, + { + "key": "permission", + "description": "Permission<ul><li>Possible values for project permissions admin, codeviewer, issueadmin, scan, user</li></ul>", + "required": true, + "internal": false, + "possibleValues": [ + "admin", + "codeviewer", + "issueadmin", + "scan", + "user" + ] + }, + { + "key": "ps", + "description": "Page size. Must be greater than 0 and less than 100", + "required": false, + "internal": false, + "defaultValue": "20", + "exampleValue": "20", + "deprecatedKey": "pageSize", + "deprecatedKeySince": "5.2", + "maximumValue": 100 + }, + { + "key": "q", + "description": "Limit search to group names that contain the supplied string. Must have at least 3 characters.<br/>When this parameter is not set, only group having at least one permission are returned.", + "required": false, + "internal": false, + "exampleValue": "eri" + }, + { + "key": "templateId", + "description": "Template id", + "required": false, + "internal": false, + "exampleValue": "AU-Tpxb--iU5OvuD2FLy" + }, + { + "key": "templateName", + "description": "Template name", + "required": false, + "internal": false, + "exampleValue": "Default Permission Template for Projects" + } + ] + }, + { + "key": "template_users", + "description": "Lists the users with their permission as individual users rather than through group affiliation on the chosen template. <br />This service defaults to all users, but can be limited to users with a specific permission by providing the desired permission.<br>Requires the following permission: 'Administer System'.", + "since": "5.2", + "internal": true, + "post": false, + "hasResponseExample": true, + "changelog": [], + "params": [ + { + "key": "organization", + "description": "Key of organization, used when group name is set", + "required": false, + "internal": true, + "exampleValue": "my-org" + }, + { + "key": "p", + "description": "1-based page number", + "required": false, + "internal": false, + "defaultValue": "1", + "exampleValue": "42", + "deprecatedKey": "pageIndex", + "deprecatedKeySince": "5.2" + }, + { + "key": "permission", + "description": "Permission<ul><li>Possible values for project permissions admin, codeviewer, issueadmin, scan, user</li></ul>", + "required": false, + "internal": false, + "possibleValues": [ + "admin", + "codeviewer", + "issueadmin", + "scan", + "user" + ] + }, + { + "key": "ps", + "description": "Page size. Must be greater than 0 and less than 100", + "required": false, + "internal": false, + "defaultValue": "20", + "exampleValue": "20", + "deprecatedKey": "pageSize", + "deprecatedKeySince": "5.2", + "maximumValue": 100 + }, + { + "key": "q", + "description": "Limit search to user names that contain the supplied string. Must have at least 3 characters.<br/>When this parameter is not set, only users having at least one permission are returned.", + "required": false, + "internal": false, + "exampleValue": "eri" + }, + { + "key": "templateId", + "description": "Template id", + "required": false, + "internal": false, + "exampleValue": "AU-Tpxb--iU5OvuD2FLy" + }, + { + "key": "templateName", + "description": "Template name", + "required": false, + "internal": false, + "exampleValue": "Default Permission Template for Projects" + } + ] + }, + { + "key": "update_template", + "description": "Update a permission template.<br />Requires the following permission: 'Administer System'.", + "since": "5.2", + "internal": false, + "post": true, + "hasResponseExample": true, + "changelog": [], + "params": [ + { + "key": "description", + "description": "Description", + "required": false, + "internal": false, + "exampleValue": "Permissions for all projects related to the financial service" + }, + { + "key": "id", + "description": "Id", + "required": true, + "internal": false, + "exampleValue": "af8cb8cc-1e78-4c4e-8c00-ee8e814009a5" + }, + { + "key": "name", + "description": "Name", + "required": false, + "internal": false, + "exampleValue": "Financial Service Permissions" + }, + { + "key": "projectKeyPattern", + "description": "Project key pattern. Must be a valid Java regular expression", + "required": false, + "internal": false, + "exampleValue": ".*\\.finance\\..*" + } + ] + }, + { + "key": "users", + "description": "Lists the users with their permissions as individual users rather than through group affiliation.<br>This service defaults to global permissions, but can be limited to project permissions by providing project id or project key.<br> This service defaults to all users, but can be limited to users with a specific permission by providing the desired permission.<br>Requires one of the following permissions:<ul><li>'Administer System'</li><li>'Administer' rights on the specified project</li></ul>", + "since": "5.2", + "internal": true, + "post": false, + "hasResponseExample": true, + "changelog": [], + "params": [ + { + "key": "organization", + "description": "Key of organization, used when group name is set", + "since": "6.2", + "required": false, + "internal": true, + "exampleValue": "my-org" + }, + { + "key": "p", + "description": "1-based page number", + "required": false, + "internal": false, + "defaultValue": "1", + "exampleValue": "42", + "deprecatedKey": "pageIndex", + "deprecatedKeySince": "5.2" + }, + { + "key": "permission", + "description": "Permission<ul><li>Possible values for global permissions: admin, profileadmin, gateadmin, scan, provisioning</li><li>Possible values for project permissions admin, codeviewer, issueadmin, scan, user</li></ul>", + "required": false, + "internal": false + }, + { + "key": "projectId", + "description": "Project id", + "required": false, + "internal": false, + "exampleValue": "ce4c03d6-430f-40a9-b777-ad877c00aa4d" + }, + { + "key": "projectKey", + "description": "Project key", + "required": false, + "internal": false, + "exampleValue": "my_project" + }, + { + "key": "ps", + "description": "Page size. Must be greater than 0 and less than 100", + "required": false, + "internal": false, + "defaultValue": "20", + "exampleValue": "20", + "deprecatedKey": "pageSize", + "deprecatedKeySince": "5.2", + "maximumValue": 100 + }, + { + "key": "q", + "description": "Limit search to user names that contain the supplied string. Must have at least 3 characters.<br/>When this parameter is not set, only users having at least one permission are returned.", + "required": false, + "internal": false, + "exampleValue": "eri" + } + ] + } + ] + }, + { + "path": "api/plugins", + "since": "5.2", + "description": "Manage the plugins on the server, including installing, uninstalling, and upgrading.", + "actions": [ + { + "key": "available", + "description": "Get the list of all the plugins available for installation on the SonarQube instance, sorted by plugin name.<br/>Plugin information is retrieved from Update Center. Date and time at which Update Center was last refreshed is provided in the response.<br/>Update status values are: <ul><li>COMPATIBLE: plugin is compatible with current SonarQube instance.</li><li>INCOMPATIBLE: plugin is not compatible with current SonarQube instance.</li><li>REQUIRES_SYSTEM_UPGRADE: plugin requires SonarQube to be upgraded before being installed.</li><li>DEPS_REQUIRE_SYSTEM_UPGRADE: at least one plugin on which the plugin is dependent requires SonarQube to be upgraded.</li></ul>Require 'Administer System' permission.", + "since": "5.2", + "internal": false, + "post": false, + "hasResponseExample": true, + "changelog": [] + }, + { + "key": "cancel_all", + "description": "Cancels any operation pending on any plugin (install, update or uninstall)<br/>Requires user to be authenticated with Administer System permissions", + "since": "5.2", + "internal": false, + "post": true, + "hasResponseExample": false, + "changelog": [] + }, + { + "key": "install", + "description": "Installs the latest version of a plugin specified by its key.<br/>Plugin information is retrieved from Update Center.<br/>Requires user to be authenticated with Administer System permissions", + "since": "5.2", + "internal": false, + "post": true, + "hasResponseExample": false, + "changelog": [], + "params": [ + { + "key": "key", + "description": "The key identifying the plugin to install", + "required": true, + "internal": false + } + ] + }, + { + "key": "installed", + "description": "Get the list of all the plugins installed on the SonarQube instance, sorted by plugin name.", + "since": "5.2", + "internal": false, + "post": false, + "hasResponseExample": true, + "changelog": [ + { + "description": "The 'filename' field is added", + "version": "6.6" + }, + { + "description": "The 'fileHash' field is added", + "version": "6.6" + }, + { + "description": "The 'sonarLintSupported' field is added", + "version": "6.6" + }, + { + "description": "The 'updatedAt' field is added", + "version": "6.6" + } + ], + "params": [ + { + "key": "f", + "description": "Comma-separated list of the additional fields to be returned in response. No additional field is returned by default. Possible values are:<ul><li>category - category as defined in the Update Center. A connection to the Update Center is needed</li></lu>", + "since": "5.6", + "required": false, + "internal": false, + "possibleValues": [ + "category" + ] + } + ] + }, + { + "key": "pending", + "description": "Get the list of plugins which will either be installed or removed at the next startup of the SonarQube instance, sorted by plugin name.<br/>Require 'Administer System' permission.", + "since": "5.2", + "internal": false, + "post": false, + "hasResponseExample": true, + "changelog": [] + }, + { + "key": "uninstall", + "description": "Uninstalls the plugin specified by its key.<br/>Requires user to be authenticated with Administer System permissions.", + "since": "5.2", + "internal": false, + "post": true, + "hasResponseExample": false, + "changelog": [], + "params": [ + { + "key": "key", + "description": "The key identifying the plugin to uninstall", + "required": true, + "internal": false + } + ] + }, + { + "key": "update", + "description": "Updates a plugin specified by its key to the latest version compatible with the SonarQube instance.<br/>Plugin information is retrieved from Update Center.<br/>Requires user to be authenticated with Administer System permissions", + "since": "5.2", + "internal": false, + "post": true, + "hasResponseExample": false, + "changelog": [], + "params": [ + { + "key": "key", + "description": "The key identifying the plugin to update", + "required": true, + "internal": false + } + ] + }, + { + "key": "updates", + "description": "Lists plugins installed on the SonarQube instance for which at least one newer version is available, sorted by plugin name.<br/>Each newer version is listed, ordered from the oldest to the newest, with its own update/compatibility status.<br/>Plugin information is retrieved from Update Center. Date and time at which Update Center was last refreshed is provided in the response.<br/>Update status values are: [COMPATIBLE, INCOMPATIBLE, REQUIRES_UPGRADE, DEPS_REQUIRE_UPGRADE].<br/>Require 'Administer System' permission.", + "since": "5.2", + "internal": false, + "post": false, + "hasResponseExample": true, + "changelog": [] + } + ] + }, + { + "path": "api/profiles", + "since": "4.4", + "description": "Removed since 6.3, please use api/qualityprofiles instead", + "actions": [ + { + "key": "index", + "description": "Get a profile.<br/>The web service is removed and you're invited to use api/qualityprofiles/search instead", + "since": "3.3", + "deprecatedSince": "5.2", + "internal": false, + "post": false, + "hasResponseExample": true, + "changelog": [] + }, + { + "key": "list", + "description": "Get a list of profiles.<br/>The web service is removed and you're invited to use api/qualityprofiles/search instead", + "since": "3.3", + "deprecatedSince": "5.2", + "internal": false, + "post": false, + "hasResponseExample": true, + "changelog": [] + } + ] + }, + { + "path": "api/project_analyses", + "since": "6.3", + "description": "Manage project analyses.", + "actions": [ + { + "key": "create_event", + "description": "Create a project analysis event.<br>Only event of category 'VERSION' and 'OTHER' can be created.<br>Requires one of the following permissions:<ul> <li>'Administer System'</li> <li>'Administer' rights on the specified project</li></ul>", + "since": "6.3", + "internal": false, + "post": true, + "hasResponseExample": true, + "changelog": [], + "params": [ + { + "key": "analysis", + "description": "Analysis key", + "required": true, + "internal": false, + "exampleValue": "AU-Tpxb--iU5OvuD2FLy" + }, + { + "key": "category", + "description": "Category", + "required": false, + "internal": false, + "defaultValue": "OTHER", + "possibleValues": [ + "VERSION", + "OTHER" + ] + }, + { + "key": "name", + "description": "Name", + "required": true, + "internal": false, + "exampleValue": "5.6", + "maximumLength": 400 + } + ] + }, + { + "key": "delete", + "description": "Delete a project analysis.<br>Requires one of the following permissions:<ul> <li>'Administer System'</li> <li>'Administer' rights on the project of the specified analysis</li></ul>", + "since": "6.3", + "internal": false, + "post": true, + "hasResponseExample": false, + "changelog": [], + "params": [ + { + "key": "analysis", + "description": "Analysis key", + "required": true, + "internal": false, + "exampleValue": "AU-TpxcA-iU5OvuD2FL1" + } + ] + }, + { + "key": "delete_event", + "description": "Delete a project analysis event.<br>Only event of category 'VERSION' and 'OTHER' can be deleted.<br>Requires one of the following permissions:<ul> <li>'Administer System'</li> <li>'Administer' rights on the specified project</li></ul>", + "since": "6.3", + "internal": false, + "post": true, + "hasResponseExample": false, + "changelog": [], + "params": [ + { + "key": "event", + "description": "Event key", + "required": true, + "internal": false, + "exampleValue": "AU-TpxcA-iU5OvuD2FLz" + } + ] + }, + { + "key": "search", + "description": "Search a project analyses and attached events.<br>Requires the following permission: 'Browse' on the specified project", + "since": "6.3", + "internal": false, + "post": false, + "hasResponseExample": true, + "changelog": [], + "params": [ + { + "key": "branch", + "description": "Branch key", + "since": "6.6", + "required": false, + "internal": true, + "exampleValue": "feature/my_branch" + }, + { + "key": "category", + "description": "Event category. Filter analyses that have at least one event of the category specified.", + "required": false, + "internal": false, + "exampleValue": "OTHER", + "possibleValues": [ + "VERSION", + "OTHER", + "QUALITY_PROFILE", + "QUALITY_GATE" + ] + }, + { + "key": "from", + "description": "Filter analyses created after the given date (inclusive). <br>Either a date (server timezone) or datetime can be provided", + "since": "6.5", + "required": false, + "internal": false, + "exampleValue": "2013-05-01" + }, + { + "key": "p", + "description": "1-based page number", + "required": false, + "internal": false, + "defaultValue": "1", + "exampleValue": "42", + "deprecatedKey": "pageIndex", + "deprecatedKeySince": "5.2" + }, + { + "key": "project", + "description": "Project key", + "required": true, + "internal": false, + "exampleValue": "my_project" + }, + { + "key": "ps", + "description": "Page size. Must be greater than 0 and less than 500", + "required": false, + "internal": false, + "defaultValue": "100", + "exampleValue": "20", + "deprecatedKey": "pageSize", + "deprecatedKeySince": "5.2", + "maximumValue": 500 + }, + { + "key": "to", + "description": "Filter analyses created before the given date (inclusive). <br>Either a date (server timezone) or datetime can be provided", + "since": "6.5", + "required": false, + "internal": false, + "exampleValue": "2017-10-19 or 2017-10-19T13:00:00+0200" + } + ] + }, + { + "key": "update_event", + "description": "Update a project analysis event.<br>Only events of category 'VERSION' and 'OTHER' can be updated.<br>Requires one of the following permissions:<ul> <li>'Administer System'</li> <li>'Administer' rights on the specified project</li></ul>", + "since": "6.3", + "internal": false, + "post": true, + "hasResponseExample": true, + "changelog": [], + "params": [ + { + "key": "event", + "description": "Event key", + "required": true, + "internal": false, + "exampleValue": "AU-TpxcA-iU5OvuD2FL5" + }, + { + "key": "name", + "description": "New name", + "required": false, + "internal": false, + "exampleValue": "5.6", + "maximumLength": 400 + } + ] + } + ] + }, + { + "path": "api/project_branches", + "since": "6.6", + "description": "Manage branch (only available when the Branch plugin is installed)", + "actions": [ + { + "key": "delete", + "description": "Delete a non-main branch of a project.<br/>Requires 'Administer' rights on the specified project.", + "since": "6.6", + "internal": false, + "post": true, + "hasResponseExample": true, + "changelog": [], + "params": [ + { + "key": "branch", + "description": "Name of the branch", + "required": true, + "internal": false, + "exampleValue": "branch1" + }, + { + "key": "project", + "description": "Project key", + "required": true, + "internal": false, + "exampleValue": "my_project" + } + ] + }, + { + "key": "list", + "description": "List the branches of a project.<br/>Requires 'Administer' rights on the specified project.", + "since": "6.6", + "internal": false, + "post": false, + "hasResponseExample": true, + "changelog": [], + "params": [ + { + "key": "project", + "description": "Project key", + "required": true, + "internal": false, + "exampleValue": "my_project" + } + ] + }, + { + "key": "rename", + "description": "Rename the main branch of a project.<br/>Requires 'Administer' permission on the specified project.", + "since": "6.6", + "internal": false, + "post": true, + "hasResponseExample": false, + "changelog": [], + "params": [ + { + "key": "name", + "description": "New name of the main branch", + "required": true, + "internal": false, + "exampleValue": "branch1", + "maximumLength": 255 + }, + { + "key": "project", + "description": "Project key", + "required": true, + "internal": false, + "exampleValue": "my_project" + } + ] + } + ] + }, + { + "path": "api/project_links", + "since": "6.1", + "description": "Manage projects links.", + "actions": [ + { + "key": "create", + "description": "Create a new project link.<br>Requires 'Administer' permission on the specified project, or global 'Administer' permission.", + "since": "6.1", + "internal": false, + "post": true, + "hasResponseExample": true, + "changelog": [], + "params": [ + { + "key": "name", + "description": "Link name", + "required": true, + "internal": false, + "exampleValue": "Custom", + "maximumLength": 128 + }, + { + "key": "projectId", + "description": "Project id", + "required": false, + "internal": false, + "exampleValue": "AU-Tpxb--iU5OvuD2FLy" + }, + { + "key": "projectKey", + "description": "Project key", + "required": false, + "internal": false, + "exampleValue": "my_project" + }, + { + "key": "url", + "description": "Link url", + "required": true, + "internal": false, + "exampleValue": "http://example.com", + "maximumLength": 2048 + } + ] + }, + { + "key": "delete", + "description": "Delete existing project link.<br>Requires 'Administer' permission on the specified project, or global 'Administer' permission.", + "since": "6.1", + "internal": false, + "post": true, + "hasResponseExample": false, + "changelog": [], + "params": [ + { + "key": "id", + "description": "Link id", + "required": true, + "internal": false, + "exampleValue": "17" + } + ] + }, + { + "key": "search", + "description": "List links of a project.<br>The 'projectId' or 'projectKey' must be provided.<br>Requires one of the following permissions:<ul><li>'Administer System'</li><li>'Administer' rights on the specified project</li><li>'Browse' on the specified project</li></ul>", + "since": "6.1", + "internal": false, + "post": false, + "hasResponseExample": true, + "changelog": [], + "params": [ + { + "key": "projectId", + "description": "Project Id", + "required": false, + "internal": false, + "exampleValue": "AU-Tpxb--iU5OvuD2FLy" + }, + { + "key": "projectKey", + "description": "Project Key", + "required": false, + "internal": false, + "exampleValue": "my_project" + } + ] + } + ] + }, + { + "path": "api/project_tags", + "since": "6.4", + "description": "Manage project tags", + "actions": [ + { + "key": "search", + "description": "Search tags", + "since": "6.4", + "internal": false, + "post": false, + "hasResponseExample": true, + "changelog": [], + "params": [ + { + "key": "ps", + "description": "Page size. Must be greater than 0 and less than 100", + "required": false, + "internal": false, + "defaultValue": "10", + "exampleValue": "20", + "deprecatedKey": "pageSize", + "deprecatedKeySince": "5.2", + "maximumValue": 100 + }, + { + "key": "q", + "description": "Limit search to tags that contain the supplied string.", + "required": false, + "internal": false, + "exampleValue": "off" + } + ] + }, + { + "key": "set", + "description": "Set tags on a project.<br>Requires the following permission: 'Administer' rights on the specified project", + "since": "6.4", + "internal": false, + "post": true, + "hasResponseExample": false, + "changelog": [], + "params": [ + { + "key": "project", + "description": "Project key", + "required": true, + "internal": false, + "exampleValue": "my_project" + }, + { + "key": "tags", + "description": "Comma-separated list of tags", + "required": true, + "internal": false, + "exampleValue": "finance, offshore" + } + ] + } + ] + }, + { + "path": "api/projects", + "since": "2.10", + "description": "Manage project existence.", + "actions": [ + { + "key": "bulk_delete", + "description": "Delete one or several projects.<br />Requires 'Administer System' permission.", + "since": "5.2", + "internal": false, + "post": true, + "hasResponseExample": false, + "changelog": [], + "params": [ + { + "key": "analyzedBefore", + "description": "Filter the projects for which last analysis is older than the given date (exclusive).<br> Either a date (server timezone) or datetime can be provided.", + "since": "6.6", + "required": false, + "internal": false, + "exampleValue": "2017-10-19 or 2017-10-19T13:00:00+0200" + }, + { + "key": "onProvisionedOnly", + "description": "Filter the projects that are provisioned", + "since": "6.6", + "required": false, + "internal": false, + "defaultValue": "false", + "possibleValues": [ + "true", + "false", + "yes", + "no" + ] + }, + { + "key": "organization", + "description": "The key of the organization", + "since": "6.3", + "required": false, + "internal": true + }, + { + "key": "projectIds", + "description": "Comma-separated list of project ids", + "required": false, + "internal": false, + "exampleValue": "AU-Tpxb--iU5OvuD2FLy,AU-TpxcA-iU5OvuD2FLz", + "deprecatedSince": "6.4", + "deprecatedKey": "ids", + "deprecatedKeySince": "6.4" + }, + { + "key": "projects", + "description": "Comma-separated list of project keys", + "required": false, + "internal": false, + "exampleValue": "my_project,another_project", + "deprecatedKey": "keys", + "deprecatedKeySince": "6.4" + }, + { + "key": "q", + "description": "Limit to: <ul><li>component names that contain the supplied string</li><li>component keys that contain the supplied string</li></ul>", + "required": false, + "internal": false, + "exampleValue": "sonar" + }, + { + "key": "qualifiers", + "description": "Comma-separated list of component qualifiers. Filter the results with the specified qualifiers", + "required": false, + "internal": false, + "defaultValue": "TRK", + "possibleValues": [ + "TRK", + "VW", + "APP" + ] + }, + { + "key": "visibility", + "description": "Filter the projects that should be visible to everyone (public), or only specific user/groups (private).<br/>If no visibility is specified, the default project visibility of the organization will be used.", + "since": "6.4", + "required": false, + "internal": true, + "possibleValues": [ + "private", + "public" + ] + } + ] + }, + { + "key": "bulk_update_key", + "description": "Bulk update a project or module key and all its sub-components keys. The bulk update allows to replace a part of the current key by another string on the current project and all its sub-modules.<br>It's possible to simulate the bulk update by setting the parameter 'dryRun' at true. No key is updated with a dry run.<br>Ex: to rename a project with key 'my_project' to 'my_new_project' and all its sub-components keys, call the WS with parameters:<ul> <li>project: my_project</li> <li>from: my_</li> <li>to: my_new_</li></ul>Either 'projectId' or 'project' must be provided.<br> Requires one of the following permissions: <ul><li>'Administer System'</li><li>'Administer' rights on the specified project</li></ul>", + "since": "6.1", + "internal": false, + "post": true, + "hasResponseExample": true, + "changelog": [ + { + "description": "Moved from api/components/bulk_update_key to api/projects/bulk_update_key", + "version": "6.4" + } + ], + "params": [ + { + "key": "dryRun", + "description": "Simulate bulk update. No component key is updated.", + "required": false, + "internal": false, + "defaultValue": "false", + "possibleValues": [ + "true", + "false", + "yes", + "no" + ] + }, + { + "key": "from", + "description": "String to match in components keys", + "required": true, + "internal": false, + "exampleValue": "_old" + }, + { + "key": "project", + "description": "Project or module key", + "required": false, + "internal": false, + "exampleValue": "my_old_project", + "deprecatedKey": "key", + "deprecatedKeySince": "6.4" + }, + { + "key": "projectId", + "description": "Project or module ID", + "required": false, + "internal": false, + "exampleValue": "AU-Tpxb--iU5OvuD2FLy", + "deprecatedSince": "6.4", + "deprecatedKey": "id", + "deprecatedKeySince": "6.4" + }, + { + "key": "to", + "description": "String replacement in components keys", + "required": true, + "internal": false, + "exampleValue": "_new" + } + ] + }, + { + "key": "create", + "description": "Create a project.<br/>Requires 'Create Projects' permission", + "since": "4.0", + "internal": false, + "post": true, + "hasResponseExample": true, + "changelog": [ + { + "description": "The response format has been updated and does not contain the database ID anymore", + "version": "6.3" + }, + { + "description": "The 'key' parameter has been renamed 'project'", + "version": "6.3" + } + ], + "params": [ + { + "key": "branch", + "description": "SCM Branch of the project. The key of the project will become key:branch, for instance 'SonarQube:branch-5.0'", + "required": false, + "internal": false, + "exampleValue": "branch-5.0" + }, + { + "key": "name", + "description": "Name of the project", + "required": true, + "internal": false, + "exampleValue": "SonarQube", + "maximumLength": 2000 + }, + { + "key": "organization", + "description": "The key of the organization", + "since": "6.3", + "required": false, + "internal": true + }, + { + "key": "project", + "description": "Key of the project", + "required": true, + "internal": false, + "exampleValue": "my_project", + "deprecatedKey": "key", + "deprecatedKeySince": "6.3", + "maximumLength": 400 + }, + { + "key": "visibility", + "description": "Whether the created project should be visible to everyone, or only specific user/groups.<br/>If no visibility is specified, the default project visibility of the organization will be used.", + "since": "6.4", + "required": false, + "internal": true, + "possibleValues": [ + "private", + "public" + ] + } + ] + }, + { + "key": "delete", + "description": "Delete a project.<br> Requires 'Administer System' permission or 'Administer' permission on the project.", + "since": "5.2", + "internal": false, + "post": true, + "hasResponseExample": false, + "changelog": [], + "params": [ + { + "key": "project", + "description": "Project key", + "required": false, + "internal": false, + "exampleValue": "my_project", + "deprecatedKey": "key", + "deprecatedKeySince": "6.4" + }, + { + "key": "projectId", + "description": "Project ID", + "required": false, + "internal": false, + "exampleValue": "ce4c03d6-430f-40a9-b777-ad877c00aa4d", + "deprecatedSince": "6.4", + "deprecatedKey": "id", + "deprecatedKeySince": "6.4" + } + ] + }, + { + "key": "ghosts", + "description": "List ghost projects.<br> With the current architecture, it's no more possible to have invisible ghost projects. Therefore, the web service is deprecated.<br> Requires 'Administer System' permission.", + "since": "5.2", + "deprecatedSince": "6.6", + "internal": false, + "post": false, + "hasResponseExample": true, + "changelog": [ + { + "description": "The 'uuid' field is deprecated in the response", + "version": "6.4" + } + ], + "params": [ + { + "key": "f", + "description": "Comma-separated list of the fields to be returned in response. All the fields are returned by default.", + "required": false, + "internal": false, + "possibleValues": [ + "name", + "creationDate", + "visibility", + "uuid", + "key" + ] + }, + { + "key": "organization", + "description": "Organization key", + "since": "6.3", + "required": false, + "internal": true + }, + { + "key": "p", + "description": "1-based page number", + "required": false, + "internal": false, + "defaultValue": "1", + "exampleValue": "42", + "deprecatedKey": "pageIndex", + "deprecatedKeySince": "5.2" + }, + { + "key": "ps", + "description": "Page size. Must be greater than 0 and less than 500", + "required": false, + "internal": false, + "defaultValue": "100", + "exampleValue": "20", + "deprecatedKey": "pageSize", + "deprecatedKeySince": "5.2", + "maximumValue": 500 + }, + { + "key": "q", + "description": "Limit search to names or keys that contain the supplied string.", + "required": false, + "internal": false, + "exampleValue": "sonar" + } + ] + }, + { + "key": "index", + "description": "This web service is deprecated, please use api/components/search instead", + "since": "2.10", + "deprecatedSince": "6.3", + "internal": false, + "post": false, + "hasResponseExample": true, + "changelog": [ + { + "description": "The parameters 'desc', 'views', 'libs' and 'versions' have no effect.", + "version": "6.3" + } + ], + "params": [ + { + "key": "desc", + "description": "Since 6.3, this parameter has no effect", + "required": false, + "internal": false, + "deprecatedSince": "6.3" + }, + { + "key": "format", + "description": "Only json response format is available", + "required": false, + "internal": false, + "possibleValues": [ + "json" + ] + }, + { + "key": "libs", + "description": "Since 6.3, this parameter has no effect", + "required": false, + "internal": false, + "deprecatedSince": "6.3" + }, + { + "key": "project", + "description": "key or ID of the project", + "required": false, + "internal": false, + "exampleValue": "my_project", + "deprecatedKey": "key", + "deprecatedKeySince": "6.4" + }, + { + "key": "search", + "description": "Substring of project name, case insensitive. Ignored if the parameter key is set", + "required": false, + "internal": false, + "exampleValue": "Sonar" + }, + { + "key": "subprojects", + "description": "Load sub-projects. Ignored if the parameter key is set", + "required": false, + "internal": false, + "defaultValue": "false", + "possibleValues": [ + "true", + "false", + "yes", + "no" + ] + }, + { + "key": "versions", + "description": "Since 6.3, this parameter has no effect", + "required": false, + "internal": false, + "deprecatedSince": "6.3" + }, + { + "key": "views", + "description": "Since 6.3, this parameter has no effect", + "required": false, + "internal": false, + "deprecatedSince": "6.3" + } + ] + }, + { + "key": "provisioned", + "description": "Get the list of provisioned projects.<br> Web service is deprecated. Use api/projects/search instead, with onProvisionedOnly=true.<br> Require 'Create Projects' permission.", + "since": "5.2", + "deprecatedSince": "6.6", + "internal": false, + "post": false, + "hasResponseExample": true, + "changelog": [ + { + "description": "The 'uuid' field is deprecated in the response", + "version": "6.4" + }, + { + "description": "Paging response fields is now in a Paging object", + "version": "6.4" + } + ], + "params": [ + { + "key": "f", + "description": "Comma-separated list of the fields to be returned in response. All the fields are returned by default.", + "required": false, + "internal": false, + "possibleValues": [ + "name", + "creationDate", + "visibility", + "uuid", + "key" + ] + }, + { + "key": "organization", + "description": "The key of the organization", + "since": "6.3", + "required": false, + "internal": true + }, + { + "key": "p", + "description": "1-based page number", + "required": false, + "internal": false, + "defaultValue": "1", + "exampleValue": "42", + "deprecatedKey": "pageIndex", + "deprecatedKeySince": "5.2" + }, + { + "key": "ps", + "description": "Page size. Must be greater than 0 and less than 500", + "required": false, + "internal": false, + "defaultValue": "100", + "exampleValue": "20", + "deprecatedKey": "pageSize", + "deprecatedKeySince": "5.2", + "maximumValue": 500 + }, + { + "key": "q", + "description": "Limit search to names or keys that contain the supplied string.", + "required": false, + "internal": false, + "exampleValue": "sonar" + } + ] + }, + { + "key": "search", + "description": "Search for projects or views to administrate them.<br>Requires 'System Administrator' permission", + "since": "6.3", + "internal": false, + "post": false, + "hasResponseExample": true, + "changelog": [ + { + "description": "The 'uuid' field is deprecated in the response", + "version": "6.4" + } + ], + "params": [ + { + "key": "analyzedBefore", + "description": "Filter the projects for which last analysis is older than the given date (exclusive).<br> Either a date (server timezone) or datetime can be provided.", + "since": "6.6", + "required": false, + "internal": false, + "exampleValue": "2017-10-19 or 2017-10-19T13:00:00+0200" + }, + { + "key": "onProvisionedOnly", + "description": "Filter the projects that are provisioned", + "since": "6.6", + "required": false, + "internal": false, + "defaultValue": "false", + "possibleValues": [ + "true", + "false", + "yes", + "no" + ] + }, + { + "key": "organization", + "description": "The key of the organization", + "since": "6.3", + "required": false, + "internal": true + }, + { + "key": "p", + "description": "1-based page number", + "required": false, + "internal": false, + "defaultValue": "1", + "exampleValue": "42", + "deprecatedKey": "pageIndex", + "deprecatedKeySince": "5.2" + }, + { + "key": "projectIds", + "description": "Comma-separated list of project ids", + "since": "6.6", + "required": false, + "internal": false, + "exampleValue": "AU-Tpxb--iU5OvuD2FLy,AU-TpxcA-iU5OvuD2FLz", + "deprecatedSince": "6.6" + }, + { + "key": "projects", + "description": "Comma-separated list of project keys", + "since": "6.6", + "required": false, + "internal": false, + "exampleValue": "my_project,another_project" + }, + { + "key": "ps", + "description": "Page size. Must be greater than 0 and less than 500", + "required": false, + "internal": false, + "defaultValue": "100", + "exampleValue": "20", + "deprecatedKey": "pageSize", + "deprecatedKeySince": "5.2", + "maximumValue": 500 + }, + { + "key": "q", + "description": "Limit search to: <ul><li>component names that contain the supplied string</li><li>component keys that contain the supplied string</li></ul>", + "required": false, + "internal": false, + "exampleValue": "sonar" + }, + { + "key": "qualifiers", + "description": "Comma-separated list of component qualifiers. Filter the results with the specified qualifiers", + "required": false, + "internal": false, + "defaultValue": "TRK", + "possibleValues": [ + "TRK", + "VW", + "APP" + ] + }, + { + "key": "visibility", + "description": "Filter the projects that should be visible to everyone (public), or only specific user/groups (private).<br/>If no visibility is specified, the default project visibility of the organization will be used.", + "since": "6.4", + "required": false, + "internal": true, + "possibleValues": [ + "private", + "public" + ] + } + ] + }, + { + "key": "search_my_projects", + "description": "Return list of projects for which the current user has 'Administer' permission.", + "since": "6.0", + "internal": true, + "post": false, + "hasResponseExample": true, + "changelog": [ + { + "description": "The 'id' field is deprecated in the response", + "version": "6.4" + } + ], + "params": [ + { + "key": "p", + "description": "1-based page number", + "required": false, + "internal": false, + "defaultValue": "1", + "exampleValue": "42", + "deprecatedKey": "pageIndex", + "deprecatedKeySince": "5.2" + }, + { + "key": "ps", + "description": "Page size. Must be greater than 0 and less than 500", + "required": false, + "internal": false, + "defaultValue": "100", + "exampleValue": "20", + "deprecatedKey": "pageSize", + "deprecatedKeySince": "5.2", + "maximumValue": 500 + } + ] + }, + { + "key": "update_key", + "description": "Update a project or module key and all its sub-components keys.<br>Either 'from' or 'projectId' must be provided.<br> Requires one of the following permissions: <ul><li>'Administer System'</li><li>'Administer' rights on the specified project</li></ul>", + "since": "6.1", + "internal": false, + "post": true, + "hasResponseExample": false, + "changelog": [ + { + "description": "Move from api/components/update_key to api/projects/update_key", + "version": "6.4" + } + ], + "params": [ + { + "key": "from", + "description": "Project or module key", + "required": false, + "internal": false, + "exampleValue": "my_old_project", + "deprecatedKey": "key", + "deprecatedKeySince": "6.4" + }, + { + "key": "projectId", + "description": "Project or module id", + "required": false, + "internal": false, + "exampleValue": "AU-Tpxb--iU5OvuD2FLy", + "deprecatedSince": "6.4", + "deprecatedKey": "id", + "deprecatedKeySince": "6.4" + }, + { + "key": "to", + "description": "New component key", + "required": true, + "internal": false, + "exampleValue": "my_new_project", + "deprecatedKey": "newKey", + "deprecatedKeySince": "6.4" + } + ] + }, + { + "key": "update_visibility", + "description": "Updates visibility of a project.<br>Requires 'Project administer' permission on the specified project", + "since": "6.4", + "internal": false, + "post": true, + "hasResponseExample": false, + "changelog": [], + "params": [ + { + "key": "project", + "description": "Project key", + "required": true, + "internal": false, + "exampleValue": "my_project" + }, + { + "key": "visibility", + "description": "New visibility", + "required": true, + "internal": false, + "possibleValues": [ + "private", + "public" + ] + } + ] + } + ] + }, + { + "path": "api/properties", + "since": "2.6", + "description": "This web service is deprecated, please use api/settings instead.", + "actions": [ + { + "key": "index", + "description": "This web service is deprecated, please use api/settings/values instead.", + "since": "2.6", + "deprecatedSince": "6.3", + "internal": false, + "post": false, + "hasResponseExample": true, + "changelog": [], + "params": [ + { + "key": "format", + "description": "Only json response format is available", + "required": false, + "internal": false, + "possibleValues": [ + "json" + ] + }, + { + "key": "id", + "description": "Setting key", + "required": false, + "internal": false, + "exampleValue": "sonar.test.inclusions" + }, + { + "key": "resource", + "description": "Component key or database id", + "required": false, + "internal": false, + "exampleValue": "my_project" + } + ] + } + ] + }, + { + "path": "api/qualitygates", + "since": "4.3", + "description": "Manage quality gates, including conditions and project association.", + "actions": [ + { + "key": "app", + "description": "Get initialization items for the admin UI. For internal use", + "since": "4.3", + "internal": true, + "post": false, + "hasResponseExample": true, + "changelog": [] + }, + { + "key": "copy", + "description": "Copy a Quality Gate.<br>Requires the 'Administer Quality Gates' permission.", + "since": "4.3", + "internal": false, + "post": true, + "hasResponseExample": false, + "changelog": [], + "params": [ + { + "key": "id", + "description": "The ID of the source quality gate", + "required": true, + "internal": false, + "exampleValue": "1" + }, + { + "key": "name", + "description": "The name of the quality gate to create", + "required": true, + "internal": false, + "exampleValue": "My Quality Gate" + } + ] + }, + { + "key": "create", + "description": "Create a Quality Gate.<br>Requires the 'Administer Quality Gates' permission.", + "since": "4.3", + "internal": false, + "post": true, + "hasResponseExample": false, + "changelog": [], + "params": [ + { + "key": "name", + "description": "The name of the quality gate to create", + "required": true, + "internal": false, + "exampleValue": "My Quality Gate", + "maximumLength": 100 + } + ] + }, + { + "key": "create_condition", + "description": "Add a new condition to a quality gate.<br>Requires the 'Administer Quality Gates' permission.", + "since": "4.3", + "internal": false, + "post": true, + "hasResponseExample": false, + "changelog": [], + "params": [ + { + "key": "error", + "description": "Condition error threshold", + "required": false, + "internal": false, + "exampleValue": "10", + "maximumLength": 64 + }, + { + "key": "gateId", + "description": "ID of the quality gate", + "required": true, + "internal": false, + "exampleValue": "1" + }, + { + "key": "metric", + "description": "Condition metric", + "required": true, + "internal": false, + "exampleValue": "blocker_violations" + }, + { + "key": "op", + "description": "Condition operator:<br/><ul><li>EQ = equals</li><li>NE = is not</li><li>LT = is lower than</li><li>GT = is greater than</li></ui>", + "required": false, + "internal": false, + "exampleValue": "EQ", + "possibleValues": [ + "LT", + "GT", + "EQ", + "NE" + ] + }, + { + "key": "period", + "description": "Condition period. If not set, the absolute value is considered.", + "required": false, + "internal": false, + "possibleValues": [ + "1" + ] + }, + { + "key": "warning", + "description": "Condition warning threshold", + "required": false, + "internal": false, + "exampleValue": "5", + "maximumLength": 64 + } + ] + }, + { + "key": "delete_condition", + "description": "Delete a condition from a quality gate.<br>Requires the 'Administer Quality Gates' permission.", + "since": "4.3", + "internal": false, + "post": true, + "hasResponseExample": false, + "changelog": [], + "params": [ + { + "key": "id", + "description": "Condition ID", + "required": true, + "internal": false, + "exampleValue": "2" + } + ] + }, + { + "key": "deselect", + "description": "Remove the association of a project from a quality gate.<br>Requires the 'Administer Quality Gates' permission.", + "since": "4.3", + "internal": false, + "post": true, + "hasResponseExample": false, + "changelog": [ + { + "description": "The parameter 'gateId' was removed", + "version": "6.6" + } + ], + "params": [ + { + "key": "projectId", + "description": "Project id", + "required": false, + "internal": false, + "exampleValue": "AU-Tpxb--iU5OvuD2FLy", + "deprecatedSince": "6.1" + }, + { + "key": "projectKey", + "description": "Project key", + "since": "6.1", + "required": false, + "internal": false, + "exampleValue": "my_project" + } + ] + }, + { + "key": "destroy", + "description": "Delete a Quality Gate.<br>Requires the 'Administer Quality Gates' permission.", + "since": "4.3", + "internal": false, + "post": true, + "hasResponseExample": false, + "changelog": [], + "params": [ + { + "key": "id", + "description": "ID of the quality gate to delete", + "required": true, + "internal": false, + "exampleValue": "1" + } + ] + }, + { + "key": "get_by_project", + "description": "Get the quality gate of a project.<br />Requires one of the following permissions:<ul><li>'Administer System'</li><li>'Administer' rights on the specified project</li><li>'Browse' on the specified project</li></ul>", + "since": "6.1", + "internal": false, + "post": false, + "hasResponseExample": true, + "changelog": [ + { + "description": "The parameter 'projectId' has been removed", + "version": "6.6" + }, + { + "description": "The parameter 'projectKey' has been renamed to 'project'", + "version": "6.6" + }, + { + "description": "This webservice is now part of the public API", + "version": "6.6" + } + ], + "params": [ + { + "key": "project", + "description": "Project key", + "required": true, + "internal": false, + "exampleValue": "my_project" + } + ] + }, + { + "key": "list", + "description": "Get a list of quality gates", + "since": "4.3", + "internal": false, + "post": false, + "hasResponseExample": true, + "changelog": [] + }, + { + "key": "project_status", + "description": "Get the quality gate status of a project or a Compute Engine task.<br />Either 'analysisId', 'projectId' or 'projectKey' must be provided<br />The different statuses returned are: OK, WARN, ERROR, NONE. The NONE status is returned when there is no quality gate associated with the analysis.<br />Returns an HTTP code 404 if the analysis associated with the task is not found or does not exist.<br />Requires one of the following permissions:<ul><li>'Administer System'</li><li>'Administer' rights on the specified project</li><li>'Browse' on the specified project</li></ul>", + "since": "5.3", + "internal": false, + "post": false, + "hasResponseExample": true, + "changelog": [ + { + "description": "The field 'ignoredConditions' is added to the response", + "version": "6.4" + } + ], + "params": [ + { + "key": "analysisId", + "description": "Analysis id", + "required": false, + "internal": false, + "exampleValue": "AU-TpxcA-iU5OvuD2FL1" + }, + { + "key": "projectId", + "description": "Project id", + "since": "5.4", + "required": false, + "internal": false, + "exampleValue": "AU-Tpxb--iU5OvuD2FLy" + }, + { + "key": "projectKey", + "description": "Project key", + "since": "5.4", + "required": false, + "internal": false, + "exampleValue": "my_project" + } + ] + }, + { + "key": "rename", + "description": "Rename a Quality Gate.<br>Requires the 'Administer Quality Gates' permission.", + "since": "4.3", + "internal": false, + "post": true, + "hasResponseExample": false, + "changelog": [], + "params": [ + { + "key": "id", + "description": "ID of the quality gate to rename", + "required": true, + "internal": false, + "exampleValue": "1" + }, + { + "key": "name", + "description": "New name of the quality gate", + "required": true, + "internal": false, + "exampleValue": "My Quality Gate", + "maximumLength": 100 + } + ] + }, + { + "key": "search", + "description": "Search for projects associated (or not) to a quality gate.<br/>Only authorized projects for current user will be returned.", + "since": "4.3", + "internal": false, + "post": false, + "hasResponseExample": true, + "changelog": [], + "params": [ + { + "key": "gateId", + "description": "Quality Gate ID", + "required": true, + "internal": false, + "exampleValue": "1" + }, + { + "key": "page", + "description": "Page number", + "required": false, + "internal": false, + "defaultValue": "1", + "exampleValue": "2" + }, + { + "key": "pageSize", + "description": "Page size", + "required": false, + "internal": false, + "exampleValue": "10" + }, + { + "key": "query", + "description": "To search for projects containing this string. If this parameter is set, \"selected\" is set to \"all\".", + "required": false, + "internal": false, + "exampleValue": "abc" + }, + { + "key": "selected", + "description": "Depending on the value, show only selected items (selected=selected), deselected items (selected=deselected), or all items with their selection status (selected=all).", + "required": false, + "internal": false, + "defaultValue": "selected", + "possibleValues": [ + "all", + "deselected", + "selected" + ] + } + ] + }, + { + "key": "select", + "description": "Associate a project to a quality gate.<br>The 'projectId' or 'projectKey' must be provided.<br>Project id as a numeric value is deprecated since 6.1. Please use the id similar to 'AU-TpxcA-iU5OvuD2FLz'.<br>Requires the 'Administer Quality Gates' permission.", + "since": "4.3", + "internal": false, + "post": true, + "hasResponseExample": false, + "changelog": [], + "params": [ + { + "key": "gateId", + "description": "Quality gate id", + "required": true, + "internal": false, + "exampleValue": "1" + }, + { + "key": "projectId", + "description": "Project id. Project id as an numeric value is deprecated since 6.1", + "required": false, + "internal": false, + "exampleValue": "AU-Tpxb--iU5OvuD2FLy" + }, + { + "key": "projectKey", + "description": "Project key", + "since": "6.1", + "required": false, + "internal": false, + "exampleValue": "my_project" + } + ] + }, + { + "key": "set_as_default", + "description": "Set a quality gate as the default quality gate.<br>Requires the 'Administer Quality Gates' permission.", + "since": "4.3", + "internal": false, + "post": true, + "hasResponseExample": false, + "changelog": [], + "params": [ + { + "key": "id", + "description": "ID of the quality gate to set as default", + "required": true, + "internal": false, + "exampleValue": "1" + } + ] + }, + { + "key": "show", + "description": "Display the details of a quality gate", + "since": "4.3", + "internal": false, + "post": false, + "hasResponseExample": true, + "changelog": [], + "params": [ + { + "key": "id", + "description": "ID of the quality gate. Either id or name must be set", + "required": false, + "internal": false, + "exampleValue": "1" + }, + { + "key": "name", + "description": "Name of the quality gate. Either id or name must be set", + "required": false, + "internal": false, + "exampleValue": "My Quality Gate" + } + ] + }, + { + "key": "unset_default", + "description": "Unset a quality gate as the default quality gate.<br>Requires the 'Administer Quality Gates' permission.", + "since": "4.3", + "internal": false, + "post": true, + "hasResponseExample": false, + "changelog": [], + "params": [ + { + "key": "id", + "description": "ID of the quality gate to unset as default", + "required": true, + "internal": false, + "exampleValue": "1" + } + ] + }, + { + "key": "update_condition", + "description": "Update a condition attached to a quality gate.<br>Requires the 'Administer Quality Gates' permission.", + "since": "4.3", + "internal": false, + "post": true, + "hasResponseExample": false, + "changelog": [], + "params": [ + { + "key": "error", + "description": "Condition error threshold", + "required": false, + "internal": false, + "exampleValue": "10", + "maximumLength": 64 + }, + { + "key": "id", + "description": "Condition ID", + "required": true, + "internal": false, + "exampleValue": "10" + }, + { + "key": "metric", + "description": "Condition metric", + "required": true, + "internal": false, + "exampleValue": "blocker_violations" + }, + { + "key": "op", + "description": "Condition operator:<br/><ul><li>EQ = equals</li><li>NE = is not</li><li>LT = is lower than</li><li>GT = is greater than</li></ui>", + "required": false, + "internal": false, + "exampleValue": "EQ", + "possibleValues": [ + "LT", + "GT", + "EQ", + "NE" + ] + }, + { + "key": "period", + "description": "Condition period. If not set, the absolute value is considered.", + "required": false, + "internal": false, + "possibleValues": [ + "1" + ] + }, + { + "key": "warning", + "description": "Condition warning threshold", + "required": false, + "internal": false, + "exampleValue": "5", + "maximumLength": 64 + } + ] + } + ] + }, + { + "path": "api/qualityprofiles", + "since": "4.4", + "description": "Manage quality profiles.", + "actions": [ + { + "key": "activate_rule", + "description": "Activate a rule on a Quality Profile.<br> Requires one of the following permissions:<ul> <li>'Administer Quality Profiles'</li> <li>Edit right on the specified quality profile</li></ul>", + "since": "4.4", + "internal": false, + "post": true, + "hasResponseExample": false, + "changelog": [], + "params": [ + { + "key": "key", + "description": "Quality Profile key. Can be obtained through <code>api/qualityprofiles/search</code>", + "required": true, + "internal": false, + "exampleValue": "AU-Tpxb--iU5OvuD2FLy", + "deprecatedKey": "profile_key", + "deprecatedKeySince": "6.5" + }, + { + "key": "params", + "description": "Parameters as semi-colon list of <code>key=value</code>. Ignored if parameter reset is true.", + "required": false, + "internal": false, + "exampleValue": "params=key1=v1;key2=v2" + }, + { + "key": "reset", + "description": "Reset severity and parameters of activated rule. Set the values defined on parent profile or from rule default values.", + "required": false, + "internal": false, + "possibleValues": [ + "true", + "false", + "yes", + "no" + ] + }, + { + "key": "rule", + "description": "Rule key", + "required": true, + "internal": false, + "exampleValue": "squid:AvoidCycles", + "deprecatedKey": "rule_key", + "deprecatedKeySince": "6.5" + }, + { + "key": "severity", + "description": "Severity. Ignored if parameter reset is true.", + "required": false, + "internal": false, + "possibleValues": [ + "INFO", + "MINOR", + "MAJOR", + "CRITICAL", + "BLOCKER" + ] + } + ] + }, + { + "key": "activate_rules", + "description": "Bulk-activate rules on one quality profile.<br> Requires one of the following permissions:<ul> <li>'Administer Quality Profiles'</li> <li>Edit right on the specified quality profile</li></ul>", + "since": "4.4", + "internal": false, + "post": true, + "hasResponseExample": false, + "changelog": [], + "params": [ + { + "key": "activation", + "description": "Filter rules that are activated or deactivated on the selected Quality profile. Ignored if the parameter 'qprofile' is not set.", + "required": false, + "internal": false, + "possibleValues": [ + "true", + "false", + "yes", + "no" + ] + }, + { + "key": "active_severities", + "description": "Comma-separated list of activation severities, i.e the severity of rules in Quality profiles.", + "required": false, + "internal": false, + "exampleValue": "CRITICAL,BLOCKER", + "possibleValues": [ + "INFO", + "MINOR", + "MAJOR", + "CRITICAL", + "BLOCKER" + ] + }, + { + "key": "asc", + "description": "Ascending sort", + "required": false, + "internal": false, + "defaultValue": "true", + "possibleValues": [ + "true", + "false", + "yes", + "no" + ] + }, + { + "key": "available_since", + "description": "Filters rules added since date. Format is yyyy-MM-dd", + "required": false, + "internal": false, + "exampleValue": "2014-06-22" + }, + { + "key": "compareToProfile", + "description": "Quality profile key to filter rules that are activated. Meant to compare easily to profile set in 'qprofile'", + "since": "6.5", + "required": false, + "internal": true, + "exampleValue": "AU-TpxcA-iU5OvuD2FLz" + }, + { + "key": "inheritance", + "description": "Comma-separated list of values of inheritance for a rule within a quality profile. Used only if the parameter 'activation' is set.", + "required": false, + "internal": false, + "exampleValue": "INHERITED,OVERRIDES", + "possibleValues": [ + "NONE", + "INHERITED", + "OVERRIDES" + ] + }, + { + "key": "is_template", + "description": "Filter template rules", + "required": false, + "internal": false, + "possibleValues": [ + "true", + "false", + "yes", + "no" + ] + }, + { + "key": "languages", + "description": "Comma-separated list of languages", + "required": false, + "internal": false, + "exampleValue": "java,js" + }, + { + "key": "organization", + "description": "Organization key", + "since": "6.4", + "required": false, + "internal": true, + "exampleValue": "my-org" + }, + { + "key": "q", + "description": "UTF-8 search query", + "required": false, + "internal": false, + "exampleValue": "xpath" + }, + { + "key": "qprofile", + "description": "Quality profile key to filter on. Used only if the parameter 'activation' is set.", + "required": false, + "internal": false, + "exampleValue": "AU-Tpxb--iU5OvuD2FLy" + }, + { + "key": "repositories", + "description": "Comma-separated list of repositories", + "required": false, + "internal": false, + "exampleValue": "checkstyle,findbugs" + }, + { + "key": "rule_key", + "description": "Key of rule to search for", + "required": false, + "internal": false, + "exampleValue": "squid:S001" + }, + { + "key": "s", + "description": "Sort field", + "required": false, + "internal": false, + "exampleValue": "name", + "possibleValues": [ + "name", + "updatedAt", + "createdAt", + "key" + ] + }, + { + "key": "severities", + "description": "Comma-separated list of default severities. Not the same than severity of rules in Quality profiles.", + "required": false, + "internal": false, + "exampleValue": "CRITICAL,BLOCKER", + "possibleValues": [ + "INFO", + "MINOR", + "MAJOR", + "CRITICAL", + "BLOCKER" + ] + }, + { + "key": "statuses", + "description": "Comma-separated list of status codes", + "required": false, + "internal": false, + "exampleValue": "READY", + "possibleValues": [ + "BETA", + "DEPRECATED", + "READY", + "REMOVED" + ] + }, + { + "key": "tags", + "description": "Comma-separated list of tags. Returned rules match any of the tags (OR operator)", + "required": false, + "internal": false, + "exampleValue": "security,java8" + }, + { + "key": "targetKey", + "description": "Quality Profile key on which the rule activation is done. To retrieve a quality profile key please see <code>api/qualityprofiles/search</code>", + "required": true, + "internal": false, + "exampleValue": "AU-TpxcA-iU5OvuD2FL0", + "deprecatedKey": "profile_key", + "deprecatedKeySince": "6.5" + }, + { + "key": "targetSeverity", + "description": "Severity to set on the activated rules", + "required": false, + "internal": false, + "deprecatedKey": "activation_severity", + "deprecatedKeySince": "6.5", + "possibleValues": [ + "INFO", + "MINOR", + "MAJOR", + "CRITICAL", + "BLOCKER" + ] + }, + { + "key": "template_key", + "description": "Key of the template rule to filter on. Used to search for the custom rules based on this template.", + "required": false, + "internal": false, + "exampleValue": "java:S001" + }, + { + "key": "types", + "description": "Comma-separated list of types. Returned rules match any of the tags (OR operator)", + "since": "5.5", + "required": false, + "internal": false, + "exampleValue": "BUG", + "possibleValues": [ + "CODE_SMELL", + "BUG", + "VULNERABILITY" + ] + } + ] + }, + { + "key": "add_group", + "description": "Allow a group to edit a Quality Profile.<br>Requires one of the following permissions:<ul> <li>'Administer Quality Profiles'</li> <li>Edit right on the specified quality profile</li></ul>", + "since": "6.6", + "internal": true, + "post": true, + "hasResponseExample": false, + "changelog": [], + "params": [ + { + "key": "group", + "description": "Group name", + "required": true, + "internal": false, + "exampleValue": "sonar-administrators" + }, + { + "key": "language", + "description": "Quality profile language", + "required": true, + "internal": false + }, + { + "key": "organization", + "description": "Organization key. If no organization is provided, the default organization is used.", + "required": false, + "internal": true, + "exampleValue": "my-org" + }, + { + "key": "qualityProfile", + "description": "Quality Profile name", + "required": true, + "internal": false, + "exampleValue": "Recommended quality profile" + } + ] + }, + { + "key": "add_project", + "description": "Associate a project with a quality profile.<br> Requires one of the following permissions:<ul> <li>'Administer Quality Profiles'</li> <li>Edit right on the specified quality profile</li> <li>Administer right on the specified project</li></ul>", + "since": "5.2", + "internal": false, + "post": true, + "hasResponseExample": false, + "changelog": [], + "params": [ + { + "key": "key", + "description": "Quality profile key", + "required": false, + "internal": false, + "exampleValue": "AU-Tpxb--iU5OvuD2FLy", + "deprecatedSince": "6.6", + "deprecatedKey": "profileKey", + "deprecatedKeySince": "6.5" + }, + { + "key": "language", + "description": "Quality profile language. If this parameter is set, 'key' must not be set and 'language' must be set to disambiguate.", + "required": false, + "internal": false + }, + { + "key": "organization", + "description": "Organization key. If no organization is provided, the default organization is used.", + "since": "6.4", + "required": false, + "internal": true, + "exampleValue": "my-org" + }, + { + "key": "project", + "description": "Project key", + "required": false, + "internal": false, + "exampleValue": "my_project", + "deprecatedKey": "projectKey", + "deprecatedKeySince": "6.5" + }, + { + "key": "projectUuid", + "description": "Project ID. Either this parameter or 'project' must be set.", + "required": false, + "internal": false, + "exampleValue": "AU-TpxcA-iU5OvuD2FL5", + "deprecatedSince": "6.5" + }, + { + "key": "qualityProfile", + "description": "Quality profile name. If this parameter is set, 'key' must not be set and 'language' must be set to disambiguate.", + "required": false, + "internal": false, + "exampleValue": "Sonar way", + "deprecatedKey": "profileName", + "deprecatedKeySince": "6.6" + } + ] + }, + { + "key": "add_user", + "description": "Allow a user to edit a Quality Profile.<br>Requires one of the following permissions:<ul> <li>'Administer Quality Profiles'</li> <li>Edit right on the specified quality profile</li></ul>", + "since": "6.6", + "internal": true, + "post": true, + "hasResponseExample": false, + "changelog": [], + "params": [ + { + "key": "language", + "description": "Quality profile language", + "required": true, + "internal": false + }, + { + "key": "login", + "description": "User login", + "required": true, + "internal": false, + "exampleValue": "john.doe" + }, + { + "key": "organization", + "description": "Organization key. If no organization is provided, the default organization is used.", + "required": false, + "internal": true, + "exampleValue": "my-org" + }, + { + "key": "qualityProfile", + "description": "Quality Profile name", + "required": true, + "internal": false, + "exampleValue": "Recommended quality profile" + } + ] + }, + { + "key": "backup", + "description": "Backup a quality profile in XML form. The exported profile can be restored through api/qualityprofiles/restore.", + "since": "5.2", + "internal": false, + "post": false, + "hasResponseExample": true, + "changelog": [], + "params": [ + { + "key": "key", + "description": "Quality profile key", + "required": false, + "internal": false, + "exampleValue": "AU-Tpxb--iU5OvuD2FLy", + "deprecatedSince": "6.6", + "deprecatedKey": "profileKey", + "deprecatedKeySince": "6.5" + }, + { + "key": "language", + "description": "Quality profile language. If this parameter is set, 'key' must not be set and 'language' must be set to disambiguate.", + "required": false, + "internal": false + }, + { + "key": "organization", + "description": "Organization key. If no organization is provided, the default organization is used.", + "since": "6.4", + "required": false, + "internal": true, + "exampleValue": "my-org" + }, + { + "key": "qualityProfile", + "description": "Quality profile name. If this parameter is set, 'key' must not be set and 'language' must be set to disambiguate.", + "required": false, + "internal": false, + "exampleValue": "Sonar way", + "deprecatedKey": "profileName", + "deprecatedKeySince": "6.6" + } + ] + }, + { + "key": "change_parent", + "description": "Change a quality profile's parent.<br>Requires one of the following permissions:<ul> <li>'Administer Quality Profiles'</li> <li>Edit right on the specified quality profile</li></ul>", + "since": "5.2", + "internal": false, + "post": true, + "hasResponseExample": false, + "changelog": [], + "params": [ + { + "key": "key", + "description": "Quality profile key", + "required": false, + "internal": false, + "exampleValue": "AU-Tpxb--iU5OvuD2FLy", + "deprecatedSince": "6.6", + "deprecatedKey": "profileKey", + "deprecatedKeySince": "6.5" + }, + { + "key": "language", + "description": "Quality profile language. If this parameter is set, 'key' must not be set and 'language' must be set to disambiguate.", + "required": false, + "internal": false + }, + { + "key": "organization", + "description": "Organization key. If no organization is provided, the default organization is used.", + "since": "6.4", + "required": false, + "internal": true, + "exampleValue": "my-org" + }, + { + "key": "parentKey", + "description": "New parent profile key.<br> If no profile is provided, the inheritance link with current parent profile (if any) is broken, which deactivates all rules which come from the parent and are not overridden.", + "required": false, + "internal": false, + "exampleValue": "AU-TpxcA-iU5OvuD2FLz", + "deprecatedSince": "6.6" + }, + { + "key": "parentQualityProfile", + "description": "Quality profile name. If this parameter is set, 'parentKey' must not be set and 'language' must be set to disambiguate.", + "required": false, + "internal": false, + "exampleValue": "Sonar way" + }, + { + "key": "qualityProfile", + "description": "Quality profile name. If this parameter is set, 'key' must not be set and 'language' must be set to disambiguate.", + "required": false, + "internal": false, + "exampleValue": "Sonar way", + "deprecatedKey": "profileName", + "deprecatedKeySince": "6.6" + } + ] + }, + { + "key": "changelog", + "description": "Get the history of changes on a quality profile: rule activation/deactivation, change in parameters/severity. Events are ordered by date in descending order (most recent first).", + "since": "5.2", + "internal": false, + "post": false, + "hasResponseExample": true, + "changelog": [], + "params": [ + { + "key": "key", + "description": "Quality profile key", + "required": false, + "internal": false, + "exampleValue": "AU-Tpxb--iU5OvuD2FLy", + "deprecatedSince": "6.6", + "deprecatedKey": "profileKey", + "deprecatedKeySince": "6.5" + }, + { + "key": "language", + "description": "Quality profile language. If this parameter is set, 'key' must not be set and 'language' must be set to disambiguate.", + "required": false, + "internal": false + }, + { + "key": "organization", + "description": "Organization key. If no organization is provided, the default organization is used.", + "since": "6.4", + "required": false, + "internal": true, + "exampleValue": "my-org" + }, + { + "key": "p", + "description": "1-based page number", + "required": false, + "internal": false, + "defaultValue": "1", + "exampleValue": "42", + "deprecatedKey": "pageIndex", + "deprecatedKeySince": "5.2" + }, + { + "key": "ps", + "description": "Page size. Must be greater than 0 and less than 500", + "required": false, + "internal": false, + "defaultValue": "50", + "exampleValue": "20", + "deprecatedKey": "pageSize", + "deprecatedKeySince": "5.2", + "maximumValue": 500 + }, + { + "key": "qualityProfile", + "description": "Quality profile name. If this parameter is set, 'key' must not be set and 'language' must be set to disambiguate.", + "required": false, + "internal": false, + "exampleValue": "Sonar way", + "deprecatedKey": "profileName", + "deprecatedKeySince": "6.6" + }, + { + "key": "since", + "description": "Start date for the changelog. <br>Either a date (server timezone) or datetime can be provided.", + "required": false, + "internal": false, + "exampleValue": "2017-10-19 or 2017-10-19T13:00:00+0200" + }, + { + "key": "to", + "description": "End date for the changelog. <br>Either a date (server timezone) or datetime can be provided.", + "required": false, + "internal": false, + "exampleValue": "2017-10-19 or 2017-10-19T13:00:00+0200" + } + ] + }, + { + "key": "compare", + "description": "Compare two quality profiles.", + "since": "5.2", + "internal": true, + "post": false, + "hasResponseExample": true, + "changelog": [], + "params": [ + { + "key": "leftKey", + "description": "Profile key.", + "required": true, + "internal": false, + "exampleValue": "AU-Tpxb--iU5OvuD2FLy" + }, + { + "key": "rightKey", + "description": "Another profile key.", + "required": true, + "internal": false, + "exampleValue": "AU-TpxcA-iU5OvuD2FLz" + } + ] + }, + { + "key": "copy", + "description": "Copy a quality profile.<br> Requires to be logged in and the 'Administer Quality Profiles' permission.", + "since": "5.2", + "internal": false, + "post": true, + "hasResponseExample": false, + "changelog": [], + "params": [ + { + "key": "fromKey", + "description": "Quality profile key", + "required": true, + "internal": false, + "exampleValue": "AU-Tpxb--iU5OvuD2FLy" + }, + { + "key": "toName", + "description": "Name for the new quality profile.", + "required": true, + "internal": false, + "exampleValue": "My Sonar way" + } + ] + }, + { + "key": "create", + "description": "Create a quality profile.<br>Requires to be logged in and the 'Administer Quality Profiles' permission.", + "since": "5.2", + "internal": false, + "post": true, + "hasResponseExample": true, + "changelog": [], + "params": [ + { + "key": "language", + "description": "Quality profile language", + "required": true, + "internal": false, + "exampleValue": "js" + }, + { + "key": "name", + "description": "Quality profile name", + "required": true, + "internal": false, + "exampleValue": "My Sonar way", + "deprecatedKey": "profileName", + "deprecatedKeySince": "6.6", + "maximumLength": 100 + }, + { + "key": "organization", + "description": "Organization key. If no organization is provided, the default organization is used.", + "since": "6.4", + "required": false, + "internal": true, + "exampleValue": "my-org" + } + ] + }, + { + "key": "deactivate_rule", + "description": "Deactivate a rule on a quality profile.<br> Requires one of the following permissions:<ul> <li>'Administer Quality Profiles'</li> <li>Edit right on the specified quality profile</li></ul>", + "since": "4.4", + "internal": false, + "post": true, + "hasResponseExample": false, + "changelog": [], + "params": [ + { + "key": "key", + "description": "Quality Profile key. Can be obtained through <code>api/qualityprofiles/search</code>", + "required": true, + "internal": false, + "exampleValue": "AU-Tpxb--iU5OvuD2FLy", + "deprecatedKey": "profile_key", + "deprecatedKeySince": "6.5" + }, + { + "key": "rule", + "description": "Rule key", + "required": true, + "internal": false, + "exampleValue": "squid:AvoidCycles", + "deprecatedKey": "rule_key", + "deprecatedKeySince": "6.5" + } + ] + }, + { + "key": "deactivate_rules", + "description": "Bulk deactivate rules on Quality profiles.<br>Requires one of the following permissions:<ul> <li>'Administer Quality Profiles'</li> <li>Edit right on the specified quality profile</li></ul>", + "since": "4.4", + "internal": false, + "post": true, + "hasResponseExample": false, + "changelog": [], + "params": [ + { + "key": "activation", + "description": "Filter rules that are activated or deactivated on the selected Quality profile. Ignored if the parameter 'qprofile' is not set.", + "required": false, + "internal": false, + "possibleValues": [ + "true", + "false", + "yes", + "no" + ] + }, + { + "key": "active_severities", + "description": "Comma-separated list of activation severities, i.e the severity of rules in Quality profiles.", + "required": false, + "internal": false, + "exampleValue": "CRITICAL,BLOCKER", + "possibleValues": [ + "INFO", + "MINOR", + "MAJOR", + "CRITICAL", + "BLOCKER" + ] + }, + { + "key": "asc", + "description": "Ascending sort", + "required": false, + "internal": false, + "defaultValue": "true", + "possibleValues": [ + "true", + "false", + "yes", + "no" + ] + }, + { + "key": "available_since", + "description": "Filters rules added since date. Format is yyyy-MM-dd", + "required": false, + "internal": false, + "exampleValue": "2014-06-22" + }, + { + "key": "compareToProfile", + "description": "Quality profile key to filter rules that are activated. Meant to compare easily to profile set in 'qprofile'", + "since": "6.5", + "required": false, + "internal": true, + "exampleValue": "AU-TpxcA-iU5OvuD2FLz" + }, + { + "key": "inheritance", + "description": "Comma-separated list of values of inheritance for a rule within a quality profile. Used only if the parameter 'activation' is set.", + "required": false, + "internal": false, + "exampleValue": "INHERITED,OVERRIDES", + "possibleValues": [ + "NONE", + "INHERITED", + "OVERRIDES" + ] + }, + { + "key": "is_template", + "description": "Filter template rules", + "required": false, + "internal": false, + "possibleValues": [ + "true", + "false", + "yes", + "no" + ] + }, + { + "key": "languages", + "description": "Comma-separated list of languages", + "required": false, + "internal": false, + "exampleValue": "java,js" + }, + { + "key": "organization", + "description": "Organization key", + "since": "6.4", + "required": false, + "internal": true, + "exampleValue": "my-org" + }, + { + "key": "q", + "description": "UTF-8 search query", + "required": false, + "internal": false, + "exampleValue": "xpath" + }, + { + "key": "qprofile", + "description": "Quality profile key to filter on. Used only if the parameter 'activation' is set.", + "required": false, + "internal": false, + "exampleValue": "AU-Tpxb--iU5OvuD2FLy" + }, + { + "key": "repositories", + "description": "Comma-separated list of repositories", + "required": false, + "internal": false, + "exampleValue": "checkstyle,findbugs" + }, + { + "key": "rule_key", + "description": "Key of rule to search for", + "required": false, + "internal": false, + "exampleValue": "squid:S001" + }, + { + "key": "s", + "description": "Sort field", + "required": false, + "internal": false, + "exampleValue": "name", + "possibleValues": [ + "name", + "updatedAt", + "createdAt", + "key" + ] + }, + { + "key": "severities", + "description": "Comma-separated list of default severities. Not the same than severity of rules in Quality profiles.", + "required": false, + "internal": false, + "exampleValue": "CRITICAL,BLOCKER", + "possibleValues": [ + "INFO", + "MINOR", + "MAJOR", + "CRITICAL", + "BLOCKER" + ] + }, + { + "key": "statuses", + "description": "Comma-separated list of status codes", + "required": false, + "internal": false, + "exampleValue": "READY", + "possibleValues": [ + "BETA", + "DEPRECATED", + "READY", + "REMOVED" + ] + }, + { + "key": "tags", + "description": "Comma-separated list of tags. Returned rules match any of the tags (OR operator)", + "required": false, + "internal": false, + "exampleValue": "security,java8" + }, + { + "key": "targetKey", + "description": "Quality Profile key on which the rule deactivation is done. To retrieve a profile key please see <code>api/qualityprofiles/search</code>", + "required": true, + "internal": false, + "exampleValue": "AU-TpxcA-iU5OvuD2FL1", + "deprecatedKey": "profile_key", + "deprecatedKeySince": "6.5" + }, + { + "key": "template_key", + "description": "Key of the template rule to filter on. Used to search for the custom rules based on this template.", + "required": false, + "internal": false, + "exampleValue": "java:S001" + }, + { + "key": "types", + "description": "Comma-separated list of types. Returned rules match any of the tags (OR operator)", + "since": "5.5", + "required": false, + "internal": false, + "exampleValue": "BUG", + "possibleValues": [ + "CODE_SMELL", + "BUG", + "VULNERABILITY" + ] + } + ] + }, + { + "key": "delete", + "description": "Delete a quality profile and all its descendants. The default quality profile cannot be deleted.<br> Requires one of the following permissions:<ul> <li>'Administer Quality Profiles'</li> <li>Edit right on the specified quality profile</li></ul>", + "since": "5.2", + "internal": false, + "post": true, + "hasResponseExample": false, + "changelog": [], + "params": [ + { + "key": "key", + "description": "Quality profile key", + "required": false, + "internal": false, + "exampleValue": "AU-Tpxb--iU5OvuD2FLy", + "deprecatedSince": "6.6", + "deprecatedKey": "profileKey", + "deprecatedKeySince": "6.5" + }, + { + "key": "language", + "description": "Quality profile language. If this parameter is set, 'key' must not be set and 'language' must be set to disambiguate.", + "required": false, + "internal": false + }, + { + "key": "organization", + "description": "Organization key. If no organization is provided, the default organization is used.", + "since": "6.4", + "required": false, + "internal": true, + "exampleValue": "my-org" + }, + { + "key": "qualityProfile", + "description": "Quality profile name. If this parameter is set, 'key' must not be set and 'language' must be set to disambiguate.", + "required": false, + "internal": false, + "exampleValue": "Sonar way", + "deprecatedKey": "profileName", + "deprecatedKeySince": "6.6" + } + ] + }, + { + "key": "export", + "description": "Export a quality profile.", + "since": "5.2", + "internal": false, + "post": false, + "hasResponseExample": true, + "changelog": [], + "params": [ + { + "key": "key", + "description": "Quality profile key", + "since": "6.5", + "required": false, + "internal": false, + "exampleValue": "AU-Tpxb--iU5OvuD2FLy", + "deprecatedSince": "6.6" + }, + { + "key": "language", + "description": "Quality profile language. If this parameter is set, 'key' must not be set.", + "required": false, + "internal": false, + "exampleValue": "" + }, + { + "key": "organization", + "description": "Organization key. If no organization is provided, the default organization is used.", + "since": "6.4", + "required": false, + "internal": true, + "exampleValue": "my-org" + }, + { + "key": "qualityProfile", + "description": "Quality profile name to export. If left empty, the default profile for the language is exported. If this parameter is set, 'key' must not be set.", + "required": false, + "internal": false, + "exampleValue": "My Sonar way", + "deprecatedKey": "profileName", + "deprecatedKeySince": "6.6" + } + ] + }, + { + "key": "exporters", + "description": "Lists available profile export formats.", + "since": "5.2", + "internal": false, + "post": false, + "hasResponseExample": true, + "changelog": [] + }, + { + "key": "importers", + "description": "List supported importers.", + "since": "5.2", + "internal": false, + "post": false, + "hasResponseExample": true, + "changelog": [] + }, + { + "key": "inheritance", + "description": "Show a quality profile's ancestors and children.", + "since": "5.2", + "internal": false, + "post": false, + "hasResponseExample": true, + "changelog": [], + "params": [ + { + "key": "key", + "description": "Quality profile key", + "required": false, + "internal": false, + "exampleValue": "AU-Tpxb--iU5OvuD2FLy", + "deprecatedSince": "6.6", + "deprecatedKey": "profileKey", + "deprecatedKeySince": "6.5" + }, + { + "key": "language", + "description": "Quality profile language. If this parameter is set, 'key' must not be set and 'language' must be set to disambiguate.", + "required": false, + "internal": false + }, + { + "key": "organization", + "description": "Organization key. If no organization is provided, the default organization is used.", + "since": "6.4", + "required": false, + "internal": true, + "exampleValue": "my-org" + }, + { + "key": "qualityProfile", + "description": "Quality profile name. If this parameter is set, 'key' must not be set and 'language' must be set to disambiguate.", + "required": false, + "internal": false, + "exampleValue": "Sonar way", + "deprecatedKey": "profileName", + "deprecatedKeySince": "6.6" + } + ] + }, + { + "key": "projects", + "description": "List projects with their association status regarding a quality profile", + "since": "5.2", + "internal": false, + "post": false, + "hasResponseExample": true, + "changelog": [ + { + "description": "'id' response field is deprecated", + "version": "6.5" + }, + { + "description": "'uuid' response field is deprecated and replaced by 'id'", + "version": "6.0" + }, + { + "description": "'key' response field has been added to return the project key", + "version": "6.0" + } + ], + "params": [ + { + "key": "key", + "description": "Quality profile key", + "required": true, + "internal": false, + "exampleValue": "AU-Tpxb--iU5OvuD2FLy" + }, + { + "key": "p", + "description": "1-based page number", + "required": false, + "internal": false, + "defaultValue": "1", + "exampleValue": "42", + "deprecatedKey": "page", + "deprecatedKeySince": "6.5" + }, + { + "key": "ps", + "description": "Page size. Must be greater than 0 and less than 500", + "required": false, + "internal": false, + "defaultValue": "100", + "exampleValue": "20", + "deprecatedKey": "pageSize", + "deprecatedKeySince": "5.2", + "maximumValue": 500 + }, + { + "key": "q", + "description": "Limit search to projects that contain the supplied string.", + "required": false, + "internal": false, + "exampleValue": "sonar", + "deprecatedKey": "query", + "deprecatedKeySince": "6.5" + }, + { + "key": "selected", + "description": "Depending on the value, show only selected items (selected=selected), deselected items (selected=deselected), or all items with their selection status (selected=all).", + "required": false, + "internal": false, + "defaultValue": "selected", + "possibleValues": [ + "all", + "deselected", + "selected" + ] + } + ] + }, + { + "key": "remove_group", + "description": "Remove the ability from a group to edit a Quality Profile.<br>Requires one of the following permissions:<ul> <li>'Administer Quality Profiles'</li> <li>Edit right on the specified quality profile</li></ul>", + "since": "6.6", + "internal": true, + "post": true, + "hasResponseExample": false, + "changelog": [], + "params": [ + { + "key": "group", + "description": "Group name", + "required": true, + "internal": false, + "exampleValue": "sonar-administrators" + }, + { + "key": "language", + "description": "Quality profile language", + "required": true, + "internal": false + }, + { + "key": "organization", + "description": "Organization key. If no organization is provided, the default organization is used.", + "required": false, + "internal": true, + "exampleValue": "my-org" + }, + { + "key": "qualityProfile", + "description": "Quality Profile name", + "required": true, + "internal": false, + "exampleValue": "Recommended quality profile" + } + ] + }, + { + "key": "remove_project", + "description": "Remove a project's association with a quality profile.<br> Requires one of the following permissions:<ul> <li>'Administer Quality Profiles'</li> <li>Edit right on the specified quality profile</li> <li>Administer right on the specified project</li></ul>", + "since": "5.2", + "internal": false, + "post": true, + "hasResponseExample": false, + "changelog": [], + "params": [ + { + "key": "key", + "description": "Quality profile key", + "required": false, + "internal": false, + "exampleValue": "AU-Tpxb--iU5OvuD2FLy", + "deprecatedSince": "6.6", + "deprecatedKey": "profileKey", + "deprecatedKeySince": "6.5" + }, + { + "key": "language", + "description": "Quality profile language. If this parameter is set, 'key' must not be set and 'language' must be set to disambiguate.", + "required": false, + "internal": false + }, + { + "key": "organization", + "description": "Organization key. If no organization is provided, the default organization is used.", + "since": "6.4", + "required": false, + "internal": true, + "exampleValue": "my-org" + }, + { + "key": "project", + "description": "Project key", + "required": false, + "internal": false, + "exampleValue": "my_project", + "deprecatedKey": "projectKey", + "deprecatedKeySince": "6.5" + }, + { + "key": "projectUuid", + "description": "Project ID. Either this parameter, or 'project' must be set.", + "required": false, + "internal": false, + "exampleValue": "AU-TpxcB-iU5OvuD2FL6", + "deprecatedSince": "6.5" + }, + { + "key": "qualityProfile", + "description": "Quality profile name. If this parameter is set, 'key' must not be set and 'language' must be set to disambiguate.", + "required": false, + "internal": false, + "exampleValue": "Sonar way", + "deprecatedKey": "profileName", + "deprecatedKeySince": "6.6" + } + ] + }, + { + "key": "remove_user", + "description": "Remove the ability from a user to edit a Quality Profile.<br>Requires one of the following permissions:<ul> <li>'Administer Quality Profiles'</li> <li>Edit right on the specified quality profile</li></ul>", + "since": "6.6", + "internal": true, + "post": true, + "hasResponseExample": false, + "changelog": [], + "params": [ + { + "key": "language", + "description": "Quality profile language", + "required": true, + "internal": false + }, + { + "key": "login", + "description": "User login", + "required": true, + "internal": false, + "exampleValue": "john.doe" + }, + { + "key": "organization", + "description": "Organization key. If no organization is provided, the default organization is used.", + "required": false, + "internal": true, + "exampleValue": "my-org" + }, + { + "key": "qualityProfile", + "description": "Quality Profile name", + "required": true, + "internal": false, + "exampleValue": "Recommended quality profile" + } + ] + }, + { + "key": "rename", + "description": "Rename a quality profile.<br> Requires one of the following permissions:<ul> <li>'Administer Quality Profiles'</li> <li>Edit right on the specified quality profile</li></ul>", + "since": "5.2", + "internal": false, + "post": true, + "hasResponseExample": false, + "changelog": [], + "params": [ + { + "key": "key", + "description": "Quality profile key", + "required": true, + "internal": false, + "exampleValue": "AU-Tpxb--iU5OvuD2FLy" + }, + { + "key": "name", + "description": "New quality profile name", + "required": true, + "internal": false, + "exampleValue": "My Sonar way", + "maximumLength": 100 + } + ] + }, + { + "key": "restore", + "description": "Restore a quality profile using an XML file. The restored profile name is taken from the backup file, so if a profile with the same name and language already exists, it will be overwritten.<br> Requires to be logged in and the 'Administer Quality Profiles' permission.", + "since": "5.2", + "internal": false, + "post": true, + "hasResponseExample": false, + "changelog": [], + "params": [ + { + "key": "backup", + "description": "A profile backup file in XML format, as generated by api/qualityprofiles/backup or the former api/profiles/backup.", + "required": true, + "internal": false + }, + { + "key": "organization", + "description": "Organization key. If no organization is provided, the default organization is used.", + "since": "6.4", + "required": false, + "internal": true, + "exampleValue": "my-org" + } + ] + }, + { + "key": "restore_built_in", + "description": "This web service has no effect since 6.4. It's no more possible to restore built-in quality profiles because they are automatically updated and read only. Returns HTTP code 410.", + "since": "4.4", + "deprecatedSince": "6.4", + "internal": false, + "post": true, + "hasResponseExample": false, + "changelog": [] + }, + { + "key": "search", + "description": "Search quality profiles", + "since": "5.2", + "internal": false, + "post": false, + "hasResponseExample": true, + "changelog": [ + { + "description": "The parameters 'defaults', 'project' and 'language' can be combined without any constraint", + "version": "6.5" + } + ], + "params": [ + { + "key": "defaults", + "description": "If set to true, return only the quality profiles marked as default for each language", + "required": false, + "internal": false, + "defaultValue": "false", + "possibleValues": [ + "true", + "false", + "yes", + "no" + ] + }, + { + "key": "language", + "description": "Language key. If provided, only profiles for the given language are returned.", + "required": false, + "internal": false + }, + { + "key": "organization", + "description": "Organization key. If no organization is provided, the default organization is used.", + "since": "6.4", + "required": false, + "internal": true, + "exampleValue": "my-org" + }, + { + "key": "project", + "description": "Project key", + "required": false, + "internal": false, + "exampleValue": "my_project", + "deprecatedKey": "projectKey", + "deprecatedKeySince": "6.5" + }, + { + "key": "qualityProfile", + "description": "Quality profile name", + "required": false, + "internal": false, + "exampleValue": "SonarQube Way", + "deprecatedKey": "profileName", + "deprecatedKeySince": "6.6" + } + ] + }, + { + "key": "search_groups", + "description": "List the groups that are allowed to edit a Quality Profile.<br>Requires one of the following permissions:<ul> <li>'Administer Quality Profiles'</li> <li>Edit right on the specified quality profile</li></ul>", + "since": "6.6", + "internal": true, + "post": false, + "hasResponseExample": true, + "changelog": [], + "params": [ + { + "key": "language", + "description": "Quality profile language", + "required": true, + "internal": false + }, + { + "key": "organization", + "description": "Organization key. If no organization is provided, the default organization is used.", + "required": false, + "internal": true, + "exampleValue": "my-org" + }, + { + "key": "p", + "description": "1-based page number", + "required": false, + "internal": false, + "defaultValue": "1", + "exampleValue": "42", + "deprecatedKey": "pageIndex", + "deprecatedKeySince": "5.2" + }, + { + "key": "ps", + "description": "Page size. Must be greater than 0.", + "required": false, + "internal": false, + "defaultValue": "25", + "exampleValue": "20", + "deprecatedKey": "pageSize", + "deprecatedKeySince": "5.2" + }, + { + "key": "q", + "description": "Limit search to group names that contain the supplied string.", + "required": false, + "internal": false, + "exampleValue": "sonar" + }, + { + "key": "qualityProfile", + "description": "Quality Profile name", + "required": true, + "internal": false, + "exampleValue": "Recommended quality profile" + }, + { + "key": "selected", + "description": "Depending on the value, show only selected items (selected=selected), deselected items (selected=deselected), or all items with their selection status (selected=all).", + "required": false, + "internal": false, + "defaultValue": "selected", + "possibleValues": [ + "all", + "deselected", + "selected" + ] + } + ] + }, + { + "key": "search_users", + "description": "List the users that are allowed to edit a Quality Profile.<br>Requires one of the following permissions:<ul> <li>'Administer Quality Profiles'</li> <li>Edit right on the specified quality profile</li></ul>", + "since": "6.6", + "internal": true, + "post": false, + "hasResponseExample": true, + "changelog": [], + "params": [ + { + "key": "language", + "description": "Quality profile language", + "required": true, + "internal": false + }, + { + "key": "organization", + "description": "Organization key. If no organization is provided, the default organization is used.", + "required": false, + "internal": true, + "exampleValue": "my-org" + }, + { + "key": "p", + "description": "1-based page number", + "required": false, + "internal": false, + "defaultValue": "1", + "exampleValue": "42", + "deprecatedKey": "pageIndex", + "deprecatedKeySince": "5.2" + }, + { + "key": "ps", + "description": "Page size. Must be greater than 0.", + "required": false, + "internal": false, + "defaultValue": "25", + "exampleValue": "20", + "deprecatedKey": "pageSize", + "deprecatedKeySince": "5.2" + }, + { + "key": "q", + "description": "Limit search to names or logins that contain the supplied string.", + "required": false, + "internal": false, + "exampleValue": "freddy" + }, + { + "key": "qualityProfile", + "description": "Quality Profile name", + "required": true, + "internal": false, + "exampleValue": "Recommended quality profile" + }, + { + "key": "selected", + "description": "Depending on the value, show only selected items (selected=selected), deselected items (selected=deselected), or all items with their selection status (selected=all).", + "required": false, + "internal": false, + "defaultValue": "selected", + "possibleValues": [ + "all", + "deselected", + "selected" + ] + } + ] + }, + { + "key": "set_default", + "description": "Select the default profile for a given language.<br> Requires to be logged in and the 'Administer Quality Profiles' permission.", + "since": "5.2", + "internal": false, + "post": true, + "hasResponseExample": false, + "changelog": [], + "params": [ + { + "key": "key", + "description": "Quality profile key", + "required": false, + "internal": false, + "exampleValue": "AU-Tpxb--iU5OvuD2FLy", + "deprecatedSince": "6.6", + "deprecatedKey": "profileKey", + "deprecatedKeySince": "6.5" + }, + { + "key": "language", + "description": "Quality profile language. If this parameter is set, 'key' must not be set and 'language' must be set to disambiguate.", + "required": false, + "internal": false + }, + { + "key": "organization", + "description": "Organization key. If no organization is provided, the default organization is used.", + "since": "6.4", + "required": false, + "internal": true, + "exampleValue": "my-org" + }, + { + "key": "qualityProfile", + "description": "Quality profile name. If this parameter is set, 'key' must not be set and 'language' must be set to disambiguate.", + "required": false, + "internal": false, + "exampleValue": "Sonar way", + "deprecatedKey": "profileName", + "deprecatedKeySince": "6.6" + } + ] + }, + { + "key": "show", + "description": "Show a quality profile", + "since": "6.5", + "internal": true, + "post": false, + "hasResponseExample": true, + "changelog": [], + "params": [ + { + "key": "compareToSonarWay", + "description": "Add the number of missing rules from the related Sonar way profile in the response", + "required": false, + "internal": true, + "defaultValue": "false", + "possibleValues": [ + "true", + "false", + "yes", + "no" + ] + }, + { + "key": "key", + "description": "Quality profile key", + "required": true, + "internal": false, + "exampleValue": "AU-Tpxb--iU5OvuD2FLy", + "deprecatedKey": "profile", + "deprecatedKeySince": "6.6" + } + ] + } + ] + }, + { + "path": "api/resources", + "since": "2.10", + "description": "Removed since 6.3, please use api/components and api/measures instead", + "actions": [ + { + "key": "index", + "description": "The web service is removed and you're invited to use the alternatives: <ul><li>if you need one component without measures: api/components/show</li><li>if you need one component with measures: api/measures/component</li><li>if you need several components without measures: api/components/tree</li><li>if you need several components with measures: api/measures/component_tree</li></ul>", + "since": "2.10", + "deprecatedSince": "5.4", + "internal": false, + "post": false, + "hasResponseExample": true, + "changelog": [] + } + ] + }, + { + "path": "api/roots", + "since": "6.2", + "description": "Manage root users", + "actions": [ + { + "key": "search", + "description": "Search for root users.<br/>Requires to be root.", + "since": "6.2", + "internal": true, + "post": false, + "hasResponseExample": true, + "changelog": [] + }, + { + "key": "set_root", + "description": "Make the specified user root.<br/>Requires to be root.", + "since": "6.2", + "internal": true, + "post": true, + "hasResponseExample": false, + "changelog": [], + "params": [ + { + "key": "login", + "description": "A user login", + "since": "6.2", + "required": true, + "internal": false, + "exampleValue": "admin" + } + ] + }, + { + "key": "unset_root", + "description": "Make the specified user not root.<br/>Requires to be root.", + "since": "6.2", + "internal": true, + "post": true, + "hasResponseExample": false, + "changelog": [], + "params": [ + { + "key": "login", + "description": "A user login", + "since": "6.2", + "required": true, + "internal": false, + "exampleValue": "admin" + } + ] + } + ] + }, + { + "path": "api/rules", + "description": "Get and update some details of automatic rules, and manage custom rules.", + "actions": [ + { + "key": "app", + "description": "Get data required for rendering the page 'Coding Rules'.", + "since": "4.5", + "internal": true, + "post": false, + "hasResponseExample": true, + "changelog": [], + "params": [ + { + "key": "organization", + "description": "Organization key", + "since": "6.4", + "required": false, + "internal": true, + "exampleValue": "my-org" + } + ] + }, + { + "key": "create", + "description": "Create a custom rule.<br>Requires the 'Administer Quality Profiles' permission", + "since": "4.4", + "internal": false, + "post": true, + "hasResponseExample": false, + "changelog": [ + { + "description": "Creating manual rule is not more possible", + "version": "5.5" + } + ], + "params": [ + { + "key": "custom_key", + "description": "Key of the custom rule", + "required": true, + "internal": false, + "exampleValue": "Todo_should_not_be_used", + "maximumLength": 200 + }, + { + "key": "manual_key", + "description": "Manual rules are no more supported. This parameter is ignored", + "required": false, + "internal": false, + "exampleValue": "Error_handling", + "deprecatedSince": "5.5" + }, + { + "key": "markdown_description", + "description": "Rule description", + "required": true, + "internal": false, + "exampleValue": "Description of my custom rule" + }, + { + "key": "name", + "description": "Rule name", + "required": true, + "internal": false, + "exampleValue": "My custom rule", + "maximumLength": 200 + }, + { + "key": "params", + "description": "Parameters as semi-colon list of <key>=<value>, for example 'params=key1=v1;key2=v2' (Only for custom rule)", + "required": false, + "internal": false + }, + { + "key": "prevent_reactivation", + "description": "If set to true and if the rule has been deactivated (status 'REMOVED'), a status 409 will be returned", + "required": false, + "internal": false, + "defaultValue": "false", + "possibleValues": [ + "true", + "false", + "yes", + "no" + ] + }, + { + "key": "severity", + "description": "Rule severity", + "required": false, + "internal": false, + "possibleValues": [ + "INFO", + "MINOR", + "MAJOR", + "CRITICAL", + "BLOCKER" + ] + }, + { + "key": "status", + "description": "Rule status", + "required": false, + "internal": false, + "defaultValue": "READY", + "possibleValues": [ + "BETA", + "DEPRECATED", + "READY", + "REMOVED" + ] + }, + { + "key": "template_key", + "description": "Key of the template rule in order to create a custom rule (mandatory for custom rule)", + "required": false, + "internal": false, + "exampleValue": "java:XPath" + }, + { + "key": "type", + "description": "Rule type", + "since": "6.7", + "required": false, + "internal": false, + "possibleValues": [ + "CODE_SMELL", + "BUG", + "VULNERABILITY" + ] + } + ] + }, + { + "key": "delete", + "description": "Delete custom rule.<br/>Requires the 'Administer Quality Profiles' permission", + "since": "4.4", + "internal": false, + "post": true, + "hasResponseExample": false, + "changelog": [], + "params": [ + { + "key": "key", + "description": "Rule key", + "required": true, + "internal": false, + "exampleValue": "squid:XPath_1402065390816" + } + ] + }, + { + "key": "list", + "description": "List rules, excluding the manual rules and the rules with status REMOVED. JSON format is not supported for response.", + "since": "5.2", + "internal": true, + "post": false, + "hasResponseExample": true, + "changelog": [] + }, + { + "key": "repositories", + "description": "List available rule repositories", + "since": "4.5", + "internal": false, + "post": false, + "hasResponseExample": true, + "changelog": [], + "params": [ + { + "key": "language", + "description": "A language key; if provided, only repositories for the given language will be returned", + "required": false, + "internal": false, + "exampleValue": "java" + }, + { + "key": "q", + "description": "A pattern to match repository keys/names against", + "required": false, + "internal": false, + "exampleValue": "squid" + } + ] + }, + { + "key": "search", + "description": "Search for a collection of relevant rules matching a specified query.<br/>Since 5.5, following fields in the response have been deprecated :<ul><li>\"effortToFixDescription\" becomes \"gapDescription\"</li><li>\"debtRemFnCoeff\" becomes \"remFnGapMultiplier\"</li><li>\"defaultDebtRemFnCoeff\" becomes \"defaultRemFnGapMultiplier\"</li><li>\"debtRemFnOffset\" becomes \"remFnBaseEffort\"</li><li>\"defaultDebtRemFnOffset\" becomes \"defaultRemFnBaseEffort\"</li><li>\"debtOverloaded\" becomes \"remFnOverloaded\"</li></ul>", + "since": "4.4", + "internal": false, + "post": false, + "hasResponseExample": true, + "changelog": [], + "params": [ + { + "key": "activation", + "description": "Filter rules that are activated or deactivated on the selected Quality profile. Ignored if the parameter 'qprofile' is not set.", + "required": false, + "internal": false, + "possibleValues": [ + "true", + "false", + "yes", + "no" + ] + }, + { + "key": "active_severities", + "description": "Comma-separated list of activation severities, i.e the severity of rules in Quality profiles.", + "required": false, + "internal": false, + "exampleValue": "CRITICAL,BLOCKER", + "possibleValues": [ + "INFO", + "MINOR", + "MAJOR", + "CRITICAL", + "BLOCKER" + ] + }, + { + "key": "asc", + "description": "Ascending sort", + "required": false, + "internal": false, + "defaultValue": "true", + "possibleValues": [ + "true", + "false", + "yes", + "no" + ] + }, + { + "key": "available_since", + "description": "Filters rules added since date. Format is yyyy-MM-dd", + "required": false, + "internal": false, + "exampleValue": "2014-06-22" + }, + { + "key": "compareToProfile", + "description": "Quality profile key to filter rules that are activated. Meant to compare easily to profile set in 'qprofile'", + "since": "6.5", + "required": false, + "internal": true, + "exampleValue": "AU-TpxcA-iU5OvuD2FLz" + }, + { + "key": "f", + "description": "Comma-separated list of the fields to be returned in response. All the fields are returned by default, except actives.Since 5.5, following fields have been deprecated :<ul><li>\"defaultDebtRemFn\" becomes \"defaultRemFn\"</li><li>\"debtRemFn\" becomes \"remFn\"</li><li>\"effortToFixDescription\" becomes \"gapDescription\"</li><li>\"debtOverloaded\" becomes \"remFnOverloaded\"</li></ul>", + "required": false, + "internal": false, + "exampleValue": "repo,name", + "possibleValues": [ + "actives", + "createdAt", + "debtOverloaded", + "debtRemFn", + "defaultDebtRemFn", + "defaultRemFn", + "effortToFixDescription", + "gapDescription", + "htmlDesc", + "htmlNote", + "internalKey", + "isTemplate", + "lang", + "langName", + "mdDesc", + "mdNote", + "name", + "noteLogin", + "params", + "remFn", + "remFnOverloaded", + "repo", + "severity", + "status", + "sysTags", + "tags", + "templateKey" + ] + }, + { + "key": "facets", + "description": "Comma-separated list of the facets to be computed. No facet is computed by default.", + "required": false, + "internal": false, + "exampleValue": "languages,repositories", + "possibleValues": [ + "languages", + "repositories", + "tags", + "severities", + "active_severities", + "statuses", + "types", + "true" + ] + }, + { + "key": "inheritance", + "description": "Comma-separated list of values of inheritance for a rule within a quality profile. Used only if the parameter 'activation' is set.", + "required": false, + "internal": false, + "exampleValue": "INHERITED,OVERRIDES", + "possibleValues": [ + "NONE", + "INHERITED", + "OVERRIDES" + ] + }, + { + "key": "is_template", + "description": "Filter template rules", + "required": false, + "internal": false, + "possibleValues": [ + "true", + "false", + "yes", + "no" + ] + }, + { + "key": "languages", + "description": "Comma-separated list of languages", + "required": false, + "internal": false, + "exampleValue": "java,js" + }, + { + "key": "organization", + "description": "Organization key", + "since": "6.4", + "required": false, + "internal": true, + "exampleValue": "my-org" + }, + { + "key": "p", + "description": "1-based page number", + "required": false, + "internal": false, + "defaultValue": "1", + "exampleValue": "42", + "deprecatedKey": "pageIndex", + "deprecatedKeySince": "5.2" + }, + { + "key": "ps", + "description": "Page size. Must be greater than 0 and less than 500", + "required": false, + "internal": false, + "defaultValue": "100", + "exampleValue": "20", + "deprecatedKey": "pageSize", + "deprecatedKeySince": "5.2", + "maximumValue": 500 + }, + { + "key": "q", + "description": "UTF-8 search query", + "required": false, + "internal": false, + "exampleValue": "xpath" + }, + { + "key": "qprofile", + "description": "Quality profile key to filter on. Used only if the parameter 'activation' is set.", + "required": false, + "internal": false, + "exampleValue": "AU-Tpxb--iU5OvuD2FLy" + }, + { + "key": "repositories", + "description": "Comma-separated list of repositories", + "required": false, + "internal": false, + "exampleValue": "checkstyle,findbugs" + }, + { + "key": "rule_key", + "description": "Key of rule to search for", + "required": false, + "internal": false, + "exampleValue": "squid:S001" + }, + { + "key": "s", + "description": "Sort field", + "required": false, + "internal": false, + "exampleValue": "name", + "possibleValues": [ + "name", + "updatedAt", + "createdAt", + "key" + ] + }, + { + "key": "severities", + "description": "Comma-separated list of default severities. Not the same than severity of rules in Quality profiles.", + "required": false, + "internal": false, + "exampleValue": "CRITICAL,BLOCKER", + "possibleValues": [ + "INFO", + "MINOR", + "MAJOR", + "CRITICAL", + "BLOCKER" + ] + }, + { + "key": "statuses", + "description": "Comma-separated list of status codes", + "required": false, + "internal": false, + "exampleValue": "READY", + "possibleValues": [ + "BETA", + "DEPRECATED", + "READY", + "REMOVED" + ] + }, + { + "key": "tags", + "description": "Comma-separated list of tags. Returned rules match any of the tags (OR operator)", + "required": false, + "internal": false, + "exampleValue": "security,java8" + }, + { + "key": "template_key", + "description": "Key of the template rule to filter on. Used to search for the custom rules based on this template.", + "required": false, + "internal": false, + "exampleValue": "java:S001" + }, + { + "key": "types", + "description": "Comma-separated list of types. Returned rules match any of the tags (OR operator)", + "since": "5.5", + "required": false, + "internal": false, + "exampleValue": "BUG", + "possibleValues": [ + "CODE_SMELL", + "BUG", + "VULNERABILITY" + ] + } + ] + }, + { + "key": "show", + "description": "Get detailed information about a rule<br>Since 5.5, following fields in the response have been deprecated :<ul><li>\"effortToFixDescription\" becomes \"gapDescription\"</li><li>\"debtRemFnCoeff\" becomes \"remFnGapMultiplier\"</li><li>\"defaultDebtRemFnCoeff\" becomes \"defaultRemFnGapMultiplier\"</li><li>\"debtRemFnOffset\" becomes \"remFnBaseEffort\"</li><li>\"defaultDebtRemFnOffset\" becomes \"defaultRemFnBaseEffort\"</li><li>\"debtOverloaded\" becomes \"remFnOverloaded\"</li></ul>", + "since": "4.2", + "internal": false, + "post": false, + "hasResponseExample": true, + "changelog": [], + "params": [ + { + "key": "actives", + "description": "Show rule's activations for all profiles (\"active rules\")", + "required": false, + "internal": false, + "defaultValue": "false", + "possibleValues": [ + "true", + "false", + "yes", + "no" + ] + }, + { + "key": "key", + "description": "Rule key", + "required": true, + "internal": false, + "exampleValue": "javascript:EmptyBlock" + }, + { + "key": "organization", + "description": "Organization key", + "since": "6.4", + "required": false, + "internal": true, + "exampleValue": "my-org" + } + ] + }, + { + "key": "tags", + "description": "List rule tags", + "since": "4.4", + "internal": false, + "post": false, + "hasResponseExample": true, + "changelog": [], + "params": [ + { + "key": "organization", + "description": "Organization key", + "since": "6.4", + "required": false, + "internal": true, + "exampleValue": "my-org" + }, + { + "key": "ps", + "description": "Page size. Must be greater than 0 and less than 100", + "required": false, + "internal": false, + "defaultValue": "10", + "exampleValue": "20", + "deprecatedKey": "pageSize", + "deprecatedKeySince": "5.2", + "maximumValue": 100 + }, + { + "key": "q", + "description": "Limit search to tags that contain the supplied string.", + "required": false, + "internal": false, + "exampleValue": "misra" + } + ] + }, + { + "key": "update", + "description": "Update an existing rule.<br>Requires the 'Administer Quality Profiles' permission", + "since": "4.4", + "internal": false, + "post": true, + "hasResponseExample": false, + "changelog": [], + "params": [ + { + "key": "debt_remediation_fn_offset", + "required": false, + "internal": false, + "deprecatedSince": "5.5" + }, + { + "key": "debt_remediation_fn_type", + "required": false, + "internal": false, + "deprecatedSince": "5.5", + "possibleValues": [ + "LINEAR", + "LINEAR_OFFSET", + "CONSTANT_ISSUE" + ] + }, + { + "key": "debt_remediation_fy_coeff", + "required": false, + "internal": false, + "deprecatedSince": "5.5" + }, + { + "key": "debt_sub_characteristic", + "description": "Debt characteristics are no more supported. This parameter is ignored.", + "required": false, + "internal": false, + "deprecatedSince": "5.5" + }, + { + "key": "key", + "description": "Key of the rule to update", + "required": true, + "internal": false, + "exampleValue": "javascript:NullCheck", + "maximumLength": 200 + }, + { + "key": "markdown_description", + "description": "Rule description (mandatory for custom rule and manual rule)", + "required": false, + "internal": false, + "exampleValue": "Description of my custom rule" + }, + { + "key": "markdown_note", + "description": "Optional note in markdown format. Use empty value to remove current note. Note is not changedif the parameter is not set.", + "required": false, + "internal": false, + "exampleValue": "my *note*" + }, + { + "key": "name", + "description": "Rule name (mandatory for custom rule)", + "required": false, + "internal": false, + "exampleValue": "My custom rule", + "maximumLength": 200 + }, + { + "key": "organization", + "description": "Organization key", + "since": "6.4", + "required": false, + "internal": true, + "exampleValue": "my-org" + }, + { + "key": "params", + "description": "Parameters as semi-colon list of <key>=<value>, for example 'params=key1=v1;key2=v2' (Only when updating a custom rule)", + "required": false, + "internal": false + }, + { + "key": "remediation_fn_base_effort", + "description": "Base effort of the remediation function of the rule", + "since": "5.5", + "required": false, + "internal": false, + "exampleValue": "1d" + }, + { + "key": "remediation_fn_type", + "description": "Type of the remediation function of the rule", + "since": "5.5", + "required": false, + "internal": false, + "possibleValues": [ + "LINEAR", + "LINEAR_OFFSET", + "CONSTANT_ISSUE" + ] + }, + { + "key": "remediation_fy_gap_multiplier", + "description": "Gap multiplier of the remediation function of the rule", + "since": "5.5", + "required": false, + "internal": false, + "exampleValue": "3min" + }, + { + "key": "severity", + "description": "Rule severity (Only when updating a custom rule)", + "required": false, + "internal": false, + "possibleValues": [ + "INFO", + "MINOR", + "MAJOR", + "CRITICAL", + "BLOCKER" + ] + }, + { + "key": "status", + "description": "Rule status (Only when updating a custom rule)", + "required": false, + "internal": false, + "possibleValues": [ + "BETA", + "DEPRECATED", + "READY", + "REMOVED" + ] + }, + { + "key": "tags", + "description": "Optional comma-separated list of tags to set. Use blank value to remove current tags. Tags are not changed if the parameter is not set.", + "required": false, + "internal": false, + "exampleValue": "java8,security" + } + ] + } + ] + }, + { + "path": "api/server", + "actions": [ + { + "key": "version", + "description": "Version of SonarQube in plain text", + "since": "2.10", + "internal": false, + "post": false, + "hasResponseExample": true, + "changelog": [] + } + ] + }, + { + "path": "api/settings", + "since": "6.1", + "description": "Manage settings.", + "actions": [ + { + "key": "check_secret_key", + "description": "Check if a secret key is available.<br>Requires the 'Administer System' permission.", + "since": "6.1", + "internal": true, + "post": false, + "hasResponseExample": true, + "changelog": [] + }, + { + "key": "encrypt", + "description": "Encrypt a setting value.<br>Requires 'Administer System' permission.", + "since": "6.1", + "internal": true, + "post": false, + "hasResponseExample": true, + "changelog": [], + "params": [ + { + "key": "value", + "description": "Setting value to encrypt", + "required": true, + "internal": false, + "exampleValue": "my value" + } + ] + }, + { + "key": "generate_secret_key", + "description": "Generate a secret key.<br>Requires the 'Administer System' permission", + "since": "6.1", + "internal": true, + "post": false, + "hasResponseExample": true, + "changelog": [] + }, + { + "key": "list_definitions", + "description": "List settings definitions.<br>Requires 'Browse' permission when a component is specified<br/>", + "since": "6.3", + "internal": false, + "post": false, + "hasResponseExample": true, + "changelog": [], + "params": [ + { + "key": "branch", + "description": "Branch key. Only available on following settings : sonar.leak.period", + "since": "6.6", + "required": false, + "internal": true, + "exampleValue": "feature/my_branch" + }, + { + "key": "component", + "description": "Component key", + "required": false, + "internal": false, + "exampleValue": "my_project" + } + ] + }, + { + "key": "reset", + "description": "Remove a setting value.<br>Requires one of the following permissions: <ul><li>'Administer System'</li><li>'Administer' rights on the specified component</li></ul>", + "since": "6.1", + "internal": false, + "post": true, + "hasResponseExample": false, + "changelog": [], + "params": [ + { + "key": "branch", + "description": "Branch key", + "since": "6.6", + "required": false, + "internal": true, + "exampleValue": "feature/my_branch" + }, + { + "key": "component", + "description": "Component key", + "required": false, + "internal": false, + "exampleValue": "my_project", + "deprecatedKey": "componentKey", + "deprecatedKeySince": "6.3" + }, + { + "key": "keys", + "description": "Setting keys", + "required": true, + "internal": false, + "exampleValue": "sonar.links.scm,sonar.debt.hoursInDay" + } + ] + }, + { + "key": "set", + "description": "Update a setting value.<br>Either 'value' or 'values' must be provided.<br> Requires one of the following permissions: <ul><li>'Administer System'</li><li>'Administer' rights on the specified component</li></ul>", + "since": "6.1", + "internal": false, + "post": true, + "hasResponseExample": false, + "changelog": [], + "params": [ + { + "key": "branch", + "description": "Branch key. Only available on following settings : sonar.leak.period", + "since": "6.6", + "required": false, + "internal": true, + "exampleValue": "feature/my_branch" + }, + { + "key": "component", + "description": "Component key", + "required": false, + "internal": false, + "exampleValue": "my_project", + "deprecatedKey": "componentKey", + "deprecatedKeySince": "6.3" + }, + { + "key": "fieldValues", + "description": "Setting field values. To set several values, the parameter must be called once for each value.", + "required": false, + "internal": false, + "exampleValue": "fieldValues={\"firstField\":\"first value\", \"secondField\":\"second value\", \"thirdField\":\"third value\"}" + }, + { + "key": "key", + "description": "Setting key", + "required": true, + "internal": false, + "exampleValue": "sonar.links.scm" + }, + { + "key": "value", + "description": "Setting value. To reset a value, please use the reset web service.", + "required": false, + "internal": false, + "exampleValue": "git@github.com:SonarSource/sonarqube.git", + "maximumLength": 4000 + }, + { + "key": "values", + "description": "Setting multi value. To set several values, the parameter must be called once for each value.", + "required": false, + "internal": false, + "exampleValue": "values=firstValue&values=secondValue&values=thirdValue" + } + ] + }, + { + "key": "values", + "description": "List settings values.<br>If no value has been set for a setting, then the default value is returned.<br>Requires 'Browse' permission when a component is specified<br/>", + "since": "6.3", + "internal": false, + "post": false, + "hasResponseExample": true, + "changelog": [], + "params": [ + { + "key": "branch", + "description": "Branch key", + "since": "6.6", + "required": false, + "internal": true, + "exampleValue": "feature/my_branch" + }, + { + "key": "component", + "description": "Component key", + "required": false, + "internal": false, + "exampleValue": "my_project" + }, + { + "key": "keys", + "description": "List of setting keys", + "required": false, + "internal": false, + "exampleValue": "sonar.test.inclusions,sonar.dbcleaner.cleanDirectory" + } + ] + } + ] + }, + { + "path": "api/sources", + "since": "4.2", + "description": "Get details on source files. See also api/tests.", + "actions": [ + { + "key": "hash", + "description": "Show line line hashes for a given file. Require See Source Code permission on file's project<br/>", + "since": "5.0", + "internal": true, + "post": false, + "hasResponseExample": true, + "changelog": [], + "params": [ + { + "key": "key", + "description": "File key", + "required": true, + "internal": false, + "exampleValue": "my_project:/src/foo/Bar.php" + } + ] + }, + { + "key": "index", + "description": "Get source code as line number / text pairs. Require See Source Code permission on file", + "since": "5.0", + "internal": true, + "post": false, + "hasResponseExample": true, + "changelog": [], + "params": [ + { + "key": "from", + "description": "First line", + "required": false, + "internal": false, + "defaultValue": "1" + }, + { + "key": "resource", + "description": "File key", + "required": true, + "internal": false, + "exampleValue": "my_project:/src/foo/Bar.php" + }, + { + "key": "to", + "description": "Last line (excluded). If not specified, all lines are returned until end of file", + "required": false, + "internal": false + } + ] + }, + { + "key": "lines", + "description": "Show source code with line oriented info. Require See Source Code permission on file's project<br/>Each element of the result array is an object which contains:<ol><li>Line number</li><li>Content of the line</li><li>Author of the line (from SCM information)</li><li>Revision of the line (from SCM information)</li><li>Last commit date of the line (from SCM information)</li><li>Line hits from coverage</li><li>Number of conditions to cover in tests</li><li>Number of conditions covered by tests</li></ol>", + "since": "5.0", + "internal": true, + "post": false, + "hasResponseExample": true, + "changelog": [ + { + "description": "fields \"branch\" added", + "version": "6.6" + }, + { + "description": "fields \"utLineHits\", \"utConditions\" and \"utCoveredConditions\" has been renamed \"lineHits\", \"conditions\" and \"coveredConditions\"", + "version": "6.2" + }, + { + "description": "fields \"itLineHits\", \"itConditions\" and \"itCoveredConditions\" are no more returned", + "version": "6.2" + } + ], + "params": [ + { + "key": "branch", + "description": "Branch key", + "required": false, + "internal": true, + "exampleValue": "feature/my_branch" + }, + { + "key": "from", + "description": "First line to return. Starts from 1", + "required": false, + "internal": false, + "defaultValue": "1", + "exampleValue": "10" + }, + { + "key": "key", + "description": "File key. Mandatory if param 'uuid' is not set. Available since 5.2", + "required": false, + "internal": false, + "exampleValue": "my_project:/src/foo/Bar.php" + }, + { + "key": "to", + "description": "Optional last line to return (inclusive). It must be greater than or equal to parameter 'from'. If unset, then all the lines greater than or equal to 'from' are returned.", + "required": false, + "internal": false, + "exampleValue": "20" + }, + { + "key": "uuid", + "description": "File uuid. Mandatory if param 'key' is not set", + "required": false, + "internal": false, + "exampleValue": "f333aab4-7e3a-4d70-87e1-f4c491f05e5c" + } + ] + }, + { + "key": "raw", + "description": "Get source code as raw text. Require 'See Source Code' permission on file", + "since": "5.0", + "internal": false, + "post": false, + "hasResponseExample": true, + "changelog": [], + "params": [ + { + "key": "branch", + "description": "Branch key", + "required": false, + "internal": true, + "exampleValue": "feature/my_branch" + }, + { + "key": "key", + "description": "File key", + "required": true, + "internal": false, + "exampleValue": "my_project:src/foo/Bar.php" + } + ] + }, + { + "key": "scm", + "description": "Get SCM information of source files. Require See Source Code permission on file's project<br/>Each element of the result array is composed of:<ol><li>Line number</li><li>Author of the commit</li><li>Datetime of the commit (before 5.2 it was only the Date)</li><li>Revision of the commit (added in 5.2)</li></ol>", + "since": "4.4", + "internal": false, + "post": false, + "hasResponseExample": true, + "changelog": [], + "params": [ + { + "key": "commits_by_line", + "description": "Group lines by SCM commit if value is false, else display commits for each line, even if two consecutive lines relate to the same commit.", + "required": false, + "internal": false, + "defaultValue": "false", + "possibleValues": [ + "true", + "false", + "yes", + "no" + ] + }, + { + "key": "from", + "description": "First line to return. Starts at 1", + "required": false, + "internal": false, + "defaultValue": "1", + "exampleValue": "10" + }, + { + "key": "key", + "description": "File key", + "required": true, + "internal": false, + "exampleValue": "my_project:/src/foo/Bar.php" + }, + { + "key": "to", + "description": "Last line to return (inclusive)", + "required": false, + "internal": false, + "exampleValue": "20" + } + ] + }, + { + "key": "show", + "description": "Get source code. Require See Source Code permission on file's project<br/>Each element of the result array is composed of:<ol><li>Line number</li><li>Content of the line</li></ol>", + "since": "4.4", + "internal": false, + "post": false, + "hasResponseExample": true, + "changelog": [], + "params": [ + { + "key": "from", + "description": "First line to return. Starts at 1", + "required": false, + "internal": false, + "defaultValue": "1", + "exampleValue": "10" + }, + { + "key": "key", + "description": "File key", + "required": true, + "internal": false, + "exampleValue": "my_project:/src/foo/Bar.php" + }, + { + "key": "to", + "description": "Last line to return (inclusive)", + "required": false, + "internal": false, + "exampleValue": "20" + } + ] + } + ] + }, + { + "path": "api/system", + "description": "Get system details, and perform some management actions, such as restarting, and initiating a database migration (as part of a system upgrade).", + "actions": [ + { + "key": "change_log_level", + "description": "Temporarily changes level of logs. New level is not persistent and is lost when restarting server. Requires system administration permission.", + "since": "5.2", + "internal": false, + "post": true, + "hasResponseExample": false, + "changelog": [], + "params": [ + { + "key": "level", + "description": "The new level. Be cautious: DEBUG, and even more TRACE, may have performance impacts.", + "required": true, + "internal": false, + "possibleValues": [ + "TRACE", + "DEBUG", + "INFO" + ] + } + ] + }, + { + "key": "db_migration_status", + "description": "Display the database migration status of SonarQube.<br/>State values are:<ul><li>NO_MIGRATION: DB is up to date with current version of SonarQube.</li><li>NOT_SUPPORTED: Migration is not supported on embedded databases.</li><li>MIGRATION_RUNNING: DB migration is under go.</li><li>MIGRATION_SUCCEEDED: DB migration has run and has been successful.</li><li>MIGRATION_FAILED: DB migration has run and failed. SonarQube must be restarted in order to retry a DB migration (optionally after DB has been restored from backup).</li><li>MIGRATION_REQUIRED: DB migration is required.</li></ul>", + "since": "5.2", + "internal": false, + "post": false, + "hasResponseExample": true, + "changelog": [] + }, + { + "key": "health", + "description": "Provide health status of SonarQube.<p>Require 'Administer System' permission or authentication with passcode</p><p> <ul> <li>GREEN: SonarQube is fully operational</li> <li>YELLOW: SonarQube is usable, but it needs attention in order to be fully operational</li> <li>RED: SonarQube is not operational</li> </ul></p>", + "since": "6.6", + "internal": false, + "post": false, + "hasResponseExample": true, + "changelog": [] + }, + { + "key": "info", + "description": "Get detailed information about system configuration.<br/>Requires 'Administer' permissions.<br/>Since 5.5, this web service becomes internal in order to more easily update result.", + "since": "5.1", + "internal": true, + "post": false, + "hasResponseExample": true, + "changelog": [] + }, + { + "key": "logs", + "description": "Get system logs in plain-text format. Requires system administration permission.", + "since": "5.2", + "internal": false, + "post": false, + "hasResponseExample": true, + "changelog": [], + "params": [ + { + "key": "process", + "description": "Process to get logs from", + "since": "6.2", + "required": false, + "internal": false, + "defaultValue": "app", + "possibleValues": [ + "app", + "ce", + "es", + "web" + ] + } + ] + }, + { + "key": "migrate_db", + "description": "Migrate the database to match the current version of SonarQube.<br/>Sending a POST request to this URL starts the DB migration. It is strongly advised to <strong>make a database backup</strong> before invoking this WS.<br/>State values are:<ul><li>NO_MIGRATION: DB is up to date with current version of SonarQube.</li><li>NOT_SUPPORTED: Migration is not supported on embedded databases.</li><li>MIGRATION_RUNNING: DB migration is under go.</li><li>MIGRATION_SUCCEEDED: DB migration has run and has been successful.</li><li>MIGRATION_FAILED: DB migration has run and failed. SonarQube must be restarted in order to retry a DB migration (optionally after DB has been restored from backup).</li><li>MIGRATION_REQUIRED: DB migration is required.</li></ul>", + "since": "5.2", + "internal": false, + "post": true, + "hasResponseExample": true, + "changelog": [] + }, + { + "key": "ping", + "description": "Answers \"pong\" as plain-text", + "since": "6.3", + "internal": false, + "post": false, + "hasResponseExample": true, + "changelog": [] + }, + { + "key": "restart", + "description": "Restart server. Require 'Administer System' permission. Perform a full restart of the Web, Search and Compute Engine Servers processes.", + "since": "4.3", + "internal": false, + "post": true, + "hasResponseExample": false, + "changelog": [] + }, + { + "key": "status", + "description": "Get state information about SonarQube.<p>status: the running status <ul> <li>STARTING: SonarQube Web Server is up and serving some Web Services (eg. api/system/status) but initialization is still ongoing</li> <li>UP: SonarQube instance is up and running</li> <li>DOWN: SonarQube instance is up but not running because migration has failed (refer to WS /api/system/migrate_db for details) or some other reason (check logs).</li> <li>RESTARTING: SonarQube instance is still up but a restart has been requested (refer to WS /api/system/restart for details).</li> <li>DB_MIGRATION_NEEDED: database migration is required. DB migration can be started using WS /api/system/migrate_db.</li> <li>DB_MIGRATION_RUNNING: DB migration is running (refer to WS /api/system/migrate_db for details)</li> </ul></p>", + "since": "5.2", + "internal": false, + "post": false, + "hasResponseExample": true, + "changelog": [] + }, + { + "key": "upgrades", + "description": "Lists available upgrades for the SonarQube instance (if any) and for each one, lists incompatible plugins and plugins requiring upgrade.<br/>Plugin information is retrieved from Update Center. Date and time at which Update Center was last refreshed is provided in the response.", + "since": "5.2", + "internal": false, + "post": false, + "hasResponseExample": true, + "changelog": [] + } + ] + }, + { + "path": "api/tests", + "since": "4.4", + "description": "Get details on test files. See also api/sources. Deprecated since 5.6.", + "actions": [ + { + "key": "covered_files", + "description": "Get the list of source files covered by a test. Require Browse permission on test file's project", + "since": "4.4", + "deprecatedSince": "5.6", + "internal": false, + "post": false, + "hasResponseExample": true, + "changelog": [ + { + "description": "\"branch\" field is now returned", + "version": "6.6" + } + ], + "params": [ + { + "key": "p", + "description": "1-based page number", + "required": false, + "internal": false, + "defaultValue": "1", + "exampleValue": "42", + "deprecatedKey": "pageIndex", + "deprecatedKeySince": "5.2" + }, + { + "key": "ps", + "description": "Page size. Must be greater than 0.", + "required": false, + "internal": false, + "defaultValue": "100", + "exampleValue": "20", + "deprecatedKey": "pageSize", + "deprecatedKeySince": "5.2" + }, + { + "key": "testId", + "description": "Test ID", + "required": true, + "internal": false, + "exampleValue": "AU-Tpxb--iU5OvuD2FLy" + } + ] + }, + { + "key": "list", + "description": "Get the list of tests either in a test file or that test a given line of source code.<br /> Requires 'Browse' permission on the file's project.<br /> One (and only one) of the following combination of parameters must be provided: <ul><li>testId - get a specific test</li><li>testFileId - get the tests in a test file</li><li>testFileKey - get the tests in a test file</li><li>sourceFileId and sourceFileLineNumber - get the tests that cover a specific line of code</li><li>sourceFileKey and sourceFileLineNumber - get the tests that cover a specific line of code</li></ul>", + "since": "5.2", + "deprecatedSince": "5.6", + "internal": false, + "post": false, + "hasResponseExample": true, + "changelog": [ + { + "description": "\"fileBranch\" field is now returned", + "version": "6.6" + } + ], + "params": [ + { + "key": "branch", + "description": "Branch key", + "since": "6.6", + "required": false, + "internal": true, + "exampleValue": "feature/my_branch" + }, + { + "key": "p", + "description": "1-based page number", + "required": false, + "internal": false, + "defaultValue": "1", + "exampleValue": "42", + "deprecatedKey": "pageIndex", + "deprecatedKeySince": "5.2" + }, + { + "key": "ps", + "description": "Page size. Must be greater than 0 and less than 500", + "required": false, + "internal": false, + "defaultValue": "100", + "exampleValue": "20", + "deprecatedKey": "pageSize", + "deprecatedKeySince": "5.2", + "maximumValue": 500 + }, + { + "key": "sourceFileId", + "description": "ID of source file. Must be provided with the source file line number.", + "required": false, + "internal": false, + "exampleValue": "AU-TpxcA-iU5OvuD2FL0" + }, + { + "key": "sourceFileKey", + "description": "Key of source file. Must be provided with the source file line number.", + "since": "5.4", + "required": false, + "internal": false, + "exampleValue": "my_project:/src/foo/Bar.php" + }, + { + "key": "sourceFileLineNumber", + "description": "Source file line number. Must be provided with the source file ID or key.", + "required": false, + "internal": false, + "exampleValue": "10" + }, + { + "key": "testFileId", + "description": "ID of test file", + "required": false, + "internal": false, + "exampleValue": "AU-Tpxb--iU5OvuD2FLy" + }, + { + "key": "testFileKey", + "description": "Key of test file", + "required": false, + "internal": false, + "exampleValue": "MY_PROJECT:src/test/java/foo/BarTest.java" + }, + { + "key": "testId", + "description": "ID of test", + "required": false, + "internal": false, + "exampleValue": "AU-TpxcA-iU5OvuD2FLz" + } + ] + } + ] + }, + { + "path": "api/timemachine", + "since": "2.10", + "description": "Removed since 6.3, please use api/measures/search_history instead", + "actions": [ + { + "key": "index", + "description": "The web service is removed and you're invited to use api/measures/search_history instead", + "since": "2.10", + "deprecatedSince": "6.3", + "internal": false, + "post": false, + "hasResponseExample": true, + "changelog": [] + } + ] + }, + { + "path": "api/updatecenter", + "since": "2.10", + "description": "Get list of installed plugins", + "actions": [ + { + "key": "installed_plugins", + "description": "Get the list of all the plugins installed on the SonarQube instance", + "since": "2.10", + "deprecatedSince": "6.3", + "internal": true, + "post": false, + "hasResponseExample": true, + "changelog": [], + "params": [ + { + "key": "format", + "description": "Only json response format is available", + "required": false, + "internal": false, + "possibleValues": [ + "json" + ] + } + ] + }, + { + "key": "upload", + "description": "Upload a plugin.<br /> Requires 'Administer System' permission.", + "since": "6.0", + "internal": true, + "post": true, + "hasResponseExample": false, + "changelog": [], + "params": [ + { + "key": "file", + "description": "The jar file of the plugin to install", + "required": true, + "internal": false + } + ] + } + ] + }, + { + "path": "api/user_groups", + "since": "5.2", + "description": "Manage user groups.", + "actions": [ + { + "key": "add_user", + "description": "Add a user to a group.<br />'id' or 'name' must be provided.<br />Requires the following permission: 'Administer System'.", + "since": "5.2", + "internal": false, + "post": true, + "hasResponseExample": false, + "changelog": [ + { + "description": "It's no longer possible to add a user to the default group", + "version": "6.4" + } + ], + "params": [ + { + "key": "id", + "description": "Group id", + "required": false, + "internal": false, + "exampleValue": "42" + }, + { + "key": "login", + "description": "User login", + "required": false, + "internal": false, + "exampleValue": "g.hopper" + }, + { + "key": "name", + "description": "Group name", + "required": false, + "internal": false, + "exampleValue": "sonar-administrators" + }, + { + "key": "organization", + "description": "Key of organization", + "since": "6.2", + "required": false, + "internal": true, + "exampleValue": "my-org" + } + ] + }, + { + "key": "create", + "description": "Create a group.<br>Requires the following permission: 'Administer System'.", + "since": "5.2", + "internal": false, + "post": true, + "hasResponseExample": true, + "changelog": [], + "params": [ + { + "key": "description", + "description": "Description for the new group. A group description cannot be larger than 200 characters.", + "required": false, + "internal": false, + "exampleValue": "Default group for new users", + "maximumLength": 200 + }, + { + "key": "name", + "description": "Name for the new group. A group name cannot be larger than 255 characters and must be unique. The value 'anyone' (whatever the case) is reserved and cannot be used.", + "required": true, + "internal": false, + "exampleValue": "sonar-users", + "maximumLength": 255 + }, + { + "key": "organization", + "description": "Key of organization. If unset then default organization is used.", + "since": "6.2", + "required": false, + "internal": true, + "exampleValue": "my-org" + } + ] + }, + { + "key": "delete", + "description": "Delete a group. The default groups cannot be deleted.<br/>'id' or 'name' must be provided.<br />Requires the following permission: 'Administer System'.", + "since": "5.2", + "internal": false, + "post": true, + "hasResponseExample": false, + "changelog": [], + "params": [ + { + "key": "id", + "description": "Group id", + "required": false, + "internal": false, + "exampleValue": "42" + }, + { + "key": "name", + "description": "Group name", + "required": false, + "internal": false, + "exampleValue": "sonar-administrators" + }, + { + "key": "organization", + "description": "Key of organization", + "since": "6.2", + "required": false, + "internal": true, + "exampleValue": "my-org" + } + ] + }, + { + "key": "remove_user", + "description": "Remove a user from a group.<br />'id' or 'name' must be provided.<br>Requires the following permission: 'Administer System'.", + "since": "5.2", + "internal": false, + "post": true, + "hasResponseExample": false, + "changelog": [], + "params": [ + { + "key": "id", + "description": "Group id", + "required": false, + "internal": false, + "exampleValue": "42" + }, + { + "key": "login", + "description": "User login", + "required": false, + "internal": false, + "exampleValue": "g.hopper" + }, + { + "key": "name", + "description": "Group name", + "required": false, + "internal": false, + "exampleValue": "sonar-administrators" + }, + { + "key": "organization", + "description": "Key of organization", + "since": "6.2", + "required": false, + "internal": true, + "exampleValue": "my-org" + } + ] + }, + { + "key": "search", + "description": "Search for user groups.<br>Requires the following permission: 'Administer System'.", + "since": "5.2", + "internal": false, + "post": false, + "hasResponseExample": true, + "changelog": [ + { + "description": "Paging response fields moved to a Paging object", + "version": "6.4" + }, + { + "description": "'default' response field has been added", + "version": "6.4" + } + ], + "params": [ + { + "key": "f", + "description": "Comma-separated list of the fields to be returned in response. All the fields are returned by default.", + "required": false, + "internal": false, + "possibleValues": [ + "name", + "description", + "membersCount" + ] + }, + { + "key": "organization", + "description": "Key of organization. If not set then groups are searched in default organization.", + "since": "6.2", + "required": false, + "internal": true, + "exampleValue": "my-org" + }, + { + "key": "p", + "description": "1-based page number", + "required": false, + "internal": false, + "defaultValue": "1", + "exampleValue": "42", + "deprecatedKey": "pageIndex", + "deprecatedKeySince": "5.2" + }, + { + "key": "ps", + "description": "Page size. Must be greater than 0 and less than 500", + "required": false, + "internal": false, + "defaultValue": "100", + "exampleValue": "20", + "deprecatedKey": "pageSize", + "deprecatedKeySince": "5.2", + "maximumValue": 500 + }, + { + "key": "q", + "description": "Limit search to names that contain the supplied string.", + "required": false, + "internal": false, + "exampleValue": "sonar-users" + } + ] + }, + { + "key": "update", + "description": "Update a group.<br>Requires the following permission: 'Administer System'.", + "since": "5.2", + "internal": false, + "post": true, + "hasResponseExample": false, + "changelog": [ + { + "description": "The default group is no longer editable", + "version": "6.4" + } + ], + "params": [ + { + "key": "description", + "description": "New optional description for the group. A group description cannot be larger than 200 characters. If value is not defined, then description is not changed.", + "required": false, + "internal": false, + "exampleValue": "Default group for new users", + "maximumLength": 200 + }, + { + "key": "id", + "description": "Identifier of the group.", + "required": true, + "internal": false, + "exampleValue": "42" + }, + { + "key": "name", + "description": "New optional name for the group. A group name cannot be larger than 255 characters and must be unique. Value 'anyone' (whatever the case) is reserved and cannot be used. If value is empty or not defined, then name is not changed.", + "required": false, + "internal": false, + "exampleValue": "my-group", + "maximumLength": 255 + } + ] + }, + { + "key": "users", + "description": "Search for users with membership information with respect to a group.<br>Requires the following permission: 'Administer System'.", + "since": "5.2", + "internal": false, + "post": false, + "hasResponseExample": true, + "changelog": [], + "params": [ + { + "key": "id", + "description": "Group id", + "required": false, + "internal": false, + "exampleValue": "42" + }, + { + "key": "name", + "description": "Group name", + "required": false, + "internal": false, + "exampleValue": "sonar-administrators" + }, + { + "key": "organization", + "description": "Key of organization", + "since": "6.2", + "required": false, + "internal": true, + "exampleValue": "my-org" + }, + { + "key": "p", + "description": "1-based page number", + "required": false, + "internal": false, + "defaultValue": "1", + "exampleValue": "42", + "deprecatedKey": "pageIndex", + "deprecatedKeySince": "5.2" + }, + { + "key": "ps", + "description": "Page size. Must be greater than 0.", + "required": false, + "internal": false, + "defaultValue": "25", + "exampleValue": "20", + "deprecatedKey": "pageSize", + "deprecatedKeySince": "5.2" + }, + { + "key": "q", + "description": "Limit search to names or logins that contain the supplied string.", + "required": false, + "internal": false, + "exampleValue": "freddy" + }, + { + "key": "selected", + "description": "Depending on the value, show only selected items (selected=selected), deselected items (selected=deselected), or all items with their selection status (selected=all).", + "required": false, + "internal": false, + "defaultValue": "selected", + "possibleValues": [ + "all", + "deselected", + "selected" + ] + } + ] + } + ] + }, + { + "path": "api/user_properties", + "since": "2.6", + "description": "Removed since 6.3, please use api/favorites and api/notifications instead", + "actions": [ + { + "key": "index", + "description": "This web service is removed", + "since": "2.6", + "deprecatedSince": "6.3", + "internal": false, + "post": false, + "hasResponseExample": true, + "changelog": [] + } + ] + }, + { + "path": "api/user_tokens", + "since": "5.3", + "description": "List, create, and delete a user's access tokens.", + "actions": [ + { + "key": "generate", + "description": "Generate a user access token. <br />Please keep your tokens secret. They enable to authenticate and analyze projects.<br />If the login is set, it requires administration permissions. Otherwise, a token is generated for the authenticated user.", + "since": "5.3", + "internal": false, + "post": true, + "hasResponseExample": true, + "changelog": [], + "params": [ + { + "key": "login", + "description": "User login. If not set, the token is generated for the authenticated user.", + "required": false, + "internal": false, + "exampleValue": "g.hopper" + }, + { + "key": "name", + "description": "Token name", + "required": true, + "internal": false, + "exampleValue": "Project scan on Travis", + "maximumLength": 100 + } + ] + }, + { + "key": "revoke", + "description": "Revoke a user access token. <br/>If the login is set, it requires administration permissions. Otherwise, a token is generated for the authenticated user.", + "since": "5.3", + "internal": false, + "post": true, + "hasResponseExample": false, + "changelog": [], + "params": [ + { + "key": "login", + "description": "User login", + "required": false, + "internal": false, + "exampleValue": "g.hopper" + }, + { + "key": "name", + "description": "Token name", + "required": true, + "internal": false, + "exampleValue": "Project scan on Travis" + } + ] + }, + { + "key": "search", + "description": "List the access tokens of a user.<br>The login must exist and active.<br>If the login is set, it requires administration permissions. Otherwise, a token is generated for the authenticated user.", + "since": "5.3", + "internal": false, + "post": false, + "hasResponseExample": true, + "changelog": [], + "params": [ + { + "key": "login", + "description": "User login", + "required": false, + "internal": false, + "exampleValue": "g.hopper" + } + ] + } + ] + }, + { + "path": "api/users", + "since": "3.6", + "description": "Manage users.", + "actions": [ + { + "key": "change_password", + "description": "Update a user's password. Authenticated users can change their own password, provided that the account is not linked to an external authentication system. Administer System permission is required to change another user's password.", + "since": "5.2", + "internal": false, + "post": true, + "hasResponseExample": false, + "changelog": [], + "params": [ + { + "key": "login", + "description": "User login", + "required": true, + "internal": false, + "exampleValue": "myuser" + }, + { + "key": "password", + "description": "New password", + "required": true, + "internal": false, + "exampleValue": "mypassword" + }, + { + "key": "previousPassword", + "description": "Previous password. Required when changing one's own password.", + "required": false, + "internal": false, + "exampleValue": "oldpassword" + } + ] + }, + { + "key": "create", + "description": "Create a user.<br/>If a deactivated user account exists with the given login, it will be reactivated.<br/>Requires Administer System permission", + "since": "3.7", + "internal": false, + "post": true, + "hasResponseExample": false, + "changelog": [ + { + "description": "The password is only mandatory when creating local users, and should not be set on non local users", + "version": "6.3" + }, + { + "description": "The 'infos' message is no more returned when a user is reactivated", + "version": "6.3" + } + ], + "params": [ + { + "key": "email", + "description": "User email", + "required": false, + "internal": false, + "exampleValue": "myname@email.com", + "maximumLength": 100 + }, + { + "key": "local", + "description": "Specify if the user should be authenticated from SonarQube server or from an external authentication system. Password should not be set when local is set to false.", + "since": "6.3", + "required": false, + "internal": false, + "defaultValue": "true", + "possibleValues": [ + "true", + "false", + "yes", + "no" + ] + }, + { + "key": "login", + "description": "User login", + "required": true, + "internal": false, + "exampleValue": "myuser", + "maximumLength": 255 + }, + { + "key": "name", + "description": "User name", + "required": true, + "internal": false, + "exampleValue": "My Name", + "maximumLength": 200 + }, + { + "key": "password", + "description": "User password. Only mandatory when creating local user, otherwise it should not be set", + "required": false, + "internal": false, + "exampleValue": "mypassword" + }, + { + "key": "scmAccount", + "description": "SCM accounts. To set several values, the parameter must be called once for each value.", + "required": false, + "internal": false, + "exampleValue": "scmAccount=firstValue&scmAccount=secondValue&scmAccount=thirdValue" + }, + { + "key": "scmAccounts", + "description": "This parameter is deprecated, please use 'scmAccount' instead", + "required": false, + "internal": false, + "exampleValue": "myscmaccount1,myscmaccount2", + "deprecatedSince": "6.1", + "deprecatedKey": "scm_accounts", + "deprecatedKeySince": "6.0" + } + ] + }, + { + "key": "current", + "description": "Get the details of the current authenticated user.", + "since": "5.2", + "internal": true, + "post": false, + "hasResponseExample": true, + "changelog": [ + { + "description": "showOnboardingTutorial is now returned in the response", + "version": "6.5" + } + ] + }, + { + "key": "deactivate", + "description": "Deactivate a user. Requires Administer System permission", + "since": "3.7", + "internal": false, + "post": true, + "hasResponseExample": true, + "changelog": [], + "params": [ + { + "key": "login", + "description": "User login", + "required": true, + "internal": false, + "exampleValue": "myuser" + } + ] + }, + { + "key": "groups", + "description": "Lists the groups a user belongs to. <br/>Requires Administer System permission.", + "since": "5.2", + "internal": false, + "post": false, + "hasResponseExample": true, + "changelog": [ + { + "description": "Paging response fields moved to a Paging object", + "version": "6.4" + }, + { + "description": "'default' response field has been added", + "version": "6.4" + } + ], + "params": [ + { + "key": "login", + "description": "A user login", + "required": true, + "internal": false, + "exampleValue": "admin" + }, + { + "key": "organization", + "description": "Organization key", + "since": "6.4", + "required": false, + "internal": true, + "exampleValue": "my-org" + }, + { + "key": "p", + "description": "1-based page number", + "required": false, + "internal": false, + "defaultValue": "1", + "exampleValue": "42", + "deprecatedKey": "pageIndex", + "deprecatedKeySince": "5.2" + }, + { + "key": "ps", + "description": "Page size. Must be greater than 0.", + "required": false, + "internal": false, + "defaultValue": "25", + "exampleValue": "20", + "deprecatedKey": "pageSize", + "deprecatedKeySince": "5.2" + }, + { + "key": "q", + "description": "Limit search to group names that contain the supplied string.", + "required": false, + "internal": false, + "exampleValue": "users" + }, + { + "key": "selected", + "description": "Depending on the value, show only selected items (selected=selected), deselected items (selected=deselected), or all items with their selection status (selected=all).", + "required": false, + "internal": false, + "defaultValue": "selected", + "possibleValues": [ + "all", + "deselected", + "selected" + ] + } + ] + }, + { + "key": "identity_providers", + "description": "List the external identity providers", + "since": "5.5", + "internal": true, + "post": false, + "hasResponseExample": true, + "changelog": [] + }, + { + "key": "search", + "description": "Get a list of active users. <br/>Administer System permission is required to show the 'groups' field.<br/>When accessed anonymously, only logins and names are returned.", + "since": "3.6", + "internal": false, + "post": false, + "hasResponseExample": true, + "changelog": [ + { + "description": "Paging response fields moved to a Paging object", + "version": "6.4" + }, + { + "description": "Avatar has been added to the response", + "version": "6.4" + }, + { + "description": "Email is only returned when user has Administer System permission", + "version": "6.4" + } + ], + "params": [ + { + "key": "f", + "description": "Comma-separated list of the fields to be returned in response. All the fields are returned by default.", + "required": false, + "internal": false, + "deprecatedSince": "5.4", + "possibleValues": [ + "name", + "email", + "avatart", + "scmAccounts", + "groups", + "active", + "local", + "externalIdentity", + "externalProvider" + ] + }, + { + "key": "p", + "description": "1-based page number", + "required": false, + "internal": false, + "defaultValue": "1", + "exampleValue": "42", + "deprecatedKey": "pageIndex", + "deprecatedKeySince": "5.2" + }, + { + "key": "ps", + "description": "Page size. Must be greater than 0 and less than 500", + "required": false, + "internal": false, + "defaultValue": "50", + "exampleValue": "20", + "deprecatedKey": "pageSize", + "deprecatedKeySince": "5.2", + "maximumValue": 500 + }, + { + "key": "q", + "description": "Filter on login or name.", + "required": false, + "internal": false + } + ] + }, + { + "key": "skip_onboarding_tutorial", + "description": "Stores that the user has skipped the onboarding tutorial and does not want to see it after future logins.<br/>Requires authentication.", + "since": "6.5", + "internal": true, + "post": true, + "hasResponseExample": false, + "changelog": [] + }, + { + "key": "update", + "description": "Update a user. If a deactivated user account exists with the given login, it will be reactivated. Requires Administer System permission", + "since": "3.7", + "internal": false, + "post": true, + "hasResponseExample": true, + "changelog": [ + { + "description": "User's password can only be changed using the 'change_password' action.", + "version": "5.2" + } + ], + "params": [ + { + "key": "email", + "description": "User email", + "required": false, + "internal": false, + "exampleValue": "myname@email.com", + "maximumLength": 100 + }, + { + "key": "login", + "description": "User login", + "required": true, + "internal": false, + "exampleValue": "myuser", + "maximumLength": 255 + }, + { + "key": "name", + "description": "User name", + "required": false, + "internal": false, + "exampleValue": "My Name", + "maximumLength": 200 + }, + { + "key": "scmAccount", + "description": "SCM accounts. To set several values, the parameter must be called once for each value.", + "required": false, + "internal": false, + "exampleValue": "scmAccount=firstValue&scmAccount=secondValue&scmAccount=thirdValue" + }, + { + "key": "scmAccounts", + "description": "This parameter is deprecated, please use 'scmAccount' instead", + "required": false, + "internal": false, + "exampleValue": "myscmaccount1,myscmaccount2", + "deprecatedSince": "6.1", + "deprecatedKey": "scm_accounts", + "deprecatedKeySince": "6.0" + } + ] + } + ] + }, + { + "path": "api/webhooks", + "since": "6.2", + "description": "Webhooks allow to notify external services when a project analysis is done", + "actions": [ + { + "key": "deliveries", + "description": "Get the recent deliveries for a specified project or Compute Engine task.<br/>Require 'Administer' permission on the related project.<br/>Note that additional information are returned by api/webhooks/delivery.", + "since": "6.2", + "internal": false, + "post": false, + "hasResponseExample": true, + "changelog": [], + "params": [ + { + "key": "ceTaskId", + "description": "Id of the Compute Engine task", + "required": false, + "internal": false, + "exampleValue": "AU-Tpxb--iU5OvuD2FLy" + }, + { + "key": "componentKey", + "description": "Key of the project", + "required": false, + "internal": false, + "exampleValue": "my-project" + } + ] + }, + { + "key": "delivery", + "description": "Get a webhook delivery by its id.<br/>Require 'Administer System' permission.<br/>Note that additional information are returned by api/webhooks/delivery.", + "since": "6.2", + "internal": false, + "post": false, + "hasResponseExample": true, + "changelog": [], + "params": [ + { + "key": "deliveryId", + "description": "Id of delivery", + "required": true, + "internal": false, + "exampleValue": "AU-TpxcA-iU5OvuD2FL3" + } + ] + } + ] + }, + { + "path": "api/webservices", + "since": "4.2", + "description": "Get information on the web api supported on this instance.", + "actions": [ + { + "key": "list", + "description": "List web services", + "since": "4.2", + "internal": false, + "post": false, + "hasResponseExample": true, + "changelog": [], + "params": [ + { + "key": "include_internals", + "description": "Include web services that are implemented for internal use only. Their forward-compatibility is not assured", + "required": false, + "internal": false, + "defaultValue": "false", + "possibleValues": [ + "true", + "false", + "yes", + "no" + ] + } + ] + }, + { + "key": "response_example", + "description": "Display web service response example", + "since": "4.4", + "internal": false, + "post": false, + "hasResponseExample": true, + "changelog": [], + "params": [ + { + "key": "action", + "description": "Action of the web service", + "required": true, + "internal": false, + "exampleValue": "search" + }, + { + "key": "controller", + "description": "Controller of the web service", + "required": true, + "internal": false, + "exampleValue": "api/issues" + } + ] + } + ] + }, + { + "path": "batch", + "since": "4.4", + "description": "Get JAR files and referentials for batch", + "actions": [ + { + "key": "file", + "description": "Download a JAR file listed in the index (see batch/index)", + "since": "4.4", + "internal": true, + "post": false, + "hasResponseExample": true, + "changelog": [], + "params": [ + { + "key": "name", + "description": "File name", + "required": false, + "internal": false, + "exampleValue": "batch-library-2.3.jar" + } + ] + }, + { + "key": "index", + "description": "List the JAR files to be downloaded by scanners", + "since": "4.4", + "internal": true, + "post": false, + "hasResponseExample": true, + "changelog": [] + }, + { + "key": "issues", + "description": "Return open issues", + "since": "5.1", + "internal": true, + "post": false, + "hasResponseExample": true, + "changelog": [], + "params": [ + { + "key": "branch", + "description": "Branch key", + "since": "6.6", + "required": false, + "internal": false, + "exampleValue": "feature/my_branch" + }, + { + "key": "key", + "description": "Project, module or file key", + "required": true, + "internal": false, + "exampleValue": "my_project" + } + ] + }, + { + "key": "project", + "description": "Return project repository", + "since": "4.5", + "internal": true, + "post": false, + "hasResponseExample": true, + "changelog": [], + "params": [ + { + "key": "branch", + "description": "Branch key", + "since": "6.6", + "required": false, + "internal": false, + "exampleValue": "feature/my_branch" + }, + { + "key": "issues_mode", + "description": "Issues mode or not", + "required": false, + "internal": false, + "defaultValue": "false", + "possibleValues": [ + "true", + "false", + "yes", + "no" + ] + }, + { + "key": "key", + "description": "Project or module key", + "required": true, + "internal": false, + "exampleValue": "my_project" + }, + { + "key": "profile", + "description": "Profile name", + "required": false, + "internal": false, + "exampleValue": "SonarQube Way" + } + ] + } + ] + } + ] +} diff --git a/sonar-ws-generator/src/main/resources/webService.vm b/sonar-ws-generator/src/main/resources/webService.vm new file mode 100644 index 00000000000..be2f3bd3d40 --- /dev/null +++ b/sonar-ws-generator/src/main/resources/webService.vm @@ -0,0 +1,94 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 SonarSource SA + * mailto:info AT sonarsource DOT com + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +package $helper.packageName($webService.path.asString); + +import java.util.stream.Collectors; +import javax.annotation.Generated; +import org.sonarqube.ws.MediaTypes; +import org.sonarqube.ws.client.BaseService; +import org.sonarqube.ws.client.GetRequest; +import org.sonarqube.ws.client.PostRequest; +import org.sonarqube.ws.client.WsConnector; +#foreach($action in $webService.actions) +#if ($helper.responseTypeImport($webService.path.asString, $action.key.asString)) +$helper.responseTypeImport($webService.path.asString, $action.key.asString) +#end +#end + +/** + * $webService.description.asString + * @see <a href="$helper.apiDocUrl($webService.path.asString)">Further information about this web service online</a> + */ +@Generated("sonar-ws-generator") +public class $helper.className($webService.path.asString) extends BaseService { + + public $helper.className($webService.path.asString)(WsConnector wsConnector) { + super(wsConnector, "$webService.path.asString"); + } +#foreach($action in $webService.actions) + + /** + * $action.description.asString + * +#if ($action.internal) + * This is part of the internal API. +#end +#if ($action.post.asBoolean) + * This is a POST request. +#else + * This is a GET request. +#end +#if ($action.hasResponseExample) + * @see <a href="$helper.apiDocUrl($webService.path.asString, $action.key.asString)">Further information about this action online (including a response example)</a> +#else + * @see <a href="$helper.apiDocUrl($webService.path.asString, $action.key.asString)">Further information about this action online</a> +#end +#if ($action.since.asString) + * @since $action.since.asString +#end +#if ($action.deprecatedSince) + * @deprecated since $action.deprecatedSince.asString +#end + */ +#if ($action.deprecatedSince) + @Deprecated +#end + public#if ($action.hasResponseExample.asBoolean) $helper.responseType($webService.path.asString, $action.key.asString)#else void#end $helper.methodName($webService.path.asString, $action.key.asString)(#if ($action.params && $action.params.size() > 0)$helper.requestType($webService.path.asString, $action.key.asString) request#end) { + #if ($action.hasResponseExample.asBoolean) return#end call( +#if ($action.post.asBoolean) + new PostRequest(path("$action.key.asString"))#else + new GetRequest(path("$action.key.asString"))#end +#foreach($param in $action.params) +#if ($helper.setterParameterType($param.key.asString, $param.description) == "List<String>") + + .setParam("$param.key.asString", request.${helper.parameterGetter($param.key.asString)}() == null ? null : request.${helper.parameterGetter($param.key.asString)}().stream().collect(Collectors.joining(",")))#else + + .setParam("$param.key.asString", request.${helper.parameterGetter($param.key.asString)}())#end +#end +#if ($helper.responseType($webService.path.asString, $action.key.asString) == "String") + + .setMediaType(MediaTypes.JSON) + ).content(); +#else, + ${helper.responseType($webService.path.asString, $action.key.asString)}.parser()); +#end + } +#end +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/setting/ListDefinitionsRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/setting/ListDefinitionsRequest.java deleted file mode 100644 index 0e2ac0ddb19..00000000000 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/setting/ListDefinitionsRequest.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2017 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -package org.sonarqube.ws.client.setting; - -import javax.annotation.CheckForNull; -import javax.annotation.Nullable; -import javax.annotation.concurrent.Immutable; - -@Immutable -public class ListDefinitionsRequest { - - private final String component; - private final String branch; - - private ListDefinitionsRequest(Builder builder) { - this.component = builder.component; - this.branch = builder.branch; - } - - @CheckForNull - public String getComponent() { - return component; - } - - @CheckForNull - public String getBranch() { - return branch; - } - - public static Builder builder() { - return new Builder(); - } - - public static class Builder { - private String component; - private String branch; - - private Builder() { - // enforce factory method use - } - - public Builder setComponent(@Nullable String component) { - this.component = component; - return this; - } - - public Builder setBranch(@Nullable String branch) { - this.branch = branch; - return this; - } - - public ListDefinitionsRequest build() { - return new ListDefinitionsRequest(this); - } - } - -} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/setting/ResetRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/setting/ResetRequest.java deleted file mode 100644 index 696828eee7d..00000000000 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/setting/ResetRequest.java +++ /dev/null @@ -1,92 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2017 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -package org.sonarqube.ws.client.setting; - -import java.util.List; -import javax.annotation.CheckForNull; -import javax.annotation.Nullable; - -import static com.google.common.base.Preconditions.checkArgument; -import static java.util.Arrays.asList; - -public class ResetRequest { - private final List<String> keys; - private final String component; - private final String branch; - - private ResetRequest(Builder builder) { - this.keys = builder.keys; - this.component = builder.component; - this.branch = builder.branch; - } - - public List<String> getKeys() { - return keys; - } - - @CheckForNull - public String getComponent() { - return component; - } - - @CheckForNull - public String getBranch() { - return branch; - } - - public static Builder builder() { - return new Builder(); - } - - public static class Builder { - private List<String> keys; - private String component; - private String branch; - - private Builder() { - // enforce factory method use - } - - public Builder setKeys(List<String> keys) { - this.keys = keys; - return this; - } - - public Builder setKeys(String... keys) { - setKeys(asList(keys)); - return this; - } - - public Builder setComponent(@Nullable String component) { - this.component = component; - return this; - } - - public Builder setBranch(@Nullable String branch) { - this.branch = branch; - return this; - } - - public ResetRequest build() { - checkArgument(keys != null && !keys.isEmpty(), "Setting keys is mandatory and must not be empty."); - return new ResetRequest(this); - } - } -} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/setting/SetRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/setting/SetRequest.java deleted file mode 100644 index 70834435f46..00000000000 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/setting/SetRequest.java +++ /dev/null @@ -1,126 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2017 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -package org.sonarqube.ws.client.setting; - -import java.util.List; -import javax.annotation.CheckForNull; -import javax.annotation.Nullable; - -import static com.google.common.base.Preconditions.checkArgument; -import static java.util.Collections.emptyList; - -public class SetRequest { - private final String key; - private final String value; - private final List<String> values; - private final List<String> fieldValues; - private final String component; - private final String branch; - - private SetRequest(Builder builder) { - this.key = builder.key; - this.value = builder.value; - this.values = builder.values; - this.fieldValues = builder.fieldValues; - this.component = builder.component; - this.branch = builder.branch; - } - - public String getKey() { - return key; - } - - @CheckForNull - public String getValue() { - return value; - } - - public List<String> getValues() { - return values; - } - - public List<String> getFieldValues() { - return fieldValues; - } - - @CheckForNull - public String getComponent() { - return component; - } - - @CheckForNull - public String getBranch() { - return branch; - } - - public static Builder builder() { - return new Builder(); - } - - public static class Builder { - private String key; - private String value; - private List<String> values = emptyList(); - private List<String> fieldValues = emptyList(); - private String component; - private String branch; - - private Builder() { - // enforce factory method use - } - - public Builder setKey(String key) { - this.key = key; - return this; - } - - public Builder setValue(@Nullable String value) { - this.value = value; - return this; - } - - public Builder setValues(List<String> values) { - this.values = values; - return this; - } - - public Builder setFieldValues(List<String> fieldValues) { - this.fieldValues = fieldValues; - return this; - } - - public Builder setComponent(@Nullable String component) { - this.component = component; - return this; - } - - public Builder setBranch(@Nullable String branch) { - this.branch = branch; - return this; - } - - public SetRequest build() { - checkArgument(key != null && !key.isEmpty(), "Setting key is mandatory and must not be empty"); - checkArgument(values != null, "Setting values must not be null"); - checkArgument(fieldValues != null, "Setting fields values must not be null"); - return new SetRequest(this); - } - } -} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/setting/SettingsService.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/setting/SettingsService.java deleted file mode 100644 index 2fddb192e23..00000000000 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/setting/SettingsService.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2017 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -package org.sonarqube.ws.client.setting; - -import org.sonarqube.ws.Settings.ListDefinitionsWsResponse; -import org.sonarqube.ws.Settings.ValuesWsResponse; -import org.sonarqube.ws.client.BaseService; -import org.sonarqube.ws.client.GetRequest; -import org.sonarqube.ws.client.PostRequest; -import org.sonarqube.ws.client.WsConnector; - -import static org.sonarqube.ws.client.setting.SettingsWsParameters.ACTION_LIST_DEFINITIONS; -import static org.sonarqube.ws.client.setting.SettingsWsParameters.ACTION_RESET; -import static org.sonarqube.ws.client.setting.SettingsWsParameters.ACTION_SET; -import static org.sonarqube.ws.client.setting.SettingsWsParameters.ACTION_VALUES; -import static org.sonarqube.ws.client.setting.SettingsWsParameters.CONTROLLER_SETTINGS; -import static org.sonarqube.ws.client.setting.SettingsWsParameters.PARAM_BRANCH; -import static org.sonarqube.ws.client.setting.SettingsWsParameters.PARAM_COMPONENT; -import static org.sonarqube.ws.client.setting.SettingsWsParameters.PARAM_FIELD_VALUES; -import static org.sonarqube.ws.client.setting.SettingsWsParameters.PARAM_KEY; -import static org.sonarqube.ws.client.setting.SettingsWsParameters.PARAM_KEYS; -import static org.sonarqube.ws.client.setting.SettingsWsParameters.PARAM_VALUE; -import static org.sonarqube.ws.client.setting.SettingsWsParameters.PARAM_VALUES; - -public class SettingsService extends BaseService { - public SettingsService(WsConnector wsConnector) { - super(wsConnector, CONTROLLER_SETTINGS); - } - - public ListDefinitionsWsResponse listDefinitions(ListDefinitionsRequest request) { - GetRequest getRequest = new GetRequest(path(ACTION_LIST_DEFINITIONS)) - .setParam(PARAM_COMPONENT, request.getComponent()) - .setParam(PARAM_BRANCH, request.getBranch()); - return call(getRequest, ListDefinitionsWsResponse.parser()); - } - - public ValuesWsResponse values(ValuesRequest request) { - GetRequest getRequest = new GetRequest(path(ACTION_VALUES)) - .setParam(PARAM_KEYS, inlineMultipleParamValue(request.getKeys())) - .setParam(PARAM_COMPONENT, request.getComponent()) - .setParam(PARAM_BRANCH, request.getBranch()); - return call(getRequest, ValuesWsResponse.parser()); - } - - public void set(SetRequest request) { - call(new PostRequest(path(ACTION_SET)) - .setParam(PARAM_KEY, request.getKey()) - .setParam(PARAM_VALUE, request.getValue()) - .setParam(PARAM_VALUES, request.getValues()) - .setParam(PARAM_FIELD_VALUES, request.getFieldValues()) - .setParam(PARAM_COMPONENT, request.getComponent()) - .setParam(PARAM_BRANCH, request.getBranch())); - } - - public void reset(ResetRequest request) { - call(new PostRequest(path(ACTION_RESET)) - .setParam(PARAM_KEYS, inlineMultipleParamValue(request.getKeys())) - .setParam(PARAM_COMPONENT, request.getComponent()) - .setParam(PARAM_BRANCH, request.getBranch())); - } - -} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/setting/ValuesRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/setting/ValuesRequest.java deleted file mode 100644 index f45d8d015d6..00000000000 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/setting/ValuesRequest.java +++ /dev/null @@ -1,93 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2017 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -package org.sonarqube.ws.client.setting; - -import java.util.ArrayList; -import java.util.List; -import javax.annotation.CheckForNull; -import javax.annotation.Nullable; - -import static java.util.Arrays.asList; -import static java.util.Objects.requireNonNull; - -public class ValuesRequest { - - private final List<String> keys; - private final String component; - private final String branch; - - private ValuesRequest(Builder builder) { - this.keys = builder.keys; - this.component = builder.component; - this.branch = builder.branch; - } - - public List<String> getKeys() { - return keys; - } - - @CheckForNull - public String getComponent() { - return component; - } - - @CheckForNull - public String getBranch() { - return branch; - } - - public static Builder builder() { - return new Builder(); - } - - public static class Builder { - private List<String> keys = new ArrayList<>(); - private String component; - private String branch; - - private Builder() { - // enforce factory method use - } - - public Builder setKeys(List<String> keys) { - this.keys = requireNonNull(keys); - return this; - } - - public Builder setKeys(String... keys) { - return setKeys(asList(keys)); - } - - public Builder setComponent(@Nullable String component) { - this.component = component; - return this; - } - - public Builder setBranch(@Nullable String branch) { - this.branch = branch; - return this; - } - - public ValuesRequest build() { - return new ValuesRequest(this); - } - } - -} diff --git a/sonar-ws/src/test/java/org/sonarqube/ws/client/setting/ListDefinitionsRequestTest.java b/sonar-ws/src/test/java/org/sonarqube/ws/client/setting/ListDefinitionsRequestTest.java deleted file mode 100644 index 3a98984c95d..00000000000 --- a/sonar-ws/src/test/java/org/sonarqube/ws/client/setting/ListDefinitionsRequestTest.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2017 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -package org.sonarqube.ws.client.setting; - -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.ExpectedException; - -import static org.assertj.core.api.Assertions.assertThat; - -public class ListDefinitionsRequestTest { - - @Rule - public ExpectedException expectedException = ExpectedException.none(); - - ListDefinitionsRequest.Builder underTest = ListDefinitionsRequest.builder(); - - @Test - public void create_request_with_nothing() { - ListDefinitionsRequest result = underTest.build(); - - assertThat(result.getComponent()).isNull(); - assertThat(result.getBranch()).isNull(); - } - - @Test - public void create_request_with_component() { - ListDefinitionsRequest result = underTest.setComponent("projectKey").build(); - - assertThat(result.getComponent()).isEqualTo("projectKey"); - assertThat(result.getBranch()).isNull(); - } - - @Test - public void create_request_with_component_and_branch() { - ListDefinitionsRequest result = underTest.setComponent("projectKey").setBranch("branch").build(); - - assertThat(result.getComponent()).isEqualTo("projectKey"); - assertThat(result.getBranch()).isEqualTo("branch"); - } - -} diff --git a/sonar-ws/src/test/java/org/sonarqube/ws/client/setting/ResetRequestTest.java b/sonar-ws/src/test/java/org/sonarqube/ws/client/setting/ResetRequestTest.java deleted file mode 100644 index 7d41d60ab3d..00000000000 --- a/sonar-ws/src/test/java/org/sonarqube/ws/client/setting/ResetRequestTest.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2017 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -package org.sonarqube.ws.client.setting; - -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.ExpectedException; - -import static org.assertj.core.api.Assertions.assertThat; - -public class ResetRequestTest { - - @Rule - public ExpectedException expectedException = ExpectedException.none(); - - ResetRequest.Builder underTest = ResetRequest.builder(); - - @Test - public void create_set_request() { - ResetRequest result = underTest.setKeys("my.key").build(); - - assertThat(result.getKeys()).containsOnly("my.key"); - assertThat(result.getComponent()).isNull(); - assertThat(result.getBranch()).isNull(); - } - - @Test - public void component() { - ResetRequest result = underTest.setKeys("my.key").setComponent("project").build(); - - assertThat(result.getKeys()).containsOnly("my.key"); - assertThat(result.getComponent()).isEqualTo("project"); - assertThat(result.getBranch()).isNull(); - } - - @Test - public void component_and_branch() { - ResetRequest result = underTest.setKeys("my.key").setComponent("project").setBranch("branch").build(); - - assertThat(result.getKeys()).containsOnly("my.key"); - assertThat(result.getComponent()).isEqualTo("project"); - assertThat(result.getBranch()).isEqualTo("branch"); - } - - @Test - public void fail_when_empty_keys() { - expectedException.expect(IllegalArgumentException.class); - underTest.setKeys().build(); - } - -} diff --git a/sonar-ws/src/test/java/org/sonarqube/ws/client/setting/SetRequestTest.java b/sonar-ws/src/test/java/org/sonarqube/ws/client/setting/SetRequestTest.java deleted file mode 100644 index fb2a2658ef8..00000000000 --- a/sonar-ws/src/test/java/org/sonarqube/ws/client/setting/SetRequestTest.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2017 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -package org.sonarqube.ws.client.setting; - -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.ExpectedException; - -import static org.assertj.core.api.Assertions.assertThat; - -public class SetRequestTest { - - @Rule - public ExpectedException expectedException = ExpectedException.none(); - - SetRequest.Builder underTest = SetRequest.builder(); - - @Test - public void create_set_request() { - SetRequest result = underTest.setKey("my.key").setValue("my value").build(); - - assertThat(result.getKey()).isEqualTo("my.key"); - assertThat(result.getValue()).isEqualTo("my value"); - assertThat(result.getValues()).isNotNull().isEmpty(); - assertThat(result.getComponent()).isNull(); - assertThat(result.getBranch()).isNull(); - } - - @Test - public void create_request_with_component_key() { - SetRequest result = underTest.setKey("my.key").setValue("my value").setComponent("projectKey").build(); - - assertThat(result.getKey()).isEqualTo("my.key"); - assertThat(result.getValue()).isEqualTo("my value"); - assertThat(result.getComponent()).isEqualTo("projectKey"); - assertThat(result.getBranch()).isNull(); - } - - @Test - public void create_request_with_component_and_branch() { - SetRequest result = underTest.setKey("my.key").setValue("my value").setComponent("projectKey").setBranch("my_branch").build(); - - assertThat(result.getKey()).isEqualTo("my.key"); - assertThat(result.getValue()).isEqualTo("my value"); - assertThat(result.getComponent()).isEqualTo("projectKey"); - assertThat(result.getBranch()).isEqualTo("my_branch"); - } - - @Test - public void fail_when_empty_key() { - expectedException.expect(IllegalArgumentException.class); - expectedException.expectMessage("Setting key is mandatory and must not be empty"); - - underTest - .setKey("") - .setValue("value") - .build(); - } - - @Test - public void fail_when_values_is_null() { - expectedException.expect(IllegalArgumentException.class); - expectedException.expectMessage("Setting values must not be null"); - - underTest.setKey("my.key").setValues(null).build(); - } -} diff --git a/sonar-ws/src/test/java/org/sonarqube/ws/client/setting/SettingsServiceTest.java b/sonar-ws/src/test/java/org/sonarqube/ws/client/setting/SettingsServiceTest.java deleted file mode 100644 index d3215980f70..00000000000 --- a/sonar-ws/src/test/java/org/sonarqube/ws/client/setting/SettingsServiceTest.java +++ /dev/null @@ -1,116 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2017 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -package org.sonarqube.ws.client.setting; - -import org.junit.Rule; -import org.junit.Test; -import org.sonarqube.ws.Settings.ListDefinitionsWsResponse; -import org.sonarqube.ws.Settings.ValuesWsResponse; -import org.sonarqube.ws.client.GetRequest; -import org.sonarqube.ws.client.ServiceTester; -import org.sonarqube.ws.client.WsConnector; - -import static com.google.common.collect.Lists.newArrayList; -import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.Mockito.mock; -import static org.sonarqube.ws.client.setting.SettingsWsParameters.PARAM_BRANCH; -import static org.sonarqube.ws.client.setting.SettingsWsParameters.PARAM_COMPONENT; -import static org.sonarqube.ws.client.setting.SettingsWsParameters.PARAM_FIELD_VALUES; -import static org.sonarqube.ws.client.setting.SettingsWsParameters.PARAM_KEY; -import static org.sonarqube.ws.client.setting.SettingsWsParameters.PARAM_KEYS; -import static org.sonarqube.ws.client.setting.SettingsWsParameters.PARAM_VALUE; -import static org.sonarqube.ws.client.setting.SettingsWsParameters.PARAM_VALUES; - -public class SettingsServiceTest { - - @Rule - public ServiceTester<SettingsService> serviceTester = new ServiceTester<>(new SettingsService(mock(WsConnector.class))); - - private SettingsService underTest = serviceTester.getInstanceUnderTest(); - - @Test - public void list_definitions() { - underTest.listDefinitions(ListDefinitionsRequest.builder() - .setComponent("KEY") - .setBranch("BRANCH") - .build()); - GetRequest getRequest = serviceTester.getGetRequest(); - - assertThat(serviceTester.getGetParser()).isSameAs(ListDefinitionsWsResponse.parser()); - serviceTester.assertThat(getRequest) - .hasParam(PARAM_COMPONENT, "KEY") - .hasParam(PARAM_BRANCH, "BRANCH") - .andNoOtherParam(); - } - - @Test - public void values() { - underTest.values(ValuesRequest.builder() - .setKeys("sonar.debt,sonar.issue") - .setComponent("KEY") - .setBranch("BRANCH") - .build()); - GetRequest getRequest = serviceTester.getGetRequest(); - - assertThat(serviceTester.getGetParser()).isSameAs(ValuesWsResponse.parser()); - serviceTester.assertThat(getRequest) - .hasParam(PARAM_KEYS, "sonar.debt,sonar.issue") - .hasParam(PARAM_COMPONENT, "KEY") - .hasParam(PARAM_BRANCH, "BRANCH") - .andNoOtherParam(); - } - - @Test - public void set() { - underTest.set(SetRequest.builder() - .setKey("sonar.debt") - .setValue("8h") - .setValues(newArrayList("v1", "v2", "v3")) - .setFieldValues(newArrayList("json1", "json2", "json3")) - .setComponent("KEY") - .setBranch("BRANCH") - .build()); - - serviceTester.assertThat(serviceTester.getPostRequest()) - .hasParam(PARAM_KEY, "sonar.debt") - .hasParam(PARAM_VALUE, "8h") - .hasParam(PARAM_VALUES, newArrayList("v1", "v2", "v3")) - .hasParam(PARAM_FIELD_VALUES, newArrayList("json1", "json2", "json3")) - .hasParam(PARAM_COMPONENT, "KEY") - .hasParam(PARAM_BRANCH, "BRANCH") - .andNoOtherParam(); - } - - @Test - public void reset() { - underTest.reset(ResetRequest.builder() - .setKeys("sonar.debt") - .setComponent("KEY") - .setBranch("BRANCH") - .build()); - - serviceTester.assertThat(serviceTester.getPostRequest()) - .hasParam(PARAM_KEYS, "sonar.debt") - .hasParam(PARAM_COMPONENT, "KEY") - .hasParam(PARAM_BRANCH, "BRANCH") - .andNoOtherParam(); - } - -} diff --git a/sonar-ws/src/test/java/org/sonarqube/ws/client/setting/ValuesRequestTest.java b/sonar-ws/src/test/java/org/sonarqube/ws/client/setting/ValuesRequestTest.java deleted file mode 100644 index fa6bdf94074..00000000000 --- a/sonar-ws/src/test/java/org/sonarqube/ws/client/setting/ValuesRequestTest.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2017 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -package org.sonarqube.ws.client.setting; - -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.ExpectedException; - -import static org.assertj.core.api.Assertions.assertThat; - -public class ValuesRequestTest { - - @Rule - public ExpectedException expectedException = ExpectedException.none(); - - ValuesRequest.Builder underTest = ValuesRequest.builder(); - - @Test - public void create_request_with_no_component() { - ValuesRequest result = underTest.setKeys("sonar.debt").build(); - - assertThat(result.getKeys()).containsOnly("sonar.debt"); - assertThat(result.getComponent()).isNull(); - assertThat(result.getBranch()).isNull(); - } - - @Test - public void create_request_with_no_keys() { - ValuesRequest result = underTest.build(); - - assertThat(result.getKeys()).isEmpty(); - assertThat(result.getComponent()).isNull(); - assertThat(result.getBranch()).isNull(); - } - - @Test - public void create_request_with_component() { - ValuesRequest result = underTest.setKeys("sonar.debt").setComponent("projectKey").build(); - - assertThat(result.getKeys()).containsOnly("sonar.debt"); - assertThat(result.getComponent()).isEqualTo("projectKey"); - assertThat(result.getBranch()).isNull(); - } - - @Test - public void create_request_with_component_and_branch() { - ValuesRequest result = underTest.setKeys("sonar.debt").setComponent("projectKey").setBranch("branch").build(); - - assertThat(result.getKeys()).containsOnly("sonar.debt"); - assertThat(result.getComponent()).isEqualTo("projectKey"); - assertThat(result.getBranch()).isEqualTo("branch"); - } - -} diff --git a/tests/pom.xml b/tests/pom.xml index 535ee0bcc2a..3937b0c2fa1 100644 --- a/tests/pom.xml +++ b/tests/pom.xml @@ -39,7 +39,6 @@ <dependency> <groupId>org.sonarsource.orchestrator</groupId> <artifactId>sonar-orchestrator</artifactId> - <version>${orchestrator.version}</version> <scope>test</scope> </dependency> <dependency> |