18 Replies Latest reply on May 16, 2014 7:30 AM by tsctang

    Got “Access to restricted URI denied” error after sent request with URL and credential

    tsctang

      Hi,


      Our company is using IBM Connections Communities currently and going to move a few Communities to external JIVE Community.

      In the mean time, we still need to search contents in JIVE Community from our Portal application.

      I used FireBug tool to get search URL but I have trouble to access your API in the HTML.

      I created a simple HTML file in our testing web server and use XMLHttpRequest with URL as well as credential Sherry Rosenkrantz provided to get results back.

      Unfortunately, I still got “Access to restricted URI denied” error from FireBug console after sent the request (Note 1).

      However, I tried a testing web site http://www.hurl.it with URL string and credential, then it could return results with JSON format (Note 2).

      You can test it yourself:

      1. Go tohttp://www.hurl.it
      2. Pass the following string to Destination text box (I hard-coded “tax” as search string)

      https://adpworks.jiveon.com/api/core/v3/search/contents?collapse=true&fields=rootType%2Ctype%2Csubject%2Cauthor%2Cquestion%2Canswer%2Chelpful%2CparentPlace%2CparentContent%2ChighlightSubject%2ChighlightBody%2ChighlightTags%2CoutcomeCounts%2Cpublished%2Cupdated%2CreplyCount%2ClikeCount%2CviewCount%2CvisibleToExternalContributors%2CbinaryURL&directive=include_rtc&filter=search(tax)

      1. Enter ID/Password api@test.com and service for Authentication.
      2. Hit “Launch Request” button and then you will see the results.

       

      It seems your new ID is working but I could not make it work in my HTML.

      My simple HTML codes are attached (Note 3) and I need your help to resolve this problem.

      Thanks.

       

      Tony Tang

      ADP

      Content Management, Collaboration, & Corporate Apps (C3)

      Office 973-974-4816 Mobile 973-610-5835


       

      Note 1:

      Authentication Error.jpg

      Note 2:

      HuriIt.jpg

      Note 3:

      <html>

      <head>

      <script>

      var commhttpRequest;

       

      function CommCreateObjectCom()

      {

      if (typeof ActiveXObject != 'undefined') {

      commhttpRequest = new ActiveXObject('Microsoft.XMLHTTP');

      }

      else

      if (typeof XMLHttpRequest != 'undefined') {

      commhttpRequest = new XMLHttpRequest();

      }

      return commhttpRequest;

      }

      function CMMSearchvalue(e)

      {

      if(e.keyCode == 13)

      {

      CommCreateObjectCom();

      if (commhttpRequest) {

      var CommSearchValue = "";

      var CommstatusObj = document.getElementById("CMMSearch");

      if (CommstatusObj != null && CommstatusObj != "") {

      CommSearchValue = CommstatusObj.value;

      }

      CommSearchValue= CommSearchValue.replace(/\&/g,'&amp;');

      CommSearchValue= CommSearchValue.replace(/</g,'&lt;');

      CommSearchValue= CommSearchValue.replace(/>/g,'&gt;');

       

      var Commurl="https://adpworks.jiveon.com/api/core/v3/search/contents?collapse=true&fields=rootType%2Ctype%2Csubject%2Cauthor%2Cquestion%2Canswer%2Chelpful%2CparentPlace%2CparentContent%2ChighlightSubject%2ChighlightBody%2ChighlightTags%2CoutcomeCounts%2Cpublished%2Cupdated%2CreplyCount%2ClikeCount%2CviewCount%2CvisibleToExternalContributors%2CbinaryURL&directive=include_rtc&filter=search("+CommSearchValue+")"

       

      commhttpRequest.onreadystatechange = CommunitySearch; //Assigning Async Event to Check Status

      commhttpRequest.open('GET', Commurl,true, 'api@test.com', 'service'); // Open http request

      commhttpRequest.send();

      return commhttpRequest;

      }

      else {

      return void 0;

      }

      }

      }

      function CommunitySearch() {

      if (commhttpRequest.readyState == 4)

      {

      if(commhttpRequest.status==200)

      {

      var commresults = commhttpRequest.responseText;

      commresults=commresults.replace(/<b>/gi,"");

      commresults=commresults.replace(/<\/b>/gi,"");

      alert(commresults);

      //displayResult(commresults);

      }

      }

      }

      </script>

      </head>

       

      <body>

      <div id="adp_taxu_lowerbox2_bottom">

      <div class="taxu_hdr" style="width:595px;">Find an answer</div>

      <div style="overflow-y: auto; height:250px;">

      <br/>

      <span id="SimpleSearch" name="SimpleSearch" style="padding-top:20px;padding-left:30px;padding-bottom:20px;width:600px; font-size:16px; color: #4d4f53;"><b>Search&nbsp&nbsp&nbsp</b><input type="text" name="CMMSearch" id="CMMSearch" onkeypress="CMMSearchvalue(event)"></input>

      </span>

      </div>

      </div>

      </body>

      </html>