Misguiding MSDN documentation on SharePoint's REST interface

Today I stumbled upon a documentation bug in MSDN (once more). When trying to access the list of all available WebTemplates on a web, this article describes that you can use SharePoint's REST interface by sending an HTTP POST request to http://yourtenant.sharepoint.com/sites/yoursite/_api/web/getAvailableWebTemplates(1033).

I was wondering why should I call a get method using HTTP POST operation. So I gave it a try. Using Chrome's Postman plugin (which is awesome for experimenting with REST interfaces) I tried to call the method as described within the MSDN reference.

SharePoint's response was not surprising. When actually executing such an request you might receive an error like this

SharePoint REST Error

In order to get this working, you just have to change the request from issuing an HTTP POST to issuing an HTTP GETand SharePoint will return the expected data.

SharePoint REST Error

I've also submitted the documentation bug to Microsoft, perhaps the correct HTTP Method will appear on MSDN soon :).

That's all for now, let's get back to work... I've to finish my SPApp.  

Comments

comments powered by Disqus