Created
April 12, 2020 07:57
-
-
Save arun12209/bffd180b5495849c75304114c8e3320f to your computer and use it in GitHub Desktop.
NEWSAPI_Callout
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
string baseURL='https://newsapi.org/v2/top-headlines'; | |
String apiKey =''; //API key get it from Newsapi.org | |
HttpRequest reqest = new HttpRequest(); | |
system.debug('EndPoint: '+baseURL+'?sources=national-geographic&apiKey='+apiKey); | |
reqest.setEndpoint(baseURL+'?sources=national-geographic&apiKey='+apiKey); | |
reqest.setMethod('GET'); | |
reqest.setHeader('Accept','application/json'); | |
Http h = new Http(); | |
HTTPResponse response = h.send(reqest); | |
System.debug('result : + response.getBody()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment