title: Error deleting service using ambari
body: <p>I'm trying to delete a service that failed to install correctly so that I can attempt to reinstall it.</p>
  
  <p>I couldn't find any options for deleting in the ambari UI so I'm trying to delete using the API.  However, I hit an error message:</p>
  
  <pre><code>curl -u admin:admin -H 'X-Requested-By:ambari' -X DELETE \
       'http://localhost:8080/api/v1/clusters/BI4_QSE/services/SPARK'
  {
    "status" : 500,
    "message" : "org.apache.ambari.server.controller.spi.SystemException: 
                 An internal system exception occurred: Cannot remove SPARK.             
                 Desired state STARTED is not removable.  
                 Service must be stopped or disabled."
  }
  </code></pre>
  
  <p>I'm using the dockerised version of IBM Open Platform v4, i.e. IOP_v4000_20150.zip</p>
  
  <p>The ambari version is:</p>
  
  <pre><code>[root@rvm /]# ambari-server --version
  1.7.0_IBM
  </code></pre>
  
  <p>Below is the output from the GET command:</p>
  
  <pre><code>curl -u admin:admin -H 'X-Requested-By:ambari' -X GET \
       'http://localhost:8080/api/v1/clusters/BI4_QSE/services/SPARK'
  {
    "href" : "http://localhost:8080/api/v1/clusters/BI4_QSE/services/SPARK",
    "ServiceInfo" : {
      "cluster_name" : "BI4_QSE",
      "maintenance_state" : "OFF",
      "service_name" : "SPARK",
      "state" : "INSTALLED"
    },
    "components" : [
      {
        "href" : "http://localhost:8080/api/v1/clusters/BI4_QSE/services/SPARK/components/SPARK_CLIENT",
        "ServiceComponentInfo" : {
          "cluster_name" : "BI4_QSE",
          "component_name" : "SPARK_CLIENT",
          "service_name" : "SPARK"
        }
      },
      {
        "href" : "http://localhost:8080/api/v1/clusters/BI4_QSE/services/SPARK/components/SPARK_JOBHISTORYSERVER",
        "ServiceComponentInfo" : {
          "cluster_name" : "BI4_QSE",
          "component_name" : "SPARK_JOBHISTORYSERVER",
          "service_name" : "SPARK"
        }
      },
      {
        "href" : "http://localhost:8080/api/v1/clusters/BI4_QSE/services/SPARK/components/SPARK_THRIFTSERVER",
        "ServiceComponentInfo" : {
          "cluster_name" : "BI4_QSE",
          "component_name" : "SPARK_THRIFTSERVER",
          "service_name" : "SPARK"
        }
      }
    ]
  }
  </code></pre>
  
  <p><strong>Question</strong>: how can I delete and reinstall spark?</p>