Skip to content

Instantly share code, notes, and snippets.

@ryanguest
Last active April 5, 2017 20:32
Show Gist options
  • Save ryanguest/b98b1672fcd5ed380bf62fe7aabc8fa6 to your computer and use it in GitHub Desktop.
Save ryanguest/b98b1672fcd5ed380bf62fe7aabc8fa6 to your computer and use it in GitHub Desktop.
public with sharing class TestController {
public String output { get; set; }
public PageReference run() {
String url = 'https://na1.salesforce.com/services/data/v23.0/chatter/feeds/news/me';
HttpRequest req = new HttpRequest();
req.setMethod('GET');
req.setEndpoint(url);
req.setHeader('Content-type', 'application/json');
req.setHeader('Authorization', 'OAuth ' + UserInfo.getSessionId());
Http http = new Http();
HTTPResponse res = http.send(req);
output = (res.getBody());
return null;
}
}
<apex:page controller="TestController">
<apex:form>
<apex:commandButton action="{!run}" value="Save" id="theButton"/>
{!output}
</apex:form >
</apex:page>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment