<?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: Bad request error from C# API in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/Bad-request-error-from-C-API/m-p/80318#M16539</link>
    <description>&lt;P&gt;Code passes "--search=..." to API as search string. That is not correct. You would need to pass "searchTerm" directly to the API, for example, "search index=_internal * | head 100".&lt;/P&gt;

&lt;P&gt;"--search=..." is used in the example as a command line argument marker. It is removed and the extracted search term is passed to API.&lt;/P&gt;</description>
    <pubDate>Mon, 07 Oct 2013 16:26:08 GMT</pubDate>
    <dc:creator>ywu_splunk</dc:creator>
    <dc:date>2013-10-07T16:26:08Z</dc:date>
    <item>
      <title>Bad request error from C# API</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Bad-request-error-from-C-API/m-p/80316#M16537</link>
      <description>&lt;P&gt;I am attempting to connect to our Splunk API instance via the C# API to do a search and I am receiving a 400 Bad Request error and I am not having much luck debugging it.&lt;/P&gt;

&lt;P&gt;I am following the Search example in the C# demo solution from Splunk.&lt;/P&gt;

&lt;P&gt;The code looks like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;searchTerm = string.Format("--search=\"{0}\"", searchTerm);
var jobs = SplunkService.GetJobs();
var job = jobs.Create(searchTerm);
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;...and searchTerm equals: &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=prodabtest sourcetype=nlogab e=Development f=Sample v=SampleControl
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I receive the Bad Request on the last line with it tries to create the job.&lt;/P&gt;

&lt;P&gt;This appears to be the same thing the example solution is doing, so I am a bit at a loss.&lt;/P&gt;

&lt;P&gt;Thanks!&lt;/P&gt;

&lt;P&gt;-Will&lt;/P&gt;</description>
      <pubDate>Wed, 02 Oct 2013 20:16:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Bad-request-error-from-C-API/m-p/80316#M16537</guid>
      <dc:creator>wdthem</dc:creator>
      <dc:date>2013-10-02T20:16:59Z</dc:date>
    </item>
    <item>
      <title>Re: Bad request error from C# API</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Bad-request-error-from-C-API/m-p/80317#M16538</link>
      <description>&lt;P&gt;Quick update: I am able to connect to the API instance via Curl, so I am pretty sure all is well with connection and authentication - just unsure of why the API code is throwing the error.&lt;/P&gt;</description>
      <pubDate>Mon, 07 Oct 2013 01:30:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Bad-request-error-from-C-API/m-p/80317#M16538</guid>
      <dc:creator>wdthem</dc:creator>
      <dc:date>2013-10-07T01:30:19Z</dc:date>
    </item>
    <item>
      <title>Re: Bad request error from C# API</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Bad-request-error-from-C-API/m-p/80318#M16539</link>
      <description>&lt;P&gt;Code passes "--search=..." to API as search string. That is not correct. You would need to pass "searchTerm" directly to the API, for example, "search index=_internal * | head 100".&lt;/P&gt;

&lt;P&gt;"--search=..." is used in the example as a command line argument marker. It is removed and the extracted search term is passed to API.&lt;/P&gt;</description>
      <pubDate>Mon, 07 Oct 2013 16:26:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Bad-request-error-from-C-API/m-p/80318#M16539</guid>
      <dc:creator>ywu_splunk</dc:creator>
      <dc:date>2013-10-07T16:26:08Z</dc:date>
    </item>
  </channel>
</rss>

