<?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 metadata via REST API in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/metadata-via-REST-API/m-p/26894#M4470</link>
    <description>&lt;P&gt;Guys,&lt;BR /&gt;
From the Search app I do the following search:  &lt;/P&gt;

&lt;P&gt;&lt;EM&gt;| metadata type=hosts&lt;/EM&gt; &lt;/P&gt;

&lt;P&gt;This correctly yields a table of the reporting hosts.  I am using SplunkNet to provide remote search capability.  This seems to work fine for a normal search but not for the metadata search defined above.&lt;/P&gt;

&lt;P&gt;Looking at the rendered search in each case the REST call uses POST method with the following payload:&lt;BR /&gt;
&lt;EM&gt;search=%7c+metadata+type%3dhosts&amp;amp;enable_lookup=False&lt;/EM&gt;&lt;/P&gt;

&lt;P&gt;This looks fairly reasonable but returns no events (expected as this is just metadata) but more importantly no results. In fact the response.CanRead flag is set to false, which would tend to suggest there are no records available.&lt;/P&gt;

&lt;P&gt;Is this sort of search supported via REST?&lt;/P&gt;

&lt;P&gt;Many thanks&lt;/P&gt;</description>
    <pubDate>Mon, 13 Jun 2011 14:23:28 GMT</pubDate>
    <dc:creator>stuartamurray</dc:creator>
    <dc:date>2011-06-13T14:23:28Z</dc:date>
    <item>
      <title>metadata via REST API</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/metadata-via-REST-API/m-p/26894#M4470</link>
      <description>&lt;P&gt;Guys,&lt;BR /&gt;
From the Search app I do the following search:  &lt;/P&gt;

&lt;P&gt;&lt;EM&gt;| metadata type=hosts&lt;/EM&gt; &lt;/P&gt;

&lt;P&gt;This correctly yields a table of the reporting hosts.  I am using SplunkNet to provide remote search capability.  This seems to work fine for a normal search but not for the metadata search defined above.&lt;/P&gt;

&lt;P&gt;Looking at the rendered search in each case the REST call uses POST method with the following payload:&lt;BR /&gt;
&lt;EM&gt;search=%7c+metadata+type%3dhosts&amp;amp;enable_lookup=False&lt;/EM&gt;&lt;/P&gt;

&lt;P&gt;This looks fairly reasonable but returns no events (expected as this is just metadata) but more importantly no results. In fact the response.CanRead flag is set to false, which would tend to suggest there are no records available.&lt;/P&gt;

&lt;P&gt;Is this sort of search supported via REST?&lt;/P&gt;

&lt;P&gt;Many thanks&lt;/P&gt;</description>
      <pubDate>Mon, 13 Jun 2011 14:23:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/metadata-via-REST-API/m-p/26894#M4470</guid>
      <dc:creator>stuartamurray</dc:creator>
      <dc:date>2011-06-13T14:23:28Z</dc:date>
    </item>
    <item>
      <title>Re: metadata via REST API</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/metadata-via-REST-API/m-p/26895#M4471</link>
      <description>&lt;P&gt;Yes, the metadata search can be executed via REST. I can't tell the specifics of the SplunkNet API, but the search string should not start with a leading &lt;CODE&gt;|&lt;/CODE&gt;. I've just successfully tested it with the following POST data:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;search=metadata%20type%3Dhosts
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Here is a simple example how this is done using curl:&lt;/P&gt;

&lt;P&gt;Dispatch the job:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;$curl -k -u admin:changeme -d "search=metadata%20type%3Dhosts" &lt;A href="https://localhost:8089/services/search/jobs" target="test_blank"&gt;https://localhost:8089/services/search/jobs&lt;/A&gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Response:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;?xml version='1.0' encoding='UTF-8'?&amp;gt;
&amp;lt;response&amp;gt;&amp;lt;sid&amp;gt;1308072253.175&amp;lt;/sid&amp;gt;&amp;lt;/response&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Fetch the results:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;curl -k -u admin:changeme &lt;A href="https://localhost:8089/services/search/jobs/1308072253.175/results?output_mode=json" target="test_blank"&gt;https://localhost:8089/services/search/jobs/1308072253.175/results?output_mode=json&lt;/A&gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Response:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;... the results ...&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 14 Jun 2011 17:28:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/metadata-via-REST-API/m-p/26895#M4471</guid>
      <dc:creator>ziegfried</dc:creator>
      <dc:date>2011-06-14T17:28:22Z</dc:date>
    </item>
    <item>
      <title>Re: metadata via REST API</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/metadata-via-REST-API/m-p/26896#M4472</link>
      <description>&lt;P&gt;Awesome!  Much appreciated.  Always the simple things that trip us up!!&lt;/P&gt;</description>
      <pubDate>Thu, 16 Jun 2011 08:30:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/metadata-via-REST-API/m-p/26896#M4472</guid>
      <dc:creator>stuartamurray</dc:creator>
      <dc:date>2011-06-16T08:30:34Z</dc:date>
    </item>
  </channel>
</rss>

