<?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: Splunk rest api returns multiple json records- Can we force it to send it as a list? in All Apps and Add-ons</title>
    <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Splunk-rest-api-returns-multiple-json-records-Can-we-force-it-to/m-p/629659#M78445</link>
    <description>&lt;P&gt;To specify the response format, use the output mode parameter in your REST API call. When you set it to "JSON," the response is returned as a single JSON object that can be easily parsed. Here's an illustration:&lt;/P&gt;&lt;LI-CODE lang="php"&gt;https://&amp;lt;host&amp;gt;:&amp;lt;port&amp;gt;/services/search/jobs/export?output_mode=json&amp;amp;search=&amp;lt;search query&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;Replace host&amp;gt; and port&amp;gt; with the values for your Splunk instance, and search query&amp;gt; with your desired search query.&lt;/P&gt;</description>
    <pubDate>Mon, 06 Feb 2023 01:22:43 GMT</pubDate>
    <dc:creator>2MuchC0ff33</dc:creator>
    <dc:date>2023-02-06T01:22:43Z</dc:date>
    <item>
      <title>Splunk rest api returns multiple json records- Can we force it to send it as a list?</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Splunk-rest-api-returns-multiple-json-records-Can-we-force-it-to/m-p/629652#M78444</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am trying to use splunk rest api to call the logs to do some dashboarding in our external application.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There will be a java middle ware that will call these api and response will be parsed by the UI. But when i call the splunk rest api it returns multiple json records but not as a list. Just seperate json records , It will be troublesome to parse it as its not&amp;nbsp; a list . How do we make sure the response from splunk rest api is just 1 valid json that can be parsed?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The screen shows the query and response from postman. How do we get a single json response from Splunk that has these json results as a list that can be parsed&amp;nbsp; easily by a program&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="splunk-respose-rest-api.png" style="width: 999px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/23720iD4BDDE3AE53F052F/image-size/large?v=v2&amp;amp;px=999" role="button" title="splunk-respose-rest-api.png" alt="splunk-respose-rest-api.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 06 Feb 2023 00:16:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Splunk-rest-api-returns-multiple-json-records-Can-we-force-it-to/m-p/629652#M78444</guid>
      <dc:creator>HemanthShekar</dc:creator>
      <dc:date>2023-02-06T00:16:25Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk rest api returns multiple json records- Can we force it to send it as a list?</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Splunk-rest-api-returns-multiple-json-records-Can-we-force-it-to/m-p/629659#M78445</link>
      <description>&lt;P&gt;To specify the response format, use the output mode parameter in your REST API call. When you set it to "JSON," the response is returned as a single JSON object that can be easily parsed. Here's an illustration:&lt;/P&gt;&lt;LI-CODE lang="php"&gt;https://&amp;lt;host&amp;gt;:&amp;lt;port&amp;gt;/services/search/jobs/export?output_mode=json&amp;amp;search=&amp;lt;search query&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;Replace host&amp;gt; and port&amp;gt; with the values for your Splunk instance, and search query&amp;gt; with your desired search query.&lt;/P&gt;</description>
      <pubDate>Mon, 06 Feb 2023 01:22:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Splunk-rest-api-returns-multiple-json-records-Can-we-force-it-to/m-p/629659#M78445</guid>
      <dc:creator>2MuchC0ff33</dc:creator>
      <dc:date>2023-02-06T01:22:43Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk rest api returns multiple json records- Can we force it to send it as a list?</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Splunk-rest-api-returns-multiple-json-records-Can-we-force-it-to/m-p/629661#M78446</link>
      <description>&lt;P&gt;It's already used as part of request parameters.&amp;nbsp;&lt;/P&gt;&lt;P&gt;We are getting output in Json format . Just that we are getting multiple records.&amp;nbsp; One record for each status-code and it's a separate document . Not part of a Json list&lt;/P&gt;</description>
      <pubDate>Mon, 06 Feb 2023 02:00:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Splunk-rest-api-returns-multiple-json-records-Can-we-force-it-to/m-p/629661#M78446</guid>
      <dc:creator>HemanthShekar</dc:creator>
      <dc:date>2023-02-06T02:00:45Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk rest api returns multiple json records- Can we force it to send it as a list?</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Splunk-rest-api-returns-multiple-json-records-Can-we-force-it-to/m-p/629662#M78447</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/253522"&gt;@2MuchC0ff33&lt;/a&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 06 Feb 2023 02:01:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Splunk-rest-api-returns-multiple-json-records-Can-we-force-it-to/m-p/629662#M78447</guid>
      <dc:creator>HemanthShekar</dc:creator>
      <dc:date>2023-02-06T02:01:15Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk rest api returns multiple json records- Can we force it to send it as a list?</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Splunk-rest-api-returns-multiple-json-records-Can-we-force-it-to/m-p/629825#M78452</link>
      <description>&lt;P&gt;In that case,&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/253582"&gt;@HemanthShekar&lt;/a&gt;, you must modify your Splunk search query to return the results as a single JSON object. Use the stats command to aggregate the results and return them as a single JSON object in your search query.&lt;/P&gt;&lt;P&gt;Here's an example:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;GET /services/search/jobs/export?output_mode=json&amp;amp;search=search+index%3D*+earliest%3D-24h%40h+latest%3Dnow+|+stats+values(status_code)+by+status_code&amp;amp;count=1000&lt;/LI-CODE&gt;&lt;P&gt;This will return the count of each status code value as a single JSON object, which your Java middleware can quickly parse. You can modify the search query to meet your specific needs.&lt;/P&gt;</description>
      <pubDate>Tue, 07 Feb 2023 05:20:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Splunk-rest-api-returns-multiple-json-records-Can-we-force-it-to/m-p/629825#M78452</guid>
      <dc:creator>2MuchC0ff33</dc:creator>
      <dc:date>2023-02-07T05:20:03Z</dc:date>
    </item>
  </channel>
</rss>

