Last active
April 5, 2017 20:32
-
-
Save ryanguest/b98b1672fcd5ed380bf62fe7aabc8fa6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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