I've been trying to follow this guide but I'm getting the following exception:
An exception occurred while processing the request - Forbidden 403, Access to example.com is denied. Sharepoint is currently configured to block intranet calls.
I have specified remote endpoints. I am using the SP.webproxy.
I'm using the following code:
JavaScript:
$.ajax({
url: "../_api/SP.WebProxy.invoke",
type: "POST",
data: JSON.stringify(
{
"requestInfo": {
"__metadata": { "type": "SP.WebRequestInfo" },
"Url": "https://example.com",
"Method": "GET",
"Headers": {
"results": [{
"__metadata": { "type": "SP.KeyValue" },
"Key": "Accept",
"Value": "application/json;odata=verbose",
"ValueType": "Edm.String"
}]
}
}
}),
headers: {
"Accept": "application/json;odata=verbose",
"Content-Type": "application/json;odata=verbose",
"X-Mifos-Platform-TenantId": "default",
"Authorization": "Basic randomletters",
"User-Agent": "Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.157 Safari/537.36",
"X-RequestDigest": $("#__REQUESTDIGEST").val()
}
Appmanifest:
<?xml version="1.0" encoding="utf-8" ?>
<!--Created:randomnumbers-->
<App xmlns="http://schemas.microsoft.com/sharepoint/2012/app/manifest"
Name="SPRestTest"
ProductID="{randomletters}"
Version="1.0.0.0"
SharePointMinVersion="16.0.0.0"
>
<Properties>
<Title>SPRestTest</Title>
<StartPage>~appWebUrl/Pages/Default.aspx?{StandardTokens}</StartPage>
</Properties>
<AppPrincipal>
<Internal />
</AppPrincipal>
<RemoteEndpoints>
<RemoteEndpoint Url="https://example.com" />
</RemoteEndpoints>
</App>
Update
It does work when I'm using the guide, to "services.odata.org" service, but when I'm trying to do the same thing towards my company's service, it doesn't work.
Do I have to do something more than adding Authorization : basic randomletters
header in order to communicate with a https://example.com website? Because that's the only difference I can see: the one that gives me an error uses SSL