<?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: How to use REX in a search called via REST API? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-REX-in-a-search-called-via-REST-API/m-p/586325#M204256</link>
    <description>&lt;P&gt;Having found that url encoding works well (thanks to other posters), I have made some progress! Next to work out how to find the eventId and to be able to do a JOIN in the same search via API.&lt;/P&gt;</description>
    <pubDate>Wed, 23 Feb 2022 22:32:05 GMT</pubDate>
    <dc:creator>Stuartb_</dc:creator>
    <dc:date>2022-02-23T22:32:05Z</dc:date>
    <item>
      <title>How to use REX in a search called via REST API?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-REX-in-a-search-called-via-REST-API/m-p/586308#M204250</link>
      <description>&lt;P&gt;In my first post,&lt;/P&gt;
&lt;P&gt;I need to search Splunk using the REST API. How do I get the system to actually return me some results?&lt;/P&gt;
&lt;P&gt;Steps&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;POST a search, example:&amp;nbsp;&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;search=search index=myIndex earliest=-1d "[nice-keyword]" AND "Nice catch-phrase" | rex field=_raw "reportingSystem\":\s+\"(?&amp;lt;system&amp;gt;\d{3})[\s\S]+operationCode\":\s+\"(?&amp;lt;opcode&amp;gt;\w+)[\s\S]+ticketId\":\s+\"(?&amp;lt;ticket&amp;gt;\d*)[\s\S]+transactionCode\":\s+\"(?&amp;lt;txcode&amp;gt;\w+)[\s\S]+NumericCode\":\s+\"(?&amp;lt;agency&amp;gt;\d*)" | table system, opcode, txcode, agency​&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;In the SEARCH User Interface, this makes a nice report&lt;/LI&gt;
&lt;LI&gt;Grab the job search ID.&lt;/LI&gt;
&lt;LI&gt;Continually GET the job status of the POSTed search until DONE or something else that helps me stop polling.&lt;/LI&gt;
&lt;LI&gt;Ask for the job results. Get 200 OK but no content.&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;How does one actually format a search that can provide actual results via the API?&lt;/P&gt;
&lt;P&gt;Stumped. For days. I'm using Postman before moving on to my favorite middleware tool.&lt;/P&gt;
&lt;P&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Wed, 23 Feb 2022 21:53:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-REX-in-a-search-called-via-REST-API/m-p/586308#M204250</guid>
      <dc:creator>Stuartb_</dc:creator>
      <dc:date>2022-02-23T21:53:27Z</dc:date>
    </item>
    <item>
      <title>Re: How to use REX in a search called via REST API?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-REX-in-a-search-called-via-REST-API/m-p/586325#M204256</link>
      <description>&lt;P&gt;Having found that url encoding works well (thanks to other posters), I have made some progress! Next to work out how to find the eventId and to be able to do a JOIN in the same search via API.&lt;/P&gt;</description>
      <pubDate>Wed, 23 Feb 2022 22:32:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-REX-in-a-search-called-via-REST-API/m-p/586325#M204256</guid>
      <dc:creator>Stuartb_</dc:creator>
      <dc:date>2022-02-23T22:32:05Z</dc:date>
    </item>
  </channel>
</rss>

