I am trying to get item from SharePoint list by passing a parameter with the ID to the list and retrieving the item. My code is this:

url: 'http://mysite:5555/_api/web/lists/getbytitle("my list")/items/getbyid(1)',
header: {"Accept": "application/json;odata=verbose"},
success: function(data){ 
Var jsonObject= JSON.parse(data.body);
alert(jsonObject.d.Title);}  });

the file returned is an xml file with a long amount of data, I have an error that I could trace stating: unable to get property d of undefined or null reference

Any hint?

  • The big V in Var is a typo i guess? Take a look with for example fiddler to se how the response you are getting is actually looking Jul 3, 2013 at 5:16
  • I tried that, If I take the url in fiddler and put it in the address bar, I could see the document, but my problem is parsing the document, I have an error when I try to read the item Jul 4, 2013 at 4:27
  • I guess one thing to ensure is that that that you have an Item with ID 1 and that the list is called "my list". Otherwise your code looks correct. I would look at the JSON head data in the Chrome developer tools, that should show you what your trying to display.
    – Stephen
    Feb 18, 2014 at 12:57
  • Any resolution on this? Apr 1, 2014 at 19:24

3 Answers 3


There is no need to parse the data the way you are. A get by ID returns a single object in JSON format.

    url: "https://mysharepoint.com/_api/lists/getbytitle('Test List')/items/getbyid(3)",
    headers: { 'accept': 'application/json;odata=verbose', 'content-type': 'application/json;odata=verbose'},
    success: function(data){ 
}  });

That will return a request body that looks like this:

    "d": {
        "__metadata": {
            "id": "f02d2168-0e8c-40ec-8222-7b97377e550b",
            "uri": "https://sharepoint.domain.com/_api/Web/Lists(guid'efd16a43-aaf4-44fd-a9a1-4634afe328ac')/Items(3)",
            "etag": "\"1\"",
            "type": "SP.Data.Test_x0020_ListListItem"
        "Title": "Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore ",
        "Test_x0020_Item": "Enter Choice #1",
        "DueDate": null,
        "DateCompleted": null,
        "StatusId": 3,
        "OtherInfo": null,
        "ID": 3,
        "Modified": "2014-02-28T02:11:22Z",
        "Created": "2014-02-28T02:11:22Z",
        "AuthorId": 12,
        "EditorId": 12,
        "OData__UIVersionString": "1.0",
        "Attachments": false,
        "GUID": "4769a6db-3a22-4c53-922f-0d6744f82fb0"

Can you try appending Title in the url like this:

url: 'http://mysite:5555/_api/web/lists/getbytitle("my list")/items/getbyid(1)?$select=Title'
  • Thanks Nadeem, Same issue, I opened the request in Fiddler, and copied the GET requested, pasted it in URL in Firefox, and could get the file, but through JavaScript I am not able to retrieve it properly Jul 3, 2013 at 3:55
  • Are you sure about the name of the field. For example I have seen in the past in SharePoint 2010 that REST uses display name of the field minus any spaces and the field names are also case sensitive. See this sharepointnadeem.blogspot.in/2012/01/… Jul 3, 2013 at 4:55
  • I am trying to retrieve the column field that comes by default from SharePoint. Isn't that the case? Jul 3, 2013 at 11:23
  • Just thought you may have changed the name of the field. Jul 3, 2013 at 11:33
  • ah, no, what should I do in that case? Jul 3, 2013 at 11:34

Try this:

url: 'http://mysite:5555/_api/web/lists/getbytitle("my list")/items/getbyid(1)/?$select=Title',
header: {"Accept": "application/json;odata=verbose"},
success: function(data){ 
alert(data.d.results.Title);}  });

It is hard to help you without knowing what your results look like. What does the JSON data look like expanded in your debugging window?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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