1

I'm making use of the REST API to get lists. But I'm finding the transfer times are varying a lot (between ~1 second and up to 20 seconds). How can I improve this? What should I look into?

http://example.com/sites/mysite/_api/web/lists/getbytitle('My List')/items

4
  • REST is not recommended for large data set. CSOM performs better compared to REST because CSOM requires very less roundtrip compared to REST. Commented Nov 4, 2014 at 23:16
  • I've been mostly working with REST. Can I still use JavaScript? These aren't very large data sets.
    – matt
    Commented Nov 5, 2014 at 17:16
  • is it on premise or online? Commented Nov 5, 2014 at 17:33
  • It's currently on premise, but we're trying to do everything in a way so that we can go online at some point.
    – matt
    Commented Nov 5, 2014 at 18:06

1 Answer 1

1

REST services is good. But they bring back irrelevant data and require more round trips to the server.

You can improve the performance of REST call to some extent by setting Accept headers (You need to install SP1 in case of on premise). This is explained here

A better option is to switch to CSOM. The library is very rich and can be done using .Net as well as JavaScript.

3
  • Thanks for that great link. To clarify, do you mean that using the SP namespace (in JavaScript) will perform better than making calls to the REST API?
    – matt
    Commented Nov 5, 2014 at 18:33
  • Yes using SPContext Commented Nov 5, 2014 at 18:34
  • I just have to ask; why would REST need more round trips than JSOM? In the example query by OP there is one single query for items, and this can be made smaller by using $select. If additional data is needed $expand will give much the same stuff as JSOM without additional request. I would say it is the contrary, the JSON response from REST can be smaller than the bloated one from JSOM
    – eirikb
    Commented Nov 5, 2014 at 20:39

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.