<?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 Re: Why is my REST API call to pass the Job SID to another curl command inside the same shell not working as expected? in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/Why-is-my-REST-API-call-to-pass-the-Job-SID-to-another-curl/m-p/341710#M62969</link>
    <description>&lt;P&gt;Thank you for your response, Sir. But what I could see is the Curl Command 1 seems to be executed , but the response for Curl Command 2 is still blank. &lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;Endpoint&lt;/EM&gt;&lt;/STRONG&gt;&lt;BR /&gt;
curl cmd 1 : search/jobs&lt;BR /&gt;
curl cmd 2: search/jobs/'$sid_id'/results'&lt;/P&gt;

&lt;P&gt;I created a new set of shell with a different end point this time (curl cmd 3: &lt;STRONG&gt;search/jobs&lt;/STRONG&gt; and curl cmd 4: &lt;STRONG&gt;search/sid/summary&lt;/STRONG&gt;) Curl Command 3 and Curl Command 4  both seems to be executed.&lt;/P&gt;

&lt;P&gt;So Now I feel its evident there is something to do with &lt;STRONG&gt;results&lt;/STRONG&gt; endpoint&lt;/P&gt;</description>
    <pubDate>Fri, 22 Dec 2017 07:10:34 GMT</pubDate>
    <dc:creator>vicky05ssr</dc:creator>
    <dc:date>2017-12-22T07:10:34Z</dc:date>
    <item>
      <title>Why is my REST API call to pass the Job SID to another curl command inside the same shell not working as expected?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Why-is-my-REST-API-call-to-pass-the-Job-SID-to-another-curl/m-p/341708#M62967</link>
      <description>&lt;P&gt;Hello All, &lt;/P&gt;

&lt;P&gt;I am trying to execute a savedsearch query through REST API call and passing the Job SID to another curl command for displaying the results, inside the same shell. &lt;/P&gt;

&lt;P&gt;The First curl command for running the saved search gets executed well, but the later one for displaying the results is not getting executed. Need help on this please.&lt;/P&gt;

&lt;H2&gt;My Shell...&lt;/H2&gt;

&lt;PRE&gt;&lt;CODE&gt;data=$(curl -u admin:splunk@sh -k &lt;A href="https://localhost:8089/services/search/jobs" target="test_blank"&gt;https://localhost:8089/services/search/jobs&lt;/A&gt; -d search="search index=_internal xxxxxxx")

sid_id=$(grep -oPm1 "(?&amp;lt;=)[^&amp;lt;]+" &amp;lt;&amp;lt;&amp;lt; "$data") 
echo Sid value is ::"$sid_id"

result=$(curl -k -u admin:splunk@sh 'https://localhost:8089/services/search/jobs/'$sid_id'/results')
echo $result
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;HR /&gt;

&lt;H2&gt;Output of above shell when ran on putty is below:&lt;/H2&gt;

&lt;PRE&gt;&lt;CODE&gt;[root]$ ./Test.sh 

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0    90    0    90    0   223    780   1933 --:--:-- --:--:-- --:--:--     0

Sid value is ::1513337238.971

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 15 Dec 2017 11:42:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Why-is-my-REST-API-call-to-pass-the-Job-SID-to-another-curl/m-p/341708#M62967</guid>
      <dc:creator>vicky05ssr</dc:creator>
      <dc:date>2017-12-15T11:42:49Z</dc:date>
    </item>
    <item>
      <title>Re: Why is my REST API call to pass the Job SID to another curl command inside the same shell not working as expected?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Why-is-my-REST-API-call-to-pass-the-Job-SID-to-another-curl/m-p/341709#M62968</link>
      <description>&lt;P&gt;You're not specifying what to do with results in second curl command. Try like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;result=$(curl -k -u admin:splunk@sh 'https://localhost:8089/services/search/jobs/'$sid_id'/results' --get -d output_mode=csv)
 echo $result
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Other options for output_mode are json and xml.&lt;/P&gt;</description>
      <pubDate>Fri, 15 Dec 2017 19:23:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Why-is-my-REST-API-call-to-pass-the-Job-SID-to-another-curl/m-p/341709#M62968</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2017-12-15T19:23:44Z</dc:date>
    </item>
    <item>
      <title>Re: Why is my REST API call to pass the Job SID to another curl command inside the same shell not working as expected?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Why-is-my-REST-API-call-to-pass-the-Job-SID-to-another-curl/m-p/341710#M62969</link>
      <description>&lt;P&gt;Thank you for your response, Sir. But what I could see is the Curl Command 1 seems to be executed , but the response for Curl Command 2 is still blank. &lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;Endpoint&lt;/EM&gt;&lt;/STRONG&gt;&lt;BR /&gt;
curl cmd 1 : search/jobs&lt;BR /&gt;
curl cmd 2: search/jobs/'$sid_id'/results'&lt;/P&gt;

&lt;P&gt;I created a new set of shell with a different end point this time (curl cmd 3: &lt;STRONG&gt;search/jobs&lt;/STRONG&gt; and curl cmd 4: &lt;STRONG&gt;search/sid/summary&lt;/STRONG&gt;) Curl Command 3 and Curl Command 4  both seems to be executed.&lt;/P&gt;

&lt;P&gt;So Now I feel its evident there is something to do with &lt;STRONG&gt;results&lt;/STRONG&gt; endpoint&lt;/P&gt;</description>
      <pubDate>Fri, 22 Dec 2017 07:10:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Why-is-my-REST-API-call-to-pass-the-Job-SID-to-another-curl/m-p/341710#M62969</guid>
      <dc:creator>vicky05ssr</dc:creator>
      <dc:date>2017-12-22T07:10:34Z</dc:date>
    </item>
  </channel>
</rss>

