NewsAPI

FREE
By raygorodskij
Updated 5 months ago
News, Media
8.4/10
Popularity Score
462ms
Latency
100%
Success Rate

NewsAPI API Documentation

News API is a simple and easy-to-use API that returns JSON metadata for the headlines currently published on a range of news sources and blogs.

View API Details
POSTgetArticles
POSTgetSources
POSTgetArticles

Provides a list of live article metadata from a news source or blog.

Header Parameters
X-RapidAPI-HostSTRING
REQUIRED
X-RapidAPI-KeySTRING
REQUIRED
Required Parameters
apiKeyCREDENTIALS
REQUIREDAPI key.
newsSourceSTRING
REQUIREDThe identifer for the news source or blog you want headlines from. Use the getArticles endpoint to locate this.
Optional Parameters
typeOfListSELECT
OPTIONALSpecify which type of list you want.Note: not all options are available for all sources.
Code Snippet
unirest.post("https://NewsAPIraygorodskijV1.p.rapidapi.com/getArticles")
.header("X-RapidAPI-Host", "NewsAPIraygorodskijV1.p.rapidapi.com")
.header("X-RapidAPI-Key", "SIGN-UP-FOR-KEY")
.header("Content-Type", "application/x-www-form-urlencoded")
.end(function (result) {
  console.log(result.status, result.headers, result.body);
});
Sample Response
General
Request URL: https://NewsAPIraygorodskijV1.p.rapidapi.com/getArticles
Request Method: POST
Response Headers
Response Body

Install SDK for NodeJS

Installing

To utilize unirest for node.js install the the npm module:

$ npm install unirest

After installing the npm package you can now start simplifying requests like so:

var unirest = require('unirest');

Creating Request

unirest.post("https://NewsAPIraygorodskijV1.p.rapidapi.com/getArticles")
.header("X-RapidAPI-Host", "NewsAPIraygorodskijV1.p.rapidapi.com")
.header("X-RapidAPI-Key", "SIGN-UP-FOR-KEY")
.header("Content-Type", "application/x-www-form-urlencoded")
.end(function (result) {
  console.log(result.status, result.headers, result.body);
});
OAuth2 Authentication
Client ID
Client Secret
OAuth2 Authentication