Class ApiTool

java.lang.Object
org.apache.solr.cli.ToolBase
org.apache.solr.cli.ApiTool
All Implemented Interfaces:
Tool

public class ApiTool extends ToolBase
Supports api command in the bin/solr script.

Used to send an arbitrary HTTP request to a Solr API endpoint.

  • Constructor Details

  • Method Details

    • getName

      public String getName()
      Description copied from interface: Tool
      Defines the interface to a Solr tool that can be run from this command-line app.
    • getOptions

      public org.apache.commons.cli.Options getOptions()
      Description copied from interface: Tool
      Retrieve the Options supported by this tool.
      Specified by:
      getOptions in interface Tool
      Overrides:
      getOptions in class ToolBase
      Returns:
      The Options this tool supports.
    • runImpl

      public void runImpl(org.apache.commons.cli.CommandLine cli) throws Exception
      Specified by:
      runImpl in class ToolBase
      Throws:
      Exception
    • callGet

      protected String callGet(String url, String credentials) throws Exception
      Throws:
      Exception
    • getSolrUrlFromUri

      public static String getSolrUrlFromUri(URI uri)
      Get Solr base url with port if present and root from URI
      Parameters:
      uri - Full Solr URI (e.g. http://localhost:8983/solr/admin/info/system)
      Returns:
      Solr base url with port and root (from above example http://localhost:8983/solr)
    • getSolrParamsFromUri

      public static org.apache.solr.common.params.ModifiableSolrParams getSolrParamsFromUri(URI uri)