How to call WebApi in SharePoint 2013 using Javascript

Sathish Nadarajan
Solution Architect
July 2, 2015
Rate this article
[Total: 0    Average: 0/5]

In the previous article, we saw how to create a WebAPI. Now, let us see a small piece of code, how to call that API from your SharePoint 2013 site using Javascript.

I assume that, we have created the API successfully and the API is hosted properly. Now, on our Javascript, a simple call like below will do the rest of the things.

              function (Data) {
              function (jqXHR, textStatus, err) {
              alert('Fail ' + err);

The attribute “?callback?” is added at the last, to make the JSONP return. If we expect only the JSON object, then there is no need of the “?callback?” attribute.


Happy Coding,

Sathish Nadarajan.

Author Info

Sathish Nadarajan
Solution Architect
Rate this article
[Total: 0    Average: 0/5]
Sathish is a Microsoft MVP for SharePoint (Office Servers and Services) having 13+ years of experience in Microsoft Technologies. He holds a Masters Degree in Computer Aided Design and Business more

Leave a comment