locked
The etag value \'\"1\"\' specified in one of the request headers is not valid. Please make sure only one etag value is specified and is valid. RRS feed

  • Question

  • I try to receive data from a SharePoint List by using REST Services. (_vti_bin/ListData.svc)

    This approach worked fine for some days, until I get an error 400 with following error message:

    "The etag value 1 specified in one of the request headers is not valid. Please make sure only one tag value is specified and is valid."

    Hope anybody can help.

    Many thanks in advance.

    

    
    Thursday, July 3, 2014 2:04 PM

Answers

  • Hi,

    According to your post, my understanding is that you had an issue about retrieve data form list using REST in SharePoint 2010.

    I had created a simple demo to retrieve a list item, you can check with the following code snippets.

    <script src="http://code.jquery.com/jquery-1.10.2.min.js" type="text/javascript"></script>
    
    <script type="text/javascript">
    
    _spBodyOnLoadFunctionNames.push("callCSOM");
    
    function callCSOM()
    
    {
    
                    $("#Button1").click(function()
    
                    {                              
    
                                    ExecuteOrDelayUntilScriptLoaded(ready, "sp.js");
    
                    });           
    
    }
    
    function getListItemById(webUrl,listName, itemId, success, failure) {
    
        var url = webUrl + "/_vti_bin/listdata.svc/" + listName + "(" + itemId + ")";
    
        $.ajax({
    
            url: url,
    
            method: "GET",
    
            headers: { "Accept": "application/json; odata=verbose" },
    
            success: function (data) {
    
                success(data.d);
    
            },
    
            error: function (data) {
    
                failure(data.responseJSON.error);
    
            }
    
        });
    
    }
    
    function ready(){
    
    getListItemById('http://sp','ListB',2,function(data){
    
                    
    
            alert(data.Title);
    
      },
    
      function(error){
    
        console.log(JSON.stringify(error));
    
      }
    
    );
    
    }
    
                                                                 
    
    </script>
    
    <input id="Button1" type="button" value="Run Code"/>
    

    Thanks,
    Jason
    Forum Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.


    Jason Guo
    TechNet Community Support

    • Marked as answer by Lindali Sunday, July 13, 2014 9:23 AM
    Friday, July 4, 2014 2:26 AM
  • Dear Jason, thanks a million for your help.

    This error is very weird. After setting the header information as you mentioned, the same error occured.

    After changing the url from "_vti_bin/ListData.svc" (as I used) to "_vti_bin/listdata.svc" (as you mentioned) the error was gone and the item has been loaded correctly again.

    Many thanks and kind regards

    Dirk


    • Marked as answer by TSDEV1 Friday, July 4, 2014 1:12 PM
    • Edited by TSDEV1 Monday, July 7, 2014 7:23 AM
    Friday, July 4, 2014 1:12 PM

All replies

  • Hi,

    According to your post, my understanding is that you had an issue about retrieve data form list using REST in SharePoint 2010.

    I had created a simple demo to retrieve a list item, you can check with the following code snippets.

    <script src="http://code.jquery.com/jquery-1.10.2.min.js" type="text/javascript"></script>
    
    <script type="text/javascript">
    
    _spBodyOnLoadFunctionNames.push("callCSOM");
    
    function callCSOM()
    
    {
    
                    $("#Button1").click(function()
    
                    {                              
    
                                    ExecuteOrDelayUntilScriptLoaded(ready, "sp.js");
    
                    });           
    
    }
    
    function getListItemById(webUrl,listName, itemId, success, failure) {
    
        var url = webUrl + "/_vti_bin/listdata.svc/" + listName + "(" + itemId + ")";
    
        $.ajax({
    
            url: url,
    
            method: "GET",
    
            headers: { "Accept": "application/json; odata=verbose" },
    
            success: function (data) {
    
                success(data.d);
    
            },
    
            error: function (data) {
    
                failure(data.responseJSON.error);
    
            }
    
        });
    
    }
    
    function ready(){
    
    getListItemById('http://sp','ListB',2,function(data){
    
                    
    
            alert(data.Title);
    
      },
    
      function(error){
    
        console.log(JSON.stringify(error));
    
      }
    
    );
    
    }
    
                                                                 
    
    </script>
    
    <input id="Button1" type="button" value="Run Code"/>
    

    Thanks,
    Jason
    Forum Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.


    Jason Guo
    TechNet Community Support

    • Marked as answer by Lindali Sunday, July 13, 2014 9:23 AM
    Friday, July 4, 2014 2:26 AM
  • Dear Jason, thanks a million for your help.

    This error is very weird. After setting the header information as you mentioned, the same error occured.

    After changing the url from "_vti_bin/ListData.svc" (as I used) to "_vti_bin/listdata.svc" (as you mentioned) the error was gone and the item has been loaded correctly again.

    Many thanks and kind regards

    Dirk


    • Marked as answer by TSDEV1 Friday, July 4, 2014 1:12 PM
    • Edited by TSDEV1 Monday, July 7, 2014 7:23 AM
    Friday, July 4, 2014 1:12 PM