<?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: Can not access REST API by xmlhttprequest call in javascript in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/Can-not-access-REST-API-by-xmlhttprequest-call-in-javascript/m-p/343739#M22364</link>
    <description>&lt;P&gt;In the curl command youre specifying an existing lookup name "lookupfile.csv".  In the other you're appending the form UID to the lookup name but then that lookup name shouldn't exist unless you already created it.&lt;/P&gt;</description>
    <pubDate>Sat, 22 Apr 2017 17:30:14 GMT</pubDate>
    <dc:creator>jkat54</dc:creator>
    <dc:date>2017-04-22T17:30:14Z</dc:date>
    <item>
      <title>Can not access REST API by xmlhttprequest call in javascript</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Can-not-access-REST-API-by-xmlhttprequest-call-in-javascript/m-p/343738#M22363</link>
      <description>&lt;P&gt;Hi Splunkers,&lt;/P&gt;

&lt;P&gt;Currently I want to change ownership of lookup table and its working fine with curl command&lt;BR /&gt;
&lt;CODE&gt;curl -k -u usr:pwd &lt;A href="https://localhost:8089/servicesNS/&amp;lt;new" target="test_blank"&gt;https://localhost:8089/servicesNS/&amp;lt;new&lt;/A&gt; owner&amp;gt;/app_name/data/lookup-table-files/lookupfile.csv/acl -d owner=&amp;lt;new owner&amp;gt; -d sharing=user&lt;/CODE&gt;&lt;BR /&gt;
This I am implementing in javascript by Ajax and jquery Ajax. But are giving me result 404 page not found error.&lt;BR /&gt;
By XMLHttpRequest:&lt;BR /&gt;
 &lt;CODE&gt;&lt;BR /&gt;
if(window.XMLHttpRequest){&lt;BR /&gt;
                var xmlhttp = new XMLHttpRequest();&lt;BR /&gt;
            }else if(window.ActiveXObject) {&lt;BR /&gt;
                var xmlhttp = new ActiveXObject(Microsoft.XMLHTTP);&lt;BR /&gt;
            }&lt;BR /&gt;
            var record = {&lt;BR /&gt;
                "owner": form_uid,&lt;BR /&gt;
                "sharing": "user"&lt;BR /&gt;
                };&lt;BR /&gt;
            var url = '/servicesNS/'+form_uid+'/app_name/data/lookup-table-files/lookup_'+form_uid+'.csv/acl';&lt;BR /&gt;
            xmlhttp.open("POST", url, true);&lt;BR /&gt;
            xmlhttp.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');&lt;BR /&gt;
            xmlhttp.onreadystatechange = function() {//Call a function when the state changes.&lt;BR /&gt;
                if (xmlhttp.readyState == 4 &amp;amp;&amp;amp; xmlhttp.status == 200) {&lt;BR /&gt;
                    console.log(xmlhttp.responseText);&lt;BR /&gt;
                }&lt;BR /&gt;
            };&lt;BR /&gt;
            xmlhttp.send(JSON.stringify(record));&lt;BR /&gt;
&lt;/CODE&gt;&lt;BR /&gt;
By Jquery Ajax:&lt;BR /&gt;
 &lt;CODE&gt;&lt;BR /&gt;
          $.ajax({&lt;BR /&gt;
                type: "POST",&lt;BR /&gt;
                url:'/servicesNS/'+form_uid+'/app_name/data/lookup-table-files/lookup_'+form_uid+'.csv/acl',&lt;BR /&gt;
                dataType: 'text/csv',&lt;BR /&gt;
                data: JSON.stringify(record),&lt;BR /&gt;
                beforeSend: function (xmlhttp) {&lt;BR /&gt;
                    xmlhttp.setRequestHeader('Accept-Language', 'en_US');&lt;BR /&gt;
                }&lt;BR /&gt;
            });&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;Both ways are giving 404 page not found error. Can any one help me out. Whats wrong in this?&lt;/P&gt;</description>
      <pubDate>Sat, 22 Apr 2017 15:43:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Can-not-access-REST-API-by-xmlhttprequest-call-in-javascript/m-p/343738#M22363</guid>
      <dc:creator>sumangala</dc:creator>
      <dc:date>2017-04-22T15:43:31Z</dc:date>
    </item>
    <item>
      <title>Re: Can not access REST API by xmlhttprequest call in javascript</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Can-not-access-REST-API-by-xmlhttprequest-call-in-javascript/m-p/343739#M22364</link>
      <description>&lt;P&gt;In the curl command youre specifying an existing lookup name "lookupfile.csv".  In the other you're appending the form UID to the lookup name but then that lookup name shouldn't exist unless you already created it.&lt;/P&gt;</description>
      <pubDate>Sat, 22 Apr 2017 17:30:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Can-not-access-REST-API-by-xmlhttprequest-call-in-javascript/m-p/343739#M22364</guid>
      <dc:creator>jkat54</dc:creator>
      <dc:date>2017-04-22T17:30:14Z</dc:date>
    </item>
    <item>
      <title>Re: Can not access REST API by xmlhttprequest call in javascript</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Can-not-access-REST-API-by-xmlhttprequest-call-in-javascript/m-p/343740#M22365</link>
      <description>&lt;P&gt;Before calling this function, I have already created lookup file in that location. Its present above given location, I have verified it.&lt;BR /&gt;
Problem here is why this Ajax call for this API giving me 404 error.&lt;BR /&gt;
How to resolve or how to write REST API call from javascript?&lt;/P&gt;</description>
      <pubDate>Sun, 23 Apr 2017 05:23:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Can-not-access-REST-API-by-xmlhttprequest-call-in-javascript/m-p/343740#M22365</guid>
      <dc:creator>sumangala</dc:creator>
      <dc:date>2017-04-23T05:23:20Z</dc:date>
    </item>
    <item>
      <title>Re: Can not access REST API by xmlhttprequest call in javascript</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Can-not-access-REST-API-by-xmlhttprequest-call-in-javascript/m-p/343741#M22366</link>
      <description>&lt;P&gt;Something is wrong with the URL.  404 not found means the resource isn't there on the web server.  Have you tried adding &lt;A href="https://localhost:8089"&gt;https://localhost:8089&lt;/A&gt; to the url?&lt;/P&gt;</description>
      <pubDate>Sun, 23 Apr 2017 11:49:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Can-not-access-REST-API-by-xmlhttprequest-call-in-javascript/m-p/343741#M22366</guid>
      <dc:creator>jkat54</dc:creator>
      <dc:date>2017-04-23T11:49:25Z</dc:date>
    </item>
    <item>
      <title>Re: Can not access REST API by xmlhttprequest call in javascript</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Can-not-access-REST-API-by-xmlhttprequest-call-in-javascript/m-p/343742#M22367</link>
      <description>&lt;P&gt;Trying setting up your CORS policy.&lt;/P&gt;

&lt;P&gt;&lt;A href="http://dev.splunk.com/view/webframework-developapps/SP-CAAAEW6"&gt;http://dev.splunk.com/view/webframework-developapps/SP-CAAAEW6&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 24 Apr 2017 02:22:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Can-not-access-REST-API-by-xmlhttprequest-call-in-javascript/m-p/343742#M22367</guid>
      <dc:creator>Damien_Dallimor</dc:creator>
      <dc:date>2017-04-24T02:22:37Z</dc:date>
    </item>
    <item>
      <title>Re: Can not access REST API by xmlhttprequest call in javascript</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Can-not-access-REST-API-by-xmlhttprequest-call-in-javascript/m-p/343743#M22368</link>
      <description>&lt;P&gt;Hi Damien Dallimore,&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;         setting up CORS policy comes only when app outside the splunk web server. I just want to execute this below curl command in javascript. I have tried with XMLHttpRequest and Jquery ajax.
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Both are giving me 404 page not found error.&lt;BR /&gt;
It works fine with curl command. &lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;curl -k -u usr:pwd &lt;A href="https://localhost:8089/servicesNS/&amp;lt;new" target="test_blank"&gt;https://localhost:8089/servicesNS/&amp;lt;new&lt;/A&gt; owner&amp;gt;/app_name/data/lookup-table-files/lookupfile.csv/acl -d owner=&amp;lt;new owner&amp;gt; -d sharing=user&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;Whats going wrong here?&lt;/P&gt;</description>
      <pubDate>Mon, 24 Apr 2017 05:11:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Can-not-access-REST-API-by-xmlhttprequest-call-in-javascript/m-p/343743#M22368</guid>
      <dc:creator>sumangala</dc:creator>
      <dc:date>2017-04-24T05:11:02Z</dc:date>
    </item>
    <item>
      <title>Re: Can not access REST API by xmlhttprequest call in javascript</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Can-not-access-REST-API-by-xmlhttprequest-call-in-javascript/m-p/343744#M22369</link>
      <description>&lt;P&gt;I think your JavaScript will be a part of any of your Splunk screen/view which is serving in 8000 port... When you are trying to access a relative path in ajax (like this &lt;STRONG&gt;var url = '/servicesNS/'+form_uid+'/app_name/data/lookup-table-files/lookup_'+form_uid+'.csv/acl';&lt;/STRONG&gt;) it will make call to &lt;BR /&gt;
&lt;STRONG&gt;"http(s)://localhost:8000/servicesNS/'+form_uid+'/app_name/data/lookup-table-files/lookup_'+form_uid+'.csv/acl';"&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;And obviously that end point is not available in splunk web running on 8000 port...&lt;/P&gt;

&lt;P&gt;That is why you are getting 404 error here&lt;/P&gt;

&lt;P&gt;Try things in this link...  This is what you want..&lt;/P&gt;

&lt;P&gt;&lt;A href="http://dev.splunk.com/javascript" target="_blank"&gt;http://dev.splunk.com/javascript&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;&lt;A href="http://dev.splunk.com/view/javascript-sdk/SP-CAAAEC9" target="_blank"&gt;http://dev.splunk.com/view/javascript-sdk/SP-CAAAEC9&lt;/A&gt; &lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 13:47:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Can-not-access-REST-API-by-xmlhttprequest-call-in-javascript/m-p/343744#M22369</guid>
      <dc:creator>paramagurukarth</dc:creator>
      <dc:date>2020-09-29T13:47:36Z</dc:date>
    </item>
    <item>
      <title>Re: Can not access REST API by xmlhttprequest call in javascript</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Can-not-access-REST-API-by-xmlhttprequest-call-in-javascript/m-p/343745#M22370</link>
      <description>&lt;P&gt;What was the fix?&lt;/P&gt;</description>
      <pubDate>Mon, 24 Apr 2017 11:22:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Can-not-access-REST-API-by-xmlhttprequest-call-in-javascript/m-p/343745#M22370</guid>
      <dc:creator>jkat54</dc:creator>
      <dc:date>2017-04-24T11:22:32Z</dc:date>
    </item>
    <item>
      <title>Re: Can not access REST API by xmlhttprequest call in javascript</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Can-not-access-REST-API-by-xmlhttprequest-call-in-javascript/m-p/343746#M22371</link>
      <description>&lt;P&gt;Ya.. I changed API call to &lt;CODE&gt;&lt;A href="https://localhost:8089/servicesNS/'+form_uid+'/app_name/data/lookup-table-files/lookup_'+form_uid+'.csv/acl" target="test_blank"&gt;https://localhost:8089/servicesNS/'+form_uid+'/app_name/data/lookup-table-files/lookup_'+form_uid+'.csv/acl&lt;/A&gt;&lt;/CODE&gt; Its working fine.&lt;BR /&gt;
Currently I am getting &lt;CODE&gt;net::ERR_CONNECTION_REFUSED&lt;/CODE&gt; error.&lt;BR /&gt;
I checked internet connection and removed proxy setting. Still error is there.&lt;/P&gt;</description>
      <pubDate>Mon, 24 Apr 2017 11:40:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Can-not-access-REST-API-by-xmlhttprequest-call-in-javascript/m-p/343746#M22371</guid>
      <dc:creator>sumangala</dc:creator>
      <dc:date>2017-04-24T11:40:56Z</dc:date>
    </item>
    <item>
      <title>Re: Can not access REST API by xmlhttprequest call in javascript</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Can-not-access-REST-API-by-xmlhttprequest-call-in-javascript/m-p/343747#M22372</link>
      <description>&lt;P&gt;As I was calling REST API from &lt;CODE&gt;url = '/servicesNS/'+form_uid+'/app_name/data/lookup-table-files/lookup_'+form_uid+'.csv/acl'&lt;/CODE&gt; Assuming that it will append prefix its part.&lt;BR /&gt;
But, it was pointing to web server port 8000&lt;BR /&gt;
&lt;CODE&gt;'http(s)://localhost:8000/servicesNS/'+form_uid+'/app_name/data/lookup-table-files/lookup_'+form_uid+'.csv/acl'&lt;/CODE&gt;&lt;BR /&gt;
I changed to management port 8089&lt;BR /&gt;
&lt;CODE&gt;&lt;A href="https://localhost:8089/servicesNS/'+form_uid+'/app_name/data/lookup-table-files/lookup_'+form_uid+'.csv/acl" target="test_blank"&gt;https://localhost:8089/servicesNS/'+form_uid+'/app_name/data/lookup-table-files/lookup_'+form_uid+'.csv/acl&lt;/A&gt;&lt;/CODE&gt;&lt;BR /&gt;
It worked fine.&lt;BR /&gt;
Thank u..&lt;/P&gt;</description>
      <pubDate>Mon, 24 Apr 2017 12:07:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Can-not-access-REST-API-by-xmlhttprequest-call-in-javascript/m-p/343747#M22372</guid>
      <dc:creator>sumangala</dc:creator>
      <dc:date>2017-04-24T12:07:08Z</dc:date>
    </item>
    <item>
      <title>Re: Can not access REST API by xmlhttprequest call in javascript</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Can-not-access-REST-API-by-xmlhttprequest-call-in-javascript/m-p/343748#M22373</link>
      <description>&lt;P&gt;That's exactly what I suggested yesterday but you accepted this answer instead &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 24 Apr 2017 13:29:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Can-not-access-REST-API-by-xmlhttprequest-call-in-javascript/m-p/343748#M22373</guid>
      <dc:creator>jkat54</dc:creator>
      <dc:date>2017-04-24T13:29:22Z</dc:date>
    </item>
    <item>
      <title>Re: Can not access REST API by xmlhttprequest call in javascript</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Can-not-access-REST-API-by-xmlhttprequest-call-in-javascript/m-p/343749#M22374</link>
      <description>&lt;P&gt;Ya. Yest I had some other issue of header setting and call. &lt;BR /&gt;
Even after changing &lt;CODE&gt;&lt;A href="https://localhost:8089" target="test_blank"&gt;https://localhost:8089&lt;/A&gt;&lt;/CODE&gt; It did worked.&lt;/P&gt;

&lt;P&gt;Thank u so much sir. Now I am trying accept your answer its not there. &lt;BR /&gt;
As both answer are correct (yours and  paramagurukarthikeyan  )&lt;BR /&gt;
How to accept both the answer?&lt;/P&gt;</description>
      <pubDate>Mon, 24 Apr 2017 13:37:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Can-not-access-REST-API-by-xmlhttprequest-call-in-javascript/m-p/343749#M22374</guid>
      <dc:creator>sumangala</dc:creator>
      <dc:date>2017-04-24T13:37:12Z</dc:date>
    </item>
    <item>
      <title>Re: Can not access REST API by xmlhttprequest call in javascript</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Can-not-access-REST-API-by-xmlhttprequest-call-in-javascript/m-p/343750#M22375</link>
      <description>&lt;P&gt;You can only accept one and typically you'd accept the first one that's correct.  Is what it is...&lt;/P&gt;</description>
      <pubDate>Tue, 25 Apr 2017 09:24:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Can-not-access-REST-API-by-xmlhttprequest-call-in-javascript/m-p/343750#M22375</guid>
      <dc:creator>jkat54</dc:creator>
      <dc:date>2017-04-25T09:24:55Z</dc:date>
    </item>
    <item>
      <title>Re: Can not access REST API by xmlhttprequest call in javascript</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Can-not-access-REST-API-by-xmlhttprequest-call-in-javascript/m-p/343751#M22376</link>
      <description>&lt;P&gt;OK.. Thank u for the information.&lt;BR /&gt;
As it is reply to comment of someone else post. There is no accept for reply section of your answer which is correct. &lt;BR /&gt;
I have 1 question:&lt;BR /&gt;
for any management port 8089 REST API access require SSL certification mandatory ?&lt;/P&gt;</description>
      <pubDate>Tue, 25 Apr 2017 09:30:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Can-not-access-REST-API-by-xmlhttprequest-call-in-javascript/m-p/343751#M22376</guid>
      <dc:creator>sumangala</dc:creator>
      <dc:date>2017-04-25T09:30:52Z</dc:date>
    </item>
  </channel>
</rss>

