<?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 Can you retrieve the /results/ endpoint using |REST instead of a curl? in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/Can-you-retrieve-the-results-endpoint-using-REST-instead-of-a/m-p/393223#M70217</link>
    <description>&lt;P&gt;Hi all,&lt;/P&gt;

&lt;P&gt;Before I dive into the issue, I'd like to explain the goal:&lt;/P&gt;

&lt;P&gt;I have a search that returns some fields including an SID. From there I am attempting a left join on the SID to include the results by using the &lt;CODE&gt;|REST&lt;/CODE&gt; endpoint. I've successfully returned results via a curl, but as of yet I have not succeeded using &lt;CODE&gt;|REST&lt;/CODE&gt;.&lt;/P&gt;

&lt;P&gt;I have attempted these tests on both expired and non-expired SIDs.&lt;/P&gt;

&lt;P&gt;Below is an example of successfully returning results via curl:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;curl -u admin:changeme -k &lt;A href="https://localhost:8089/servicesNS/admin/SplunkEnterpriseSecuritySuite/search/jobs/1545072559.25/results/" target="test_blank"&gt;https://localhost:8089/servicesNS/admin/SplunkEnterpriseSecuritySuite/search/jobs/1545072559.25/results/&lt;/A&gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If I run the following, I successfully retrieve all the various metadata about the search's dispatch itself:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| REST /servicesNS/admin/SplunkEnterpriseSecuritySuite/search/jobs/1545072559.25/
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;However, when I attempt to retrieve the results with the following, I get an error about failing to fetch the rest endpoint:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| REST /servicesNS/admin/SplunkEnterpriseSecuritySuite/search/jobs/1545072559.25/results
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I've also tried various forms of GET as described here:&lt;/P&gt;

&lt;P&gt;&lt;A href="https://docs.splunk.com/Documentation/Splunk/7.0.2/RESTREF/RESTsearch#saved.2Fsearches.2F.7Bname.7D.2Fdispatch"&gt;https://docs.splunk.com/Documentation/Splunk/7.0.2/RESTREF/RESTsearch#saved.2Fsearches.2F.7Bname.7D.2Fdispatch&lt;/A&gt;&lt;/P&gt;

&lt;HR /&gt;

&lt;P&gt;All of this leads me to believe that this is not possible and that the &lt;CODE&gt;|REST&lt;/CODE&gt; command does not have access to all of the endpoints available via curl. If this is the case, is there a way to do what I'm attempting in another fashion, or do I need to resort to a script? A script is possible, but ideally, I'd like to keep it entirely in SPL.&lt;/P&gt;

&lt;P&gt;Edit: We are also considering using &lt;CODE&gt;|loadjob&lt;/CODE&gt; but the &lt;CODE&gt;sid&lt;/CODE&gt; argument seems to treat fields as literal strings. specifying &lt;CODE&gt;savedsearch=&lt;/CODE&gt; has potential, but requires a user:app:search definition, which seems clumsy.&lt;/P&gt;</description>
    <pubDate>Mon, 07 Jan 2019 21:38:08 GMT</pubDate>
    <dc:creator>jadamsplunk</dc:creator>
    <dc:date>2019-01-07T21:38:08Z</dc:date>
    <item>
      <title>Can you retrieve the /results/ endpoint using |REST instead of a curl?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Can-you-retrieve-the-results-endpoint-using-REST-instead-of-a/m-p/393223#M70217</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;

&lt;P&gt;Before I dive into the issue, I'd like to explain the goal:&lt;/P&gt;

&lt;P&gt;I have a search that returns some fields including an SID. From there I am attempting a left join on the SID to include the results by using the &lt;CODE&gt;|REST&lt;/CODE&gt; endpoint. I've successfully returned results via a curl, but as of yet I have not succeeded using &lt;CODE&gt;|REST&lt;/CODE&gt;.&lt;/P&gt;

&lt;P&gt;I have attempted these tests on both expired and non-expired SIDs.&lt;/P&gt;

&lt;P&gt;Below is an example of successfully returning results via curl:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;curl -u admin:changeme -k &lt;A href="https://localhost:8089/servicesNS/admin/SplunkEnterpriseSecuritySuite/search/jobs/1545072559.25/results/" target="test_blank"&gt;https://localhost:8089/servicesNS/admin/SplunkEnterpriseSecuritySuite/search/jobs/1545072559.25/results/&lt;/A&gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If I run the following, I successfully retrieve all the various metadata about the search's dispatch itself:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| REST /servicesNS/admin/SplunkEnterpriseSecuritySuite/search/jobs/1545072559.25/
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;However, when I attempt to retrieve the results with the following, I get an error about failing to fetch the rest endpoint:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| REST /servicesNS/admin/SplunkEnterpriseSecuritySuite/search/jobs/1545072559.25/results
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I've also tried various forms of GET as described here:&lt;/P&gt;

&lt;P&gt;&lt;A href="https://docs.splunk.com/Documentation/Splunk/7.0.2/RESTREF/RESTsearch#saved.2Fsearches.2F.7Bname.7D.2Fdispatch"&gt;https://docs.splunk.com/Documentation/Splunk/7.0.2/RESTREF/RESTsearch#saved.2Fsearches.2F.7Bname.7D.2Fdispatch&lt;/A&gt;&lt;/P&gt;

&lt;HR /&gt;

&lt;P&gt;All of this leads me to believe that this is not possible and that the &lt;CODE&gt;|REST&lt;/CODE&gt; command does not have access to all of the endpoints available via curl. If this is the case, is there a way to do what I'm attempting in another fashion, or do I need to resort to a script? A script is possible, but ideally, I'd like to keep it entirely in SPL.&lt;/P&gt;

&lt;P&gt;Edit: We are also considering using &lt;CODE&gt;|loadjob&lt;/CODE&gt; but the &lt;CODE&gt;sid&lt;/CODE&gt; argument seems to treat fields as literal strings. specifying &lt;CODE&gt;savedsearch=&lt;/CODE&gt; has potential, but requires a user:app:search definition, which seems clumsy.&lt;/P&gt;</description>
      <pubDate>Mon, 07 Jan 2019 21:38:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Can-you-retrieve-the-results-endpoint-using-REST-instead-of-a/m-p/393223#M70217</guid>
      <dc:creator>jadamsplunk</dc:creator>
      <dc:date>2019-01-07T21:38:08Z</dc:date>
    </item>
    <item>
      <title>Re: Can you retrieve the /results/ endpoint using |REST instead of a curl?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Can-you-retrieve-the-results-endpoint-using-REST-instead-of-a/m-p/393224#M70218</link>
      <description>&lt;P&gt;While probably not best practice, you can use the &lt;STRONG&gt;map&lt;/STRONG&gt; function in conjunction with &lt;STRONG&gt;loadjob&lt;/STRONG&gt; (as you mentioned) for a thing like this. Assuming your base result set is not massive, you can store it in a lookup table (haven't tested with KV store but don't see why not) and re-attach it to the results using &lt;STRONG&gt;lookup&lt;/STRONG&gt;. If anyone knows how to make &lt;STRONG&gt;map&lt;/STRONG&gt; simply append the results like a join instead of replacing the results, please chime in.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;YourSearchHere | outputlookup tempForMap.csv
| map search="| loadjob $sid$ | eval sid=$sid$" maxsearches=10
| lookup tempForMap.csv sid OUTPUTNEW
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Note that the above assumes your SIDs are in a column called &lt;EM&gt;sid&lt;/EM&gt;. If you can share additional information about the larger objective here, maybe there's a better way. &lt;/P&gt;

&lt;P&gt;Please let us know how it's panning out or if you found a better solution.&lt;/P&gt;</description>
      <pubDate>Tue, 08 Jan 2019 02:40:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Can-you-retrieve-the-results-endpoint-using-REST-instead-of-a/m-p/393224#M70218</guid>
      <dc:creator>afurrowgtri</dc:creator>
      <dc:date>2019-01-08T02:40:11Z</dc:date>
    </item>
  </channel>
</rss>

