SharePoint 2013/Online CSOM REST Web Proxy

Web Proxy

SP.WebProxy is used to make requests to external services by SharePoint.

SharePoint Add-ins must register target site as remote endpoint in app manifest.

If the URL is$format=json, the endpoint is

However the response size must not exceed 200 kb.


var context = SP.ClientContext.get_current();
var request = new SP.WebRequestInfo();
var response = SP.WebProxy.invoke(context,request);
context.executeQueryAsync(success, fail);

function success(){
if(response.get_statusCode() == 200 {
var data = JSON.parse(response.get_body());
} else {
var errorMessage = response.get_body();
jQuery.each(categories.d.results, function(index,value)


var call = jQUery.ajax({
url: _spPageContextInfo.webAbsoluteUrl + "/_api/SP.WebProxy.invoke",
type: "POST",
data: JSON.stringify(
"requestInfo": {"type":"SP.WebRequestInfo"},
"Accept": "application/json;odata=verbose",
"Content-Type": "application/json;odata=verbose",
"X-RequestDigest": $("#_REQUESTDIGEST").val()


One thought on “SharePoint 2013/Online CSOM REST Web Proxy

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s