@Override public void define(WebService.NewController context) { WebService.NewAction action = context .createAction("list") .setSince("4.2") .setDescription("List web services") .setResponseExample(getClass().getResource("list-example.json")) .setHandler(this); action .createParam("include_internals") .setDescription("Include web services that are implemented for internal use only. Their forward-compatibility is not assured") .setBooleanPossibleValues() .setDefaultValue("false"); }
@Override public void define(WebService.NewController context) { WebService.NewAction action = context.createAction(ACTION) .setPost(false) .setDescription("Search for organizations") .setResponseExample(getClass().getResource("search-example.json")) .setInternal(true) .setSince("6.2") .setChangelog(new Change("7.5", format("Return 'subscription' field when parameter '%s' is set to 'true'", PARAM_MEMBER))) .setChangelog(new Change("7.5", "Removed 'isAdmin' and return 'actions' for each organization")) .setChangelog(new Change("6.4", "Paging fields have been added to the response")) .setHandler(this); action.createParam(PARAM_ORGANIZATIONS) .setDescription("Comma-separated list of organization keys") .setExampleValue(String.join(",", "my-org-1", "foocorp")) .setMaxValuesAllowed(MAX_SIZE) .setRequired(false) .setSince("6.3"); action.createParam(PARAM_MEMBER) .setDescription("Filter organizations based on whether the authenticated user is a member. If false, no filter applies.") .setSince("7.0") .setDefaultValue("false") .setBooleanPossibleValues(); action.addPagingParams(100, MAX_SIZE); }
/** * Add predefined parameters related to sorting of results. */ public <V> NewParam createSortParams(Collection<V> possibleValues, @Nullable V defaultValue, boolean defaultAscending) { createParam(Param.ASCENDING) .setDescription("Ascending sort") .setBooleanPossibleValues() .setDefaultValue(defaultAscending); return createParam(Param.SORT) .setDescription("Sort field") .setDeprecatedKey("sort", "5.4") .setDefaultValue(defaultValue) .setPossibleValues(possibleValues); }
.setBooleanPossibleValues() .setDefaultValue(false) .setDescription("If set to true and if the rule has been deactivated (status 'REMOVED'), a status 409 will be returned");
.setBooleanPossibleValues() .setDefaultValue("false") .setSince("6.6");
action.createParam(PARAM_SEND_NOTIFICATIONS) .setSince("4.0") .setBooleanPossibleValues() .setDefaultValue("false");
.setBooleanPossibleValues() .setDefaultValue(false);
.setBooleanPossibleValues() .setDefaultValue("false") .setSince("6.6");
.setSince("6.3") .setDefaultValue("true") .setBooleanPossibleValues();
.setBooleanPossibleValues() .setDefaultValue("false") .setSince("6.6");
.setDescription("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.") .setBooleanPossibleValues() .setDefaultValue("false");
.createParam(PARAM_ACTIVES) .setDescription("Show rule's activations for all profiles (\"active rules\")") .setBooleanPossibleValues() .setDefaultValue(false);
.setDescription("Issues mode or not") .setDefaultValue(false) .setBooleanPossibleValues();
.setDescription("If set to true, return only the quality profiles marked as default for each language") .setDefaultValue(false) .setBooleanPossibleValues();
@Override public void define(WebService.NewController context) { WebService.NewAction action = context.createAction(ACTION_INDEX) .setDescription("This web service is deprecated, please use api/components/search instead") .setSince("2.10") .setDeprecatedSince("6.3") .setHandler(this) .setResponseExample(Resources.getResource(this.getClass(), "index-example.json")); action.setChangelog( new Change("6.3", "The parameters 'desc', 'views', 'libs' and 'versions' have no effect.")); action.createParam(PARAM_PROJECT) .setDescription("key or ID of the project") .setDeprecatedKey("key", "6.4") .setExampleValue(KEY_PROJECT_EXAMPLE_001); action.createParam(PARAM_SEARCH) .setDescription("Substring of project name, case insensitive. Ignored if the parameter key is set") .setExampleValue("Sonar"); action.createParam(PARAM_SUB_PROJECTS) .setDescription("Load sub-projects. Ignored if the parameter key is set") .setDefaultValue("false") .setBooleanPossibleValues(); action.createParam(PARAM_FORMAT) .setDescription("Only json response format is available") .setPossibleValues("json"); addRemovedParameter("desc", action); addRemovedParameter("views", action); addRemovedParameter("libs", action); addRemovedParameter("versions", action); }
@Override public void define(WebService.NewController controller) { WebService.NewAction action = controller .createAction("show") .setResponseExample(getClass().getResource("show-example.json")) .setHandler(this) .setDescription("Return data used by security reports") .setSince("7.3") .setInternal(true); action.createParam(PARAM_PROJECT) .setDescription("Project, view or application key") .setRequired(true); action.createParam(PARAM_BRANCH) .setDescription("Branch name") .setExampleValue("branch-2.0"); action.createParam(PARAM_STANDARD) .setDescription("Security standard") .setPossibleValues(PARAM_OWASP_TOP_10, PARAM_SANS_TOP_25) .setRequired(true); action.createParam(PARAM_INCLUDE_DISTRIBUTION) .setDescription("To return CWE distribution") .setBooleanPossibleValues() .setDefaultValue("false"); }
@Override public void define(WebService.NewController controller) { WebService.NewAction action = controller.createAction(ACTION_ASSIGN) .setDescription("Assign/Unassign an issue. Requires authentication and Browse permission on project") .setSince("3.6") .setChangelog( new Change("6.5", "the database ids of the components are removed from the response"), new Change("6.5", "the response field components.uuid is deprecated. Use components.key instead.")) .setHandler(this) .setResponseExample(Resources.getResource(this.getClass(), "assign-example.json")) .setPost(true); action.createParam(PARAM_ISSUE) .setDescription("Issue key") .setRequired(true) .setExampleValue(Uuids.UUID_EXAMPLE_01); action.createParam(PARAM_ASSIGNEE) .setDescription("Login of the assignee. When not set, it will unassign the issue. Use '%s' to assign to current user", ASSIGN_TO_ME_VALUE) .setExampleValue("admin"); action.createParam(DEPRECATED_PARAM_ME) .setDescription("(deprecated) Assign the issue to the logged-in user. Replaced by the parameter assignee=_me") .setDeprecatedSince("5.2") .setBooleanPossibleValues(); }
@Override public void define(WebService.NewController controller) { NewAction show = controller.createAction(ACTION_SHOW) .setDescription("Show a quality profile") .setSince("6.5") .setResponseExample(getClass().getResource("show-example.json")) .setInternal(true) .setHandler(this); show.createParam(PARAM_KEY) .setDescription("Quality profile key") .setExampleValue(UUID_EXAMPLE_01) .setDeprecatedKey("profile", "6.6") .setRequired(true); show.createParam(PARAM_COMPARE_TO_SONAR_WAY) .setDescription("Add the number of missing rules from the related Sonar way profile in the response") .setInternal(true) .setDefaultValue("false") .setBooleanPossibleValues(); }
static void defineIsExternalParam(WebService.NewAction action) { action .createParam(PARAM_INCLUDE_EXTERNAL) .setDescription("Include external engine rules in the results") .setDefaultValue(false) .setBooleanPossibleValues() .setSince("7.2"); }