<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Using the REST API to install an app from a file in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/Using-the-REST-API-to-install-an-app-from-a-file/m-p/149034#M30348</link>
    <description>&lt;P&gt;Under the topic &lt;A href="http://docs.splunk.com/Documentation/Splunk/6.0.1/RESTAPI/RESTapps#POST_apps.2Fappinstall"&gt;POST apps/appinstall&lt;/A&gt; in the REST API manual, it says that appinstall "Installs a Splunk app from a local file or from a URL." &lt;/P&gt;

&lt;P&gt;What is the meaning of "local file"? Is the file on the Splunk server or is it local to the machine that is posting the request? For example, I have an app on my laptop that I want to install on a remote Splunk machine using the REST API - will this work? [If you can answer any of these questions, you can skip the rest of this!]&lt;/P&gt;

&lt;P&gt;Also, if I want to use python to make the REST API call, how do I set up the call using the Python SDK? Here is some code, but it doesn't work&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;install_endpoint=client.Endpoint("/services/apps/appinstall","")
app_to_install = { 'name' : "/mylaptop/myApp.spl" }
response = install_endpoint.post(path_segment='', owner=None, app=None, sharing=None, **app_to_install)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This code dies with an error on the third line "AttributeError: 'str' object has no attribute '_abspath'"&lt;BR /&gt;&lt;BR /&gt;
Note that prior to this snippet, the code was able to connect to the Splunk server and list the apps that were already installed on the machine. So I think that I just don't understand the arguments to the post function, and maybe I don't understand other aspects of the REST API either.&lt;/P&gt;

&lt;P&gt;Please don't give me a &lt;CODE&gt;curl&lt;/CODE&gt; example - I have several of those but I don't know how to map the &lt;CODE&gt;curl&lt;/CODE&gt; arguments into the Python objects, attributes and functions. I have looked at the Python SDK manual and the REST API manual until I am cross-eyed, and I went through a number of examples that were provided with the SDK as well...&lt;/P&gt;</description>
    <pubDate>Thu, 13 Feb 2014 08:48:39 GMT</pubDate>
    <dc:creator>lguinn2</dc:creator>
    <dc:date>2014-02-13T08:48:39Z</dc:date>
    <item>
      <title>Using the REST API to install an app from a file</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Using-the-REST-API-to-install-an-app-from-a-file/m-p/149034#M30348</link>
      <description>&lt;P&gt;Under the topic &lt;A href="http://docs.splunk.com/Documentation/Splunk/6.0.1/RESTAPI/RESTapps#POST_apps.2Fappinstall"&gt;POST apps/appinstall&lt;/A&gt; in the REST API manual, it says that appinstall "Installs a Splunk app from a local file or from a URL." &lt;/P&gt;

&lt;P&gt;What is the meaning of "local file"? Is the file on the Splunk server or is it local to the machine that is posting the request? For example, I have an app on my laptop that I want to install on a remote Splunk machine using the REST API - will this work? [If you can answer any of these questions, you can skip the rest of this!]&lt;/P&gt;

&lt;P&gt;Also, if I want to use python to make the REST API call, how do I set up the call using the Python SDK? Here is some code, but it doesn't work&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;install_endpoint=client.Endpoint("/services/apps/appinstall","")
app_to_install = { 'name' : "/mylaptop/myApp.spl" }
response = install_endpoint.post(path_segment='', owner=None, app=None, sharing=None, **app_to_install)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This code dies with an error on the third line "AttributeError: 'str' object has no attribute '_abspath'"&lt;BR /&gt;&lt;BR /&gt;
Note that prior to this snippet, the code was able to connect to the Splunk server and list the apps that were already installed on the machine. So I think that I just don't understand the arguments to the post function, and maybe I don't understand other aspects of the REST API either.&lt;/P&gt;

&lt;P&gt;Please don't give me a &lt;CODE&gt;curl&lt;/CODE&gt; example - I have several of those but I don't know how to map the &lt;CODE&gt;curl&lt;/CODE&gt; arguments into the Python objects, attributes and functions. I have looked at the Python SDK manual and the REST API manual until I am cross-eyed, and I went through a number of examples that were provided with the SDK as well...&lt;/P&gt;</description>
      <pubDate>Thu, 13 Feb 2014 08:48:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Using-the-REST-API-to-install-an-app-from-a-file/m-p/149034#M30348</guid>
      <dc:creator>lguinn2</dc:creator>
      <dc:date>2014-02-13T08:48:39Z</dc:date>
    </item>
    <item>
      <title>Re: Using the REST API to install an app from a file</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Using-the-REST-API-to-install-an-app-from-a-file/m-p/149035#M30349</link>
      <description>&lt;P&gt;It is a file local to the remote Splunk server. I just executed this successfully to verify.&lt;/P&gt;

&lt;P&gt;Also , no Splunk restart was required.App was installed and ready to go.&lt;/P&gt;

&lt;P&gt;Here is some Python code for you :&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;import splunklib.client as client

def main():

    args = {'host':'remote-splunk','port':8089,'username':'admin','password':'foobar'}
    service = client.connect(**args)  
    params = {'name':'/home/remotedamien/someapp.spl'}
    service.post('apps/appinstall',**params)

if __name__ == '__main__':
    main();
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 13 Feb 2014 09:01:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Using-the-REST-API-to-install-an-app-from-a-file/m-p/149035#M30349</guid>
      <dc:creator>Damien_Dallimor</dc:creator>
      <dc:date>2014-02-13T09:01:11Z</dc:date>
    </item>
    <item>
      <title>Re: Using the REST API to install an app from a file</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Using-the-REST-API-to-install-an-app-from-a-file/m-p/149036#M30350</link>
      <description>&lt;P&gt;Thank you! &lt;/P&gt;

&lt;P&gt;When I am doing something for the first time, it is often the simple things that stymie me! The example of the &lt;CODE&gt;service.post()&lt;/CODE&gt; helps a lot.&lt;/P&gt;</description>
      <pubDate>Thu, 13 Feb 2014 15:43:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Using-the-REST-API-to-install-an-app-from-a-file/m-p/149036#M30350</guid>
      <dc:creator>lguinn2</dc:creator>
      <dc:date>2014-02-13T15:43:07Z</dc:date>
    </item>
  </channel>
</rss>

