docs: @SuppressWarnings({"UnusedDeclaration"})
      protected void doApi(StaplerRequest req, StaplerResponse resp) throws IOException, ServletException {
          try {
              log.log(Level.INFO, "Initiating Artifactory Release Staging using API");
              // Enforce release permissions
              project.checkPermission(ArtifactoryPlugin.RELEASE);
              // In case a staging user plugin is configured, the init() method invoke it:
              init();
              // Read the values provided by the staging user plugin and assign them to data members in this class.
              // Those values can be overriden by URL arguments sent with the API:
              readStagingPluginValues();
              // Read values from the request and override the staging plugin values:
              overrideStagingPluginParams(req);
              // Schedule the release build:
              Queue.WaitingItem item = Jenkins.getInstance().getQueue().schedule(
                  project, 0,
                  new Action[]{this, new CauseAction(new Cause.UserIdCause())}
              );
              if (item == null) {
                  log.log(Level.SEVERE, "Failed to schedule a release build following a Release API invocation");
                  resp.setStatus(StaplerResponse.SC_INTERNAL_SERVER_ERROR);
              } else {
                  String url = req.getContextPath() + '/' + item.getUrl();
                  JSONObject json = new JSONObject();
                  json.element("queueItem", item.getId());
                  json.element("releaseVersion", getReleaseVersion());
                  json.element("nextVersion", getNextVersion());
                  json.element("releaseBranch", getReleaseBranch());
                  // Must use getOutputStream as sendRedirect uses getOutputStream (and closes it)
                  resp.getOutputStream().print(json.toString());
                  resp.sendRedirect(201, url);
              }
          } catch (Exception e) {
              log.log(Level.SEVERE, "Artifactory Release Staging API invocation failed: " + e.getMessage(), e);
              resp.setStatus(StaplerResponse.SC_INTERNAL_SERVER_ERROR);
              ErrorResponse errorResponse = new ErrorResponse(StaplerResponse.SC_INTERNAL_SERVER_ERROR, e.getMessage());
              ObjectMapper mapper = new ObjectMapper();
              mapper.enable(SerializationFeature.INDENT_OUTPUT);
              resp.getWriter().write(mapper.writeValueAsString(errorResponse));
          }
      }