@Override public void define(WebService.NewController context) { WebService.NewAction action = context.createAction(ACTION_SEARCH) .setDescription("Search for the authenticated user favorites.<br>" + "Requires authentication.") .setSince("6.3") .setResponseExample(getClass().getResource("search-example.json")) .setHandler(this); action.addPagingParams(100, MAX_PAGE_SIZE); }
@Override public void define(WebService.NewController context) { WebService.NewAction action = context.createAction("search_my_projects") .setDescription("Return list of projects for which the current user has 'Administer' permission. Maximum 1'000 projects are returned.") .setResponseExample(getClass().getResource("search_my_projects-example.json")) .addPagingParams(100, MAX_SIZE) .setSince("6.0") .setInternal(true) .setHandler(this); action.setChangelog(new Change("6.4", "The 'id' field is deprecated in the response")); }
@Override public void define(NewController context) { NewAction action = context.createAction("users") .setDescription("Search for users with membership information with respect to a group.<br>" + "Requires the following permission: 'Administer System'.") .setHandler(this) .setSince("5.2") .setResponseExample(getClass().getResource("users-example.json")) .addSelectionModeParam() .addSearchQuery("freddy", "names", "logins") .addPagingParams(25); defineGroupWsParameters(action); }
@Override public void define(WebService.NewController context) { WebService.NewAction action = context .createAction(ACTION_SEARCH_USERS) .setDescription("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>") .setHandler(this) .setInternal(true) .addSearchQuery("freddy", "names", "logins") .addSelectionModeParam() .addPagingParams(25) .setResponseExample(getClass().getResource("search_users-example.json")) .setSince("6.6"); action.createParam(PARAM_QUALITY_PROFILE) .setDescription("Quality Profile name") .setRequired(true) .setExampleValue("Recommended quality profile"); action .createParam(PARAM_LANGUAGE) .setDescription("Quality profile language") .setRequired(true) .setPossibleValues(Arrays.stream(languages.all()).map(Language::getKey).collect(toSet())); createOrganizationParam(action); }
@Override public void define(WebService.NewController context) { WebService.NewAction action = context .createAction(ACTION_SEARCH_GROUPS) .setDescription("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>") .setHandler(this) .setInternal(true) .addSelectionModeParam() .addSearchQuery("sonar", "group names") .addPagingParams(25) .setResponseExample(getClass().getResource("search_groups-example.json")) .setSince("6.6"); action.createParam(PARAM_QUALITY_PROFILE) .setDescription("Quality Profile name") .setRequired(true) .setExampleValue("Recommended quality profile"); action .createParam(PARAM_LANGUAGE) .setDescription("Quality profile language") .setRequired(true) .setPossibleValues(Arrays.stream(languages.all()).map(Language::getKey).collect(toSet())); createOrganizationParam(action); }
@Override public void define(WebService.NewController context) { WebService.NewAction action = context.createAction("users") .setSince("5.2") .setDescription("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>") .addPagingParams(DEFAULT_PAGE_SIZE, RESULTS_MAX_SIZE) .setChangelog( new Change("7.4", "The response list is returning all users even those without permissions, the users with permission are at the top of the list.")) .setInternal(true) .setResponseExample(getClass().getResource("users-example.json")) .setHandler(this); action.createParam(Param.TEXT_QUERY) .setMinimumLength(SEARCH_QUERY_MIN_LENGTH) .setDescription("Limit search to user names that contain the supplied string. <br/>") .setExampleValue("eri"); createOrganizationParameter(action).setSince("6.2"); wsParameters.createPermissionParameter(action).setRequired(false); createProjectParameters(action); }
@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); }
@Override public void define(WebService.NewController context) { WebService.NewAction action = context.createAction("groups") .setSince("5.2") .setInternal(true) .setDescription("Lists the groups with their permissions.<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 groups, but can be limited to groups 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>") .addPagingParams(DEFAULT_PAGE_SIZE, RESULTS_MAX_SIZE) .setChangelog( new Change("7.4", "The response list is returning all groups even those without permissions, the groups with permission are at the top of the list.")) .setResponseExample(Resources.getResource(getClass(), "groups-example.json")) .setHandler(this); action.createSearchQuery("sonar", "names") .setDescription("Limit search to group names that contain the supplied string.") .setMinimumLength(SEARCH_QUERY_MIN_LENGTH); createOrganizationParameter(action).setSince("6.2"); wsParameters.createPermissionParameter(action).setRequired(false); createProjectParameters(action); }
@Override public void define(WebService.NewController context) { WebService.NewAction action = context.createAction("search_project_permissions") .setDescription("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>") .setResponseExample(getClass().getResource("search_project_permissions-example.json")) .setSince("5.2") .setDeprecatedSince("6.5") .addPagingParams(25) .setHandler(this); action.createParam(Param.TEXT_QUERY) .setDescription("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>") .setExampleValue("apac"); createProjectParameters(action); createRootQualifierParameter(action, newQualifierParameterContext(i18n, resourceTypes)) .setSince("5.3"); }
@Override public void define(WebService.NewController context) { WebService.NewAction action = context.createAction("search_members") .setDescription("Search members of an organization.<br/>" + "Require organization membership.") .setResponseExample(getClass().getResource("search_members-example.json")) .setSince("6.4") .setInternal(true) .setChangelog(new Change("7.3", "This action now requires organization membership")) .setHandler(this); action.createSearchQuery("orwe", "names", "logins") .setMinimumLength(2); action.addPagingParams(50, MAX_LIMIT); action.createParam(Param.SELECTED) .setDescription("Depending on the value, show only selected items (selected=selected) or deselected items (selected=deselected).") .setInternal(true) .setDefaultValue(SELECTED.value()) .setPossibleValues(SELECTED.value(), SelectionMode.DESELECTED.value()); action.createParam(PARAM_ORGANIZATION) .setDescription("Organization key") .setInternal(true) .setRequired(false); }
@Override public void define(NewController context) { NewAction action = context.createAction("groups") .setDescription("Lists the groups a user belongs to. <br/>" + "Requires Administer System permission.") .setHandler(this) .setResponseExample(getClass().getResource("groups-example.json")) .addSelectionModeParam() .addSearchQuery("users", "group names") .addPagingParams(25) .setChangelog(new Change("6.4", "Paging response fields moved to a Paging object"), new Change("6.4", "'default' response field has been added")) .setSince("5.2"); action.createParam(PARAM_LOGIN) .setDescription("A user login") .setExampleValue("admin") .setRequired(true); action.createParam(PARAM_ORGANIZATION) .setDescription("Organization key") .setExampleValue("my-org") .setInternal(true) .setSince("6.4"); }
@Override public void define(WebService.NewController context) { WebService.NewAction action = context.createAction(ACTION); action.setChangelog(new Change("6.4", "The 'uuid' field is deprecated in the response")); action .setDescription("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.") .setResponseExample(Resources.getResource(getClass(), "ghosts-example.json")) .setSince("5.2") .setDeprecatedSince("6.6") .addPagingParams(100, MAX_LIMIT) .addFieldsParam(POSSIBLE_FIELDS) .addSearchQuery("sonar", "names", "keys") .setHandler(this); action.createParam(PARAM_ORGANIZATION) .setDescription("Organization key") .setRequired(false) .setInternal(true) .setSince("6.3"); }
@Override public void define(WebService.NewController controller) { WebService.NewAction action = controller.createAction("search") .setDescription("Get a list of active users. <br/>" + "Administer System permission is required to show the 'groups' field.<br/>" + "Field 'tokensCount' is only accessible to System Administrator and logged in user.<br/>" + "When accessed anonymously, only logins and names are returned.") .setSince("3.6") .setChangelog( new Change("7.4", "External identity is only returned to system administrators"), new Change("6.4", "Paging response fields moved to a Paging object"), new Change("6.4", "Avatar has been added to the response"), new Change("6.4", "Email is only returned when user has Administer System permission")) .setHandler(this) .setResponseExample(getClass().getResource("search-example.json")); action.createFieldsParam(UserJsonWriter.FIELDS) .setDeprecatedSince("5.4"); action.addPagingParams(50, MAX_LIMIT); action.createParam(TEXT_QUERY) .setMinimumLength(2) .setDescription("Filter on login, name and email"); }
@Override public void define(NewController context) { NewAction wsAction = context.createAction("changelog") .setSince("5.2") .setDescription("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).") .setHandler(this) .setResponseExample(getClass().getResource("changelog-example.json")); QProfileWsSupport.createOrganizationParam(wsAction) .setSince("6.4"); QProfileReference.defineParams(wsAction, languages); wsAction.addPagingParams(50, MAX_LIMIT); wsAction.createParam(PARAM_SINCE) .setDescription("Start date for the changelog. <br>" + "Either a date (server timezone) or datetime can be provided.") .setExampleValue("2017-10-19 or 2017-10-19T13:00:00+0200"); wsAction.createParam(PARAM_TO) .setDescription("End date for the changelog. <br>" + "Either a date (server timezone) or datetime can be provided.") .setExampleValue("2017-10-19 or 2017-10-19T13:00:00+0200"); }
@Override public void define(WebService.NewController context) { WebService.NewAction action = context .createAction("template_users") .setSince("5.2") .setDescription("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'.") .addPagingParams(DEFAULT_PAGE_SIZE, RESULTS_MAX_SIZE) .setInternal(true) .setResponseExample(getClass().getResource("template_users-example.json")) .setHandler(this); action.createParam(Param.TEXT_QUERY) .setMinimumLength(SEARCH_QUERY_MIN_LENGTH) .setDescription("Limit search to user names that contain the supplied string. <br/>" + "When this parameter is not set, only users having at least one permission are returned.") .setExampleValue("eri"); wsParameters.createProjectPermissionParameter(action).setRequired(false); createTemplateParameters(action); }
@Override public void define(WebService.NewController controller) { WebService.NewAction action = controller.createAction("provisioned"); action .setDescription( "Get the list of provisioned projects.<br> " + "Web service is deprecated. Use api/projects/search instead, with onProvisionedOnly=true.<br> " + "Require 'Create Projects' permission.") .setSince("5.2") .setDeprecatedSince("6.6") .setResponseExample(Resources.getResource(getClass(), "provisioned-example.json")) .setHandler(this) .addPagingParams(100, MAX_LIMIT) .addSearchQuery("sonar", "names", "keys") .addFieldsParam(POSSIBLE_FIELDS); action.setChangelog( new Change("6.4", "The 'uuid' field is deprecated in the response"), new Change("6.4", "Paging response fields is now in a Paging object")); support.addOrganizationParam(action); }
@Override public void define(NewController context) { WebService.NewAction action = context.createAction("search") .setDescription("Search for user groups.<br>" + "Requires the following permission: 'Administer System'.") .setHandler(this) .setResponseExample(getClass().getResource("search-example.json")) .setSince("5.2") .addFieldsParam(ALL_FIELDS) .addPagingParams(100, MAX_LIMIT) .addSearchQuery("sonar-users", "names") .setChangelog(new Change("6.4", "Paging response fields moved to a Paging object"), new Change("6.4", "'default' response field has been added")); action.createParam(PARAM_ORGANIZATION_KEY) .setDescription("Key of organization. If not set then groups are searched in default organization.") .setExampleValue("my-org") .setSince("6.2") .setInternal(true); }
@Override public void define(WebService.NewController context) { WebService.NewAction action = context.createAction(ACTION) .setDescription("List custom measures. The project id or project key must be provided.<br />" + "Requires 'Administer System' permission or 'Administer' permission on the project.") .setSince("5.2") .setDeprecatedSince("7.4") .addFieldsParam(CustomMeasureJsonWriter.OPTIONAL_FIELDS) .addPagingParams(100, MAX_LIMIT) .setResponseExample(getClass().getResource("example-search.json")) .setHandler(this); action.createParam(PARAM_PROJECT_ID) .setDescription("Project id") .setExampleValue("ce4c03d6-430f-40a9-b777-ad877c00aa4d"); action.createParam(PARAM_PROJECT_KEY) .setDescription("Project key") .setExampleValue(KEY_PROJECT_EXAMPLE_001); }
@Override public void define(WebService.NewController context) { WebService.NewAction action = context.createAction("template_groups") .setSince("5.2") .setInternal(true) .setDescription("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'.") .addPagingParams(DEFAULT_PAGE_SIZE, RESULTS_MAX_SIZE) .setResponseExample(getClass().getResource("template_groups-example.json")) .setHandler(this); action.createParam(TEXT_QUERY) .setMinimumLength(SEARCH_QUERY_MIN_LENGTH) .setDescription("Limit search to group names that contain the supplied string. <br/>" + "When this parameter is not set, only group having at least one permission are returned.") .setExampleValue("eri"); wsParameters.createProjectPermissionParameter(action, false); createTemplateParameters(action); }
@Override public void define(WebService.NewController context) { WebService.NewAction action = context.createAction(ACTION) .setSince("5.2") .setDescription("Search for metrics") .setResponseExample(getClass().getResource("example-search.json")) .addPagingParams(100, MAX_LIMIT) .addFieldsParam(MetricJsonWriter.OPTIONAL_FIELDS) .setHandler(this); action.createParam(PARAM_IS_CUSTOM) .setExampleValue("true") .setDescription("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>"); }