Today I stumbled upon a documentation bug in MSDN (once again). When trying to access the list of all available WebTemplates
on a SPWeb
, 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 I should call a GET
method using a HTTP POST
operation. So I gave it a try. Using Chrome’s Postman plugin (which is fantastic for experimenting with REST interfaces), I tried to call the method as described within the MSDN reference.
SharePoint’s response was not surprising. When executing such a request you might receive an error like this.
To get this working, you have to change the request from issuing an HTTP POST
to issuing an HTTP GET
and SharePoint will return the expected data.
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.