Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

How to get json data from REST api in SharePoint 2013 list?

Regards,

share|improve this question

2 Answers 2

up vote 1 down vote accepted

Elaborating a bit on Roman's answer:

 jQuery.ajax({
    url: "http://thisRestServiceURL",
    type: "GET",
    headers: { 
        "accept": "application/json;odata=verbose",
        "content-type": "application/json;odata=verbose",
        "X-RequestDigest": $("#__REQUESTDIGEST").val(),
    },

This would work for JQuery sending/receiving JSON Data.

share|improve this answer
    
Add this code to SharePoint site via CEWP? Thanks a lot for help. –  Wilon yesterday
    
Sure you can, but if you're unsure of how to use JQuery to pull SharePoint JSON Data start learning, good resources: api.jquery.com/jQuery.ajax for JQuery ajax command and msdn.microsoft.com/en-us/library/office/jj163876.aspx for the SharePoint REST API overview. –  tekiegreg yesterday
1  
...one last thing, you'll probably find the Script Editor Web Part: community.bamboosolutions.com/blogs/sharepoint-2013/archive/… easier. –  tekiegreg yesterday
    
Thank you, I added script via Script Editor but after saved it, I see simple code on the page, nothig else? –  Wilon yesterday
    
I'm presuming you've thought out your display mechanism, perhaps open a second question and show us the code you've written thus far? –  tekiegreg yesterday

You should pass Accept header, for example: "accept": "application/json;odata=verbose"

share|improve this answer
    
Yes but can you give me more details? –  Wilon yesterday
    
Which type of object model do you use? –  Roman 15 hours ago
    
I've fond good link msdn.microsoft.com/en-us/magazine/dn198245.aspx –  Roman 15 hours ago

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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