<?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 REST API - Unauthorized error in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/REST-API-Unauthorized-error/m-p/474505#M81501</link>
    <description>&lt;P&gt;I am trying to connect with REST API and I am able to use this guide &lt;A href="https://answers.splunk.com/answers/685730/can-i-use-rest-api-without-curl.html"&gt;https://answers.splunk.com/answers/685730/can-i-use-rest-api-without-curl.html&lt;/A&gt;  &lt;/P&gt;

&lt;P&gt;I can obtain the session key but on using that, I still get an unauthorized error when trying to pull results of a search.&lt;/P&gt;

&lt;P&gt;I am going through a proxy server to make my request and avoid CORS issues. Any pointers woul dbe appreciated.&lt;/P&gt;</description>
    <pubDate>Thu, 09 Apr 2020 16:41:20 GMT</pubDate>
    <dc:creator>av2214</dc:creator>
    <dc:date>2020-04-09T16:41:20Z</dc:date>
    <item>
      <title>REST API - Unauthorized error</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/REST-API-Unauthorized-error/m-p/474505#M81501</link>
      <description>&lt;P&gt;I am trying to connect with REST API and I am able to use this guide &lt;A href="https://answers.splunk.com/answers/685730/can-i-use-rest-api-without-curl.html"&gt;https://answers.splunk.com/answers/685730/can-i-use-rest-api-without-curl.html&lt;/A&gt;  &lt;/P&gt;

&lt;P&gt;I can obtain the session key but on using that, I still get an unauthorized error when trying to pull results of a search.&lt;/P&gt;

&lt;P&gt;I am going through a proxy server to make my request and avoid CORS issues. Any pointers woul dbe appreciated.&lt;/P&gt;</description>
      <pubDate>Thu, 09 Apr 2020 16:41:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/REST-API-Unauthorized-error/m-p/474505#M81501</guid>
      <dc:creator>av2214</dc:creator>
      <dc:date>2020-04-09T16:41:20Z</dc:date>
    </item>
    <item>
      <title>Re: REST API - Unauthorized error</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/REST-API-Unauthorized-error/m-p/474506#M81502</link>
      <description>&lt;P&gt;How are you using the session key?&lt;/P&gt;</description>
      <pubDate>Thu, 09 Apr 2020 18:13:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/REST-API-Unauthorized-error/m-p/474506#M81502</guid>
      <dc:creator>jkat54</dc:creator>
      <dc:date>2020-04-09T18:13:45Z</dc:date>
    </item>
    <item>
      <title>Re: REST API - Unauthorized error</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/REST-API-Unauthorized-error/m-p/474507#M81503</link>
      <description>&lt;P&gt;The session key is being used to make a POST call to create a job and a GET call to retrieve the results of that job.,,The session key is being used to make a POST call to create a search and then make a GET call to get the search results. &lt;/P&gt;</description>
      <pubDate>Thu, 09 Apr 2020 21:21:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/REST-API-Unauthorized-error/m-p/474507#M81503</guid>
      <dc:creator>serenalekh</dc:creator>
      <dc:date>2020-04-09T21:21:59Z</dc:date>
    </item>
    <item>
      <title>Re: REST API - Unauthorized error</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/REST-API-Unauthorized-error/m-p/474508#M81504</link>
      <description>&lt;P&gt;An example of your POST please...&lt;/P&gt;</description>
      <pubDate>Thu, 09 Apr 2020 22:51:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/REST-API-Unauthorized-error/m-p/474508#M81504</guid>
      <dc:creator>jkat54</dc:creator>
      <dc:date>2020-04-09T22:51:13Z</dc:date>
    </item>
    <item>
      <title>Re: REST API - Unauthorized error</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/REST-API-Unauthorized-error/m-p/474509#M81505</link>
      <description>&lt;P&gt;Here's the example&lt;/P&gt;

&lt;P&gt;$.ajax({&lt;BR /&gt;
            url: url,&lt;BR /&gt;
            type: "POST",&lt;BR /&gt;
            contentType: "application/json",&lt;BR /&gt;
            dataType: "json",&lt;BR /&gt;
            data:'{"search" : "search index=esys_shibboleth OR index= Shibboleth-Audit", "output_mode":"json"}',&lt;BR /&gt;
            beforeSend: function (xhr) {&lt;BR /&gt;
                xhr.setRequestHeader('Authorization', 'Basic' + btoa("username:password"));&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 04:55:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/REST-API-Unauthorized-error/m-p/474509#M81505</guid>
      <dc:creator>serenalekh</dc:creator>
      <dc:date>2020-09-30T04:55:55Z</dc:date>
    </item>
    <item>
      <title>Re: REST API - Unauthorized error</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/REST-API-Unauthorized-error/m-p/474510#M81506</link>
      <description>&lt;P&gt;Instead of passing the username and password if the session key (obtained a login POST call) is passed in this manner : &lt;BR /&gt;
$.ajax({&lt;BR /&gt;
url: url,&lt;BR /&gt;
type: "POST",&lt;BR /&gt;
contentType: "application/json",&lt;BR /&gt;
"Authorization": "Splunk " +  sessionkey,&lt;BR /&gt;
dataType: "json",&lt;BR /&gt;
data:'{"search" : "search index=esys_shibboleth OR index= Shibboleth-Audit", "output_mode":"json"}',&lt;/P&gt;

&lt;P&gt;still throws a 401&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 04:55:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/REST-API-Unauthorized-error/m-p/474510#M81506</guid>
      <dc:creator>serenalekh</dc:creator>
      <dc:date>2020-09-30T04:55:58Z</dc:date>
    </item>
    <item>
      <title>Re: REST API - Unauthorized error</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/REST-API-Unauthorized-error/m-p/474511#M81507</link>
      <description>&lt;P&gt;Doesn't appear you're setting the authorization header correctly in the 2nd example.  Use the same xhdr method you used in the first example but set it with "Authorization:  Splunk AUTHTOKEN"&lt;/P&gt;</description>
      <pubDate>Fri, 10 Apr 2020 11:15:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/REST-API-Unauthorized-error/m-p/474511#M81507</guid>
      <dc:creator>jkat54</dc:creator>
      <dc:date>2020-04-10T11:15:00Z</dc:date>
    </item>
    <item>
      <title>Re: REST API - Unauthorized error</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/REST-API-Unauthorized-error/m-p/474512#M81508</link>
      <description>&lt;P&gt;beforeSend: function (xhr) {&lt;BR /&gt;
xhr.setRequestHeader('Authorization', 'Splunk' + authtoken);&lt;/P&gt;</description>
      <pubDate>Fri, 10 Apr 2020 11:15:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/REST-API-Unauthorized-error/m-p/474512#M81508</guid>
      <dc:creator>jkat54</dc:creator>
      <dc:date>2020-04-10T11:15:58Z</dc:date>
    </item>
    <item>
      <title>Re: REST API - Unauthorized error</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/REST-API-Unauthorized-error/m-p/474513#M81509</link>
      <description>&lt;P&gt;Tried this as well. Still Giving a 401. FYI, these API calls are going through the browser - using client side JS. &lt;/P&gt;</description>
      <pubDate>Fri, 10 Apr 2020 17:28:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/REST-API-Unauthorized-error/m-p/474513#M81509</guid>
      <dc:creator>serenalekh</dc:creator>
      <dc:date>2020-04-10T17:28:51Z</dc:date>
    </item>
    <item>
      <title>Re: REST API - Unauthorized error</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/REST-API-Unauthorized-error/m-p/474514#M81510</link>
      <description>&lt;P&gt;Did you look at your request with packet sniffing or software proxy like fiddler by telerik?&lt;/P&gt;

&lt;P&gt;Something is wrong with your post.  It's that simple.  Otherwise you wouldn't get 401.  &lt;/P&gt;

&lt;P&gt;Is there a space in the header between Splunk and token?&lt;/P&gt;</description>
      <pubDate>Fri, 10 Apr 2020 18:51:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/REST-API-Unauthorized-error/m-p/474514#M81510</guid>
      <dc:creator>jkat54</dc:creator>
      <dc:date>2020-04-10T18:51:08Z</dc:date>
    </item>
    <item>
      <title>Re: REST API - Unauthorized error</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/REST-API-Unauthorized-error/m-p/474515#M81511</link>
      <description>&lt;P&gt;No spaces, Yes i did try to check the request but everything looked fine&lt;/P&gt;</description>
      <pubDate>Fri, 10 Apr 2020 19:06:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/REST-API-Unauthorized-error/m-p/474515#M81511</guid>
      <dc:creator>serenalekh</dc:creator>
      <dc:date>2020-04-10T19:06:25Z</dc:date>
    </item>
    <item>
      <title>Re: REST API - Unauthorized error</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/REST-API-Unauthorized-error/m-p/474516#M81512</link>
      <description>&lt;P&gt;Have you set the splunk admin user/password?  If you're using the default, you can't authenticate with the rest endpoints.  A UNiversal forwarder behaves this way at least...&lt;/P&gt;</description>
      <pubDate>Sun, 12 Apr 2020 12:49:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/REST-API-Unauthorized-error/m-p/474516#M81512</guid>
      <dc:creator>jkat54</dc:creator>
      <dc:date>2020-04-12T12:49:07Z</dc:date>
    </item>
  </channel>
</rss>

