I am running into few issues.

Issue # 1:

When I use the following REST endpoint uri in chrome I get XML back. However, IE throws an error (IE cannot display this feed). I downloaded REST API Browser and it gives me 401 UNAUTHORIZED Error.

url: http://off.mci.il/sites/sales/_api/web/lists/GetByTitle('Sales By Region')

Issue # 2

I am trying to display a list on a sharepoint page using Content query web part. But following code does not display anything. I can see there are 120 records by going to developer tool > console. Also added alerts so i can see code are being rendered. what is happening ? I would really appreciated if i can get some help on these 2 issues.

<script type="text/javascript" src="https://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.11.1.min.js"></script>
<script type="text/javascript">
//var results = [];
alert('line 6');

        url: "http://off.mci.il/sites/sales/_api/web/lists/GetByTitle('Sales By Region')/items",
        type: "GET",
        headers: {"Accept": "application/json;odata=verbose"},
        success: function(data){
        var items = [];
        items.push('<ul id="' + 'ListUL' + '">' + 
        '<li id="' + 'ListLI' + '">' + 
        this.Title +
        '</li>' + 

        $.each(data.d.results, function( index, value )
        $('#JSONData').append("<h1>" + value.Title + value.ActiveText + value.SoldTo +"</h1>" + "<h2>" + value.Author + "</h2>");


alert('line 28');

  • I can see the data thru developer tool of IE and chrome – Liz Hankerchief Jun 17 '16 at 13:34


I was having similar issue but I followed this link http://summit7systems.com/who-needs-a-data-view-web-part-sharepoint-rest-and-datatables-net and it worked perfectly. Following is my code (see if it's helpful)

<script type="text/javascript" charset="utf8" src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.8.2.min.js"></script>
<link rel="stylesheet" type="text/css" href="http://ajax.aspnetcdn.com/ajax/jquery.dataTables/1.9.4/css/jquery.dataTables.css">
<script type="text/javascript" charset="utf8" src="http://ajax.aspnetcdn.com/ajax/jquery.dataTables/1.9.4/jquery.dataTables.min.js"></script>

    <table width="100%" cellpadding="0" cellspacing="0" border="0" class="display" id="example">
    <thead><th>City</th><th>State(Y/N)</th><th>Last Modified</th></thead>
    <script type="text/javascript">
    function LoadCities()
    var call = $.ajax({
    url: _spPageContextInfo.webAbsoluteUrl + "/_api/Web/Lists/GetByTitle('Lookup Cities')/items",
    type: "GET",
    dataType: "json",
    headers: {
    Accept: "application/json;odata=verbose"
    call.done(function (data,textStatus, jqXHR){
    "bDestroy": true,
    "bProcessing": true,
    "aaData": data.d.results,
    "aoColumns": [
    { "mData": "City" },
    { "mData": "State" },
    { "mData": "Modified" }
    call.fail(function (jqXHR,textStatus,errorThrown){
    alert("Error retrieving Tasks: " + jqXHR.responseText);
    window.onload = function(){ LoadCities();};
| improve this answer | |
  • It worked perfectly. No errors at all and I am able to display data. – Liz Hankerchief Jun 17 '16 at 16:40
  • You have to explicitly request for a JSON response (if the default response is XML)
  • You need to give the server the RequestDigest (unique token) to prove you are who you are

    headers: {
      "accept": "application/json;odata=verbose",
      "X-RequestDigest": $("#__REQUESTDIGEST").val()
| improve this answer | |
  • still getting access denied. – Liz Hankerchief Jun 17 '16 at 13:20
  • You must be within the same domain. If not it is like trying to get access to your neighbors house – Danny '365CSI' Engelman Jun 17 '16 at 14:51
  • we only have 1 domain at my company. – Liz Hankerchief Jun 17 '16 at 16:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.