How to format SharePoint Rest API Data after calling a list item by ID?

I’m using a rest call to pull data from a SharePoint list by item id. I was able to verify it pulls the list items by id, but I’m running into an issue formatting the data.

Any suggestions would be appreciated.




How do you want the data to be formatted? What issue you are facing?
– Amal Hashim
Jan 14 ’15 at 21:07



I’m using chrome to verify the call is pulling data based on the list id. However, when this code or a variant with for html display no results are being displayed in the browser. If I remove the “(1)” and run the code a collection of data returns to my web page. In short, I’m one list of data to generate multiple web pages. So, I need to key off list value and pull that row of data for each web page.
– Bitspider
Jan 14 ’15 at 21:20



You mean you want to paginate through the items?
– Amal Hashim
Jan 14 ’15 at 21:25



Yes, I’d like to manually create a new page and replace the item id or key off a specific field using an odata call, which would then populate parts of the web page.
– Bitspider
Jan 14 ’15 at 21:32


1 Answer


For getting data for multiple items in the list you can change your logic as below



Amal, Your the Man, thx! I had just realized, I simply modifying the $(data.d.results) to something like $(data.d.results[2]) would suffice. Again, thanks for the learning experience. I’ll make some personal notes. Much appreciated.
– Bitspider
Jan 14 ’15 at 22:08



@Amal Hashim: The code works but is there way to display 30 or 60 items per view. I only see first item and the next button does not work for me.
– Kevin Short
Jun 17 at 15:16



The items array has all values. You can use any jQuery plugin or create code to display accordingly.
– Amal Hashim
Jun 17 at 15:18