getNews API

The getNews API returns news headlines, articles and related photos based upon news sources, category, sub-category and/or keyword.

All APIs

Contact Us to Get Access

Inputs

sources required

The news feed code.

Type
list-enum (A comma or semi-colon delimited string that must match a list of valid possible values.) 
Example
AP,IF 

Valid Values:
AP, APAI, BC, CP, CPF, CNW, CRB, DJ, CMTX, CMTX:PCS, CMTX:PCC, CMTX:WALLST, CMTX:SEC, IF, USDA, PRNW, ZACKS, BRUG, AGFAX, SETZ, SPC, STPE, NASS, ESTMZ, DVND, LME-COT, LME-WHS, DLFRX, GLDRPT, COT

symbols optional

A symbol or code that identifies a financial instrument.

Type
list (A comma or semi-colon delimited string.) 
Example
AMZN,GOOG,AAPL 

category optional

A grouping of related news content.

Type
enum (A type which includes a list of valid possible values.) 
Example
stocks 

Valid Values:
stocks, futures, forex

subCategory optional

A more specific category of related news content.

Type
enum (A type which includes a list of valid possible values.) 
Example
tech 

Valid Values:
aero, ag, auto, business, construction, consprod, corporate, defense, energy, finance, indices, industry, leisure, media, retail, tech, transportation, util, softs, meats, metals, grains, financials, indices, energies, currencies, weather, fruits and vegetables

series optional

A grouping of stories under a recurring news topic. e.g. Morning Call (MORNCALL).

Type
list-enum (A comma or semi-colon delimited string that must match a list of valid possible values.) 
Example
MORNCALL 

Valid Values:
MORNCALL

keyword optional

A term used to create searches.

Type
string (A sequence of characters. (example: GOOG)) 
Example
tablet 

maxRecords optional

The maximum number of records to show in the return.

Type
int (A numeric type defining a whole number. (example: 2)) 
Example
10 
Default
30 

startDate optional

The beginning date for the query.

Type
dateTime (A date and time in the format of YYYY-MM-DD HH:MI:SS<TIMEZONE_OFFSET>.) 
Example
2017-11-21T00:24:40 

displayType required

The type of new displayed: headlines only, headline and preview, or full.

Type
enum (A type which includes a list of valid possible values.) 
Example
preview 

Valid Values:
headline, preview, full

images optional

An option for returning the images contained in the news article.

Type
boolean (A logical type representing the truth of a value as 'true' or 'false'.) 
Example
true 

storyId optional

Parameter allows to get specific story by providing newsID. Parameters: sources, symbols, category, subCategory, keyword, maxRecords, startDate will be ignored.

Type
int (A numeric type defining a whole number. (example: 2)) 
Example
259220 

rss optional

Parameter formats XML requests as RSS feeds. This parameter has no effect on JSON or CSV requests.

Type
boolean (A logical type representing the truth of a value as 'true' or 'false'.) 
Example
true 
Default
false 

rssTitle optional

Parameter overrides the default RSS feed title and description.

Type
string (A sequence of characters. (example: GOOG)) 
Default
Barchart OnDemand News 

fields optional

The additional fields requested.

Type
list (A comma or semi-colon delimited string.) 
Example
publishDate 

barchartClassification optional

Type
list (A comma or semi-colon delimited string.) 

Outputs

Name / Requirement
Description
Type
newsID
always returned
The identifying news code.
int
A numeric type defining a whole number. (example: 2)
timestamp
always returned
The timestamp for a news article.
dateTime
A date and time in the format of YYYY-MM-DD HH:MI:SS<TIMEZONE_OFFSET>.
source
always returned
The origin of the news feed.
string
A sequence of characters. (example: GOOG)
categories
always returned
A grouping of related news content.
list
A comma or semi-colon delimited string.
subCategories
always returned
A more specific category list of related news content.
list
A comma or semi-colon delimited string.
headline
always returned
The title of the news article.
string
A sequence of characters. (example: GOOG)
isExternal
always returned
A flag indicating if the news stories is from an external source.
boolean
A logical type representing the truth of a value as 'true' or 'false'.
headlineURL
as requested
The URL of the news article. This is used for headline only feeds.
string
A sequence of characters. (example: GOOG)
preview
as requested
A brief summary of the entire news article.
string
A sequence of characters. (example: GOOG)
fullText
as requested
The full published text of the news article.
string
A sequence of characters. (example: GOOG)
imageURL
as requested
The URL of the image enclosed in the news article.
string
A sequence of characters. (example: GOOG)
imageCaption
as requested
A brief summary explaining an image.
string
A sequence of characters. (example: GOOG)
imageHeight
as requested
The height of an image.
int
A numeric type defining a whole number. (example: 2)
imageWidth
as requested
The width of an image.
int
A numeric type defining a whole number. (example: 2)
pdfURL
as requested
The web location of PDF version of the news article.
string
A sequence of characters. (example: GOOG)
publishDate
as requested
The actual publish date of the news story.
dateTime
A date and time in the format of YYYY-MM-DD HH:MI:SS<TIMEZONE_OFFSET>.
largeImageURL
as requested
The URL of the alternative larger image enclosed in the article
string
A sequence of characters. (example: GOOG)
largeImageHeight
as requested
The height of the larger image, if available.
int
A numeric type defining a whole number. (example: 2)
largeImageWidth
as requested
The width of the larger image, if available.
int
A numeric type defining a whole number. (example: 2)

Status Code Responses

200
OK
Success
400
Bad Request
The request was invalid, please see the message for more information.
500
Internal Server Error
Something is not working correctly, please contact support.


JSON

GET

GET https://ondemand.websol.barchart.com/getNews.json?apikey=<YOUR API KEY>&sources=AP%2CIF&symbols=AMZN%2CGOOG%2CAAPL&category=stocks&subCategory=tech&series=MORNCALL&keyword=tablet&maxRecords=10&startDate=2017-11-21T00%3A24%3A40&displayType=preview&images=true&storyId=259220&rss=true&fields=publishDate
Host: ondemand.websol.barchart.com

POST

POST https://ondemand.websol.barchart.com/getNews.json
Host: ondemand.websol.barchart.com
Content-Type: application/x-www-form-urlencoded
Content-Length: length

apikey=<YOUR API KEY>&sources=AP%2CIF&symbols=AMZN%2CGOOG%2CAAPL&category=stocks&subCategory=tech&series=MORNCALL&keyword=tablet&maxRecords=10&startDate=2017-11-21T00%3A24%3A40&displayType=preview&images=true&storyId=259220&rss=true&fields=publishDate

Response

null

XML

GET

GET https://ondemand.websol.barchart.com/getNews.xml?apikey=<YOUR API KEY>&sources=AP%2CIF&symbols=AMZN%2CGOOG%2CAAPL&category=stocks&subCategory=tech&series=MORNCALL&keyword=tablet&maxRecords=10&startDate=2017-11-21T00%3A24%3A40&displayType=preview&images=true&storyId=259220&rss=true&fields=publishDate
Host: ondemand.websol.barchart.com

POST

POST https://ondemand.websol.barchart.com/getNews.xml
Host: ondemand.websol.barchart.com
Content-Type: application/x-www-form-urlencoded
Content-Length: length

apikey=<YOUR API KEY>&sources=AP%2CIF&symbols=AMZN%2CGOOG%2CAAPL&category=stocks&subCategory=tech&series=MORNCALL&keyword=tablet&maxRecords=10&startDate=2017-11-21T00%3A24%3A40&displayType=preview&images=true&storyId=259220&rss=true&fields=publishDate

Response


<?xml version="1.0"?>
 <rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" encoding="UTF-8">
  <channel>
   <title>Barchart OnDemand News</title>
   <link>http://ondemand.websol.barchart.com/getNews.xml?apikey=ondemand&sources=AP%2CIF&symbols=AMZN%2CGOOG%2CAAPL&category=stocks&subCategory=tech&series=MORNCALL&keyword=tablet&maxRecords=10&startDate=2017-11-21T00%3A24%3A40&displayType=preview&images=true&storyId=259220&rss=true&fields=publishDate</link>
   <description>Barchart OnDemand News RSS Feed</description>
   <language>en-us</language>
   <pubDate>Tue, 21 Nov 2017 00:28:05 CST</pubDate>
   <lastBuildDate>Tue, 21 Nov 2017 00:28:05 CST</lastBuildDate>
   <docs>http://barchartondemand.com/api/getNews</docs>
   <generator>Barchart</generator>
   <managingEditor>sales@barchart.com (sales)</managingEditor>
   <webMaster>sales@barchart.com (sales)</webMaster>
   <atom:link href="http://ondemand.websol.barchart.com/getNews.xml?apikey=ondemand&sources=AP%2CIF&symbols=AMZN%2CGOOG%2CAAPL&category=stocks&subCategory=tech&series=MORNCALL&keyword=tablet&maxRecords=10&startDate=2017-11-21T00%3A24%3A40&displayType=preview&images=true&storyId=259220&rss=true&fields=publishDate" rel="self" type="application/rss+xml" />
   <item>
    <title></title>
    <link></link>
    <description>
     <![CDATA[
                        
                     ]]></description>
     <pubDate>Wed, 31 Dec 1969 18:00:00 CST</pubDate>
     <guid isPermaLink="false">barchartnewsid:</guid>
    </item>
   </channel>
  </rss>

CSV

GET

GET https://ondemand.websol.barchart.com/getNews.csv?apikey=<YOUR API KEY>&sources=AP%2CIF&symbols=AMZN%2CGOOG%2CAAPL&category=stocks&subCategory=tech&series=MORNCALL&keyword=tablet&maxRecords=10&startDate=2017-11-21T00%3A24%3A40&displayType=preview&images=true&storyId=259220&rss=true&fields=publishDate
Host: ondemand.websol.barchart.com

POST

POST https://ondemand.websol.barchart.com/getNews.csv
Host: ondemand.websol.barchart.com
Content-Type: application/x-www-form-urlencoded
Content-Length: length

apikey=<YOUR API KEY>&sources=AP%2CIF&symbols=AMZN%2CGOOG%2CAAPL&category=stocks&subCategory=tech&series=MORNCALL&keyword=tablet&maxRecords=10&startDate=2017-11-21T00%3A24%3A40&displayType=preview&images=true&storyId=259220&rss=true&fields=publishDate

Response

<?xml version="1.0"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" encoding="UTF-8">
   <channel>
      <title>Barchart OnDemand News</title>
      <link>http://ondemand.websol.barchart.com/getNews.csv?apikey=ondemand&sources=AP%2CIF&symbols=AMZN%2CGOOG%2CAAPL&category=stocks&subCategory=tech&series=MORNCALL&keyword=tablet&maxRecords=10&startDate=2017-11-21T00%3A24%3A40&displayType=preview&images=true&storyId=259220&rss=true&fields=publishDate</link>
      <description>Barchart OnDemand News RSS Feed</description>
      <language>en-us</language>
      <pubDate>Tue, 21 Nov 2017 00:28:05 CST</pubDate>
      <lastBuildDate>Tue, 21 Nov 2017 00:28:05 CST</lastBuildDate>
      <docs>http://barchartondemand.com/api/getNews</docs>
      <generator>Barchart</generator>
      <managingEditor>sales@barchart.com (sales)</managingEditor>
      <webMaster>sales@barchart.com (sales)</webMaster>
      <atom:link href="http://ondemand.websol.barchart.com/getNews.csv?apikey=ondemand&sources=AP%2CIF&symbols=AMZN%2CGOOG%2CAAPL&category=stocks&subCategory=tech&series=MORNCALL&keyword=tablet&maxRecords=10&startDate=2017-11-21T00%3A24%3A40&displayType=preview&images=true&storyId=259220&rss=true&fields=publishDate" rel="self" type="application/rss+xml" />
      <item>
                  <title></title>
                  <link></link>
                  <description>
                     <![CDATA[
                        
                     ]]>
                  </description>
                  <pubDate>Wed, 31 Dec 1969 18:00:00 CST</pubDate>
                  <guid isPermaLink="false">barchartnewsid:</guid>
               </item>   </channel>
</rss>


PHP

<?php

$ondemand = new SoapClient('https://ondemand.websol.barchart.com/service?wsdl');

$params = [
    'sources' => 'AP,IF',
    'symbols' => 'AMZN,GOOG,AAPL',
    'category' => 'stocks',
    'subCategory' => 'tech',
    'series' => 'MORNCALL',
    'keyword' => 'tablet',
    'maxRecords' => '10',
    'startDate' => '2017-11-21T00:24:40',
    'displayType' => 'preview',
    'images' => 'true',
    'storyId' => '259220',
    'rss' => 'true',
    'fields' => 'publishDate',
];

$result = $ondemand->getNews($params);
var_dump($result);

Classic ASP

Dim ondemand
Dim result

Set ondemand = Server.CreateObject("MSSOAP.SoapClient30")
ondemand.ClientProperty("ServerHTTPRequest") = True
ondemand.MSSoapInit("https://ondemand.websol.barchart.com/service?wsdl")

Set result = ondemand.getNews("AP,IF", "AMZN,GOOG,AAPL", "stocks", "tech", "MORNCALL", "tablet", "10", "2017-11-21T00:24:40", "preview", "true", "259220", "true", "publishDate")

Perl

use SOAP::Lite;
use SOAP::WSDL;

my $ondemand = SOAP::Lite
    -> service('https://ondemand.websol.barchart.com/service?wsdl');

my $result = $ondemand->getNews('AP,IF', 'AMZN,GOOG,AAPL', 'stocks', 'tech', 'MORNCALL', 'tablet', '10', '2017-11-21T00:24:40', 'preview', 'true', '259220', 'true', 'publishDate');

print $result;

Python

from suds.client import Client
ondemand = Client('https://ondemand.websol.barchart.com/service?wsdl')

result = client.service.getNews('AP,IF', 'AMZN,GOOG,AAPL', 'stocks', 'tech', 'MORNCALL', 'tablet', '10', '2017-11-21T00:24:40', 'preview', 'true', '259220', 'true', 'publishDate')

print result

Ruby

require 'savon'

ondemand = Savon.client(wsdl: 'https://ondemand.websol.barchart.com/service?wsdl')

response = ondemand.call(
    :getNews,
    message: {
        sources: 'AP,IF',
        symbols: 'AMZN,GOOG,AAPL',
        category: 'stocks',
        subCategory: 'tech',
        series: 'MORNCALL',
        keyword: 'tablet',
        maxRecords: '10',
        startDate: '2017-11-21T00:24:40',
        displayType: 'preview',
        images: 'true',
        storyId: '259220',
        rss: 'true',
        fields: 'publishDate',
    }
)

response.body