public static void defineParams(WebService.NewAction action, Languages languages) {
    action.createParam(PARAM_QUALITY_PROFILE)
      .setDescription("Quality profile name.")
      .setRequired(true)
      .setExampleValue("Sonar way");

    action.createParam(PARAM_LANGUAGE)
      .setDescription("Quality profile language.")
      .setRequired(true)
      .setPossibleValues(Arrays.stream(languages.all()).map(Language::getKey).collect(Collectors.toSet()));
  }
@Test
  public void define_ws_parameters() {
    WebService.Context context = new WebService.Context();
    WebService.NewController controller = context.createController("api/qualityprofiles");
    WebService.NewAction newAction = controller.createAction("do").setHandler((request, response) -> {
    });

    Languages languages = new Languages(newLanguage("java"), newLanguage("js"));
    QProfileReference.defineParams(newAction, languages);

    controller.done();
    WebService.Action action = context.controller("api/qualityprofiles").action("do");
    assertThat(action.param("language")).isNotNull();
    assertThat(action.param("language").possibleValues()).containsOnly("java", "js");
    assertThat(action.param("qualityProfile")).isNotNull();
  }