News Category API
getNewsCategoriesThe getNewsCategories API provides access to news source category and sub-category data. Sources include Associated Press, Canadian Press, and Dow Jones
View All APIsContact Us to Get Access
Inputs
sourcesoptional
An id or code that identifies a news source. Multiple sources separated by a comma may be used.
Type
list (A comma or semi-colon delimited string.)
Example
AP,CMTX,USDAdepthoptional
An integer that will limit how many levels of the category tree to show. By default all levels are returned.
Type
int (A numeric type defining a whole number. (example: 2))
Example
2Outputs
category
always returned
always returned
The category symbol.
string
A sequence of characters. (example: GOOG)
A sequence of characters. (example: GOOG)
subcategories
The sub-categories.
array
A data structure that contains a group of elements.
A data structure that contains a group of elements.
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/getNewsCategories.json?apikey=YOUR_API_KEY&sources=AP%2CCMTX%2CUSDA&depth=2
Host: ondemand.websol.barchart.com
POST
POST https://ondemand.websol.barchart.com/getNewsCategories.json
Host: ondemand.websol.barchart.com
Content-Type: application/x-www-form-urlencoded
Content-Length: length
apikey=YOUR_API_KEY&sources=AP%2CCMTX%2CUSDA&depth=2
Response
{
"status": {
"code": 200,
"message": "Success."
},
"results": [
{
"category": {
"name": "Companies",
"symbol": "STK",
"subcategories": [
{
"category": {
"name": "Private Companies",
"symbol": "PVT"
}
},
{
"category": {
"name": " Stock Equities",
"symbol": "EQY"
}
},
{
"category": {
"name": "Stock Trading",
"symbol": "TRD"
}
},
{
"category": {
"name": "Stock Options",
"symbol": "OPT"
}
},
{
"category": {
"name": "Regulatory",
"symbol": "REG"
}
},
{
"category": {
"name": "Industries",
"symbol": "IND"
}
},
{
"category": {
"name": "Mergers & Acquisitions",
"symbol": "MNA"
}
},
{
"category": {
"name": "Employees",
"symbol": "EMP"
}
},
{
"category": {
"name": "Corporate Events",
"symbol": "EVNT"
}
},
{
"category": {
"name": "Analyst Ratings",
"symbol": "ANLST"
}
},
{
"category": {
"name": "Electronic Traded Funds",
"symbol": "FIN"
}
}
]
}
},
{
"category": {
"name": "Politics",
"symbol": "POL",
"subcategories": [
{
"category": {
"name": "Elections",
"symbol": "ELC"
}
},
{
"category": {
"name": "Law",
"symbol": "LAW"
}
},
{
"category": {
"name": "Taxes",
"symbol": "TAX"
}
}
]
}
},
{
"category": {
"name": "Geography",
"symbol": "GEO",
"subcategories": [
{
"category": {
"name": "United States",
"symbol": "US"
}
},
{
"category": {
"name": "United Kingdom",
"symbol": "UK"
}
},
{
"category": {
"name": "Iraq",
"symbol": "IRQ"
}
},
{
"category": {
"name": "Asia",
"symbol": "ASA"
}
},
{
"category": {
"name": "Spain",
"symbol": "ESP"
}
},
{
"category": {
"name": "S. Korea",
"symbol": "KOR"
}
},
{
"category": {
"name": "Russia",
"symbol": "RUS"
}
},
{
"category": {
"name": "China",
"symbol": "CHN"
}
},
{
"category": {
"name": "Chile",
"symbol": "CHI"
}
},
{
"category": {
"name": "Peru",
"symbol": "PRU"
}
},
{
"category": {
"name": "Australia",
"symbol": "AUS"
}
},
{
"category": {
"name": "Bolivia",
"symbol": "BOL"
}
},
{
"category": {
"name": "Europe",
"symbol": "EUR"
}
},
{
"category": {
"name": "Canada",
"symbol": "CAN"
}
},
{
"category": {
"name": "Japan",
"symbol": "JPN"
}
},
{
"category": {
"name": "Mexico",
"symbol": "MEX"
}
},
{
"category": {
"name": "Germany",
"symbol": "GRM"
}
},
{
"category": {
"name": "France",
"symbol": "FRA"
}
},
{
"category": {
"name": "Brazil",
"symbol": "BZL"
}
},
{
"category": {
"name": "Cuba",
"symbol": "CUB"
}
},
{
"category": {
"name": "Argentina",
"symbol": "ARG"
}
},
{
"category": {
"name": "S. Korea",
"symbol": "SKOR"
}
},
{
"category": {
"name": "Philippines",
"symbol": "PHIL"
}
},
{
"category": {
"name": "New Zealand",
"symbol": "KIWI"
}
},
{
"category": {
"name": "Singapore",
"symbol": "SING"
}
}
]
}
},
{
"category": {
"name": "Commodities",
"symbol": "FUT",
"subcategories": [
{
"category": {
"name": "Agriculture",
"symbol": "AG"
}
},
{
"category": {
"name": "En",
"symbol": "ENG"
}
},
{
"category": {
"name": "Equity Index",
"symbol": "IND"
}
},
{
"category": {
"name": "Grain",
"symbol": "GRN"
}
},
{
"category": {
"name": "Futures Education",
"symbol": "EDU"
}
},
{
"category": {
"name": "Options on Futures",
"symbol": "OPT"
}
},
{
"category": {
"name": "Interest Rates",
"symbol": "FIN"
}
},
{
"category": {
"name": "Top News",
"symbol": "TOP"
}
},
{
"category": {
"name": "Forex",
"symbol": "CUR"
}
},
{
"category": {
"name": "Weather",
"symbol": "WTH"
}
},
{
"category": {
"name": "Metals",
"symbol": "MTL"
}
},
{
"category": {
"name": "Fruits & Vegetables",
"symbol": "FVT"
}
},
{
"category": {
"name": "Softs",
"symbol": "SFT"
}
},
{
"category": {
"name": "Futures Exchange",
"symbol": "EXCH"
}
},
{
"category": {
"name": "Food & Beverage",
"symbol": "FOOD"
}
},
{
"category": {
"name": "Lumber",
"symbol": "WOOD"
}
},
{
"category": {
"name": "Livestock",
"symbol": "MEATS"
}
},
{
"category": {
"name": "Cryptocurrencies",
"symbol": "CRYPTO"
}
}
]
}
},
{
"category": {
"name": "Economics",
"symbol": "ECO",
"subcategories": [
{
"category": {
"name": "Global Trade",
"symbol": "TRD"
}
},
{
"category": {
"name": "Employment",
"symbol": "EMP"
}
},
{
"category": {
"name": "Central Banks",
"symbol": "CBANK"
}
}
]
}
},
{
"category": {
"name": "Government Debt",
"symbol": "dFUT",
"subcategories": [
{
"category": {
"name": "Government Debt",
"symbol": "FIN"
}
}
]
}
}
]
}
XML
GET
GET https://ondemand.websol.barchart.com/getNewsCategories.xml?apikey=YOUR_API_KEY&sources=AP%2CCMTX%2CUSDA&depth=2
Host: ondemand.websol.barchart.com
POST
POST https://ondemand.websol.barchart.com/getNewsCategories.xml
Host: ondemand.websol.barchart.com
Content-Type: application/x-www-form-urlencoded
Content-Length: length
apikey=YOUR_API_KEY&sources=AP%2CCMTX%2CUSDA&depth=2
Response
<?xml version="1.0" encoding="utf-8"?>
<getNewsCategories>
<status>
<code>200</code>
<message>Success.</message>
</status>
<item>
<category>
<name>Companies</name>
<symbol>STK</symbol>
<subcategories>
<category>
<name>Private Companies</name>
<symbol>PVT</symbol>
</category>
<category>
<name> Stock Equities</name>
<symbol>EQY</symbol>
</category>
<category>
<name>Stock Trading</name>
<symbol>TRD</symbol>
</category>
<category>
<name>Stock Options</name>
<symbol>OPT</symbol>
</category>
<category>
<name>Regulatory</name>
<symbol>REG</symbol>
</category>
<category>
<name>Industries</name>
<symbol>IND</symbol>
</category>
<category>
<name>Mergers & Acquisitions</name>
<symbol>MNA</symbol>
</category>
<category>
<name>Employees</name>
<symbol>EMP</symbol>
</category>
<category>
<name>Corporate Events</name>
<symbol>EVNT</symbol>
</category>
<category>
<name>Analyst Ratings</name>
<symbol>ANLST</symbol>
</category>
<category>
<name>Electronic Traded Funds</name>
<symbol>FIN</symbol>
</category>
</subcategories>
</category>
</item>
<item>
<category>
<name>Politics</name>
<symbol>POL</symbol>
<subcategories>
<category>
<name>Elections</name>
<symbol>ELC</symbol>
</category>
<category>
<name>Law</name>
<symbol>LAW</symbol>
</category>
<category>
<name>Taxes</name>
<symbol>TAX</symbol>
</category>
</subcategories>
</category>
</item>
<item>
<category>
<name>Geography</name>
<symbol>GEO</symbol>
<subcategories>
<category>
<name>United States</name>
<symbol>US</symbol>
</category>
<category>
<name>United Kingdom</name>
<symbol>UK</symbol>
</category>
<category>
<name>Iraq</name>
<symbol>IRQ</symbol>
</category>
<category>
<name>Asia</name>
<symbol>ASA</symbol>
</category>
<category>
<name>Spain</name>
<symbol>ESP</symbol>
</category>
<category>
<name>S. Korea</name>
<symbol>KOR</symbol>
</category>
<category>
<name>Russia</name>
<symbol>RUS</symbol>
</category>
<category>
<name>China</name>
<symbol>CHN</symbol>
</category>
<category>
<name>Chile</name>
<symbol>CHI</symbol>
</category>
<category>
<name>Peru</name>
<symbol>PRU</symbol>
</category>
<category>
<name>Australia</name>
<symbol>AUS</symbol>
</category>
<category>
<name>Bolivia</name>
<symbol>BOL</symbol>
</category>
<category>
<name>Europe</name>
<symbol>EUR</symbol>
</category>
<category>
<name>Canada</name>
<symbol>CAN</symbol>
</category>
<category>
<name>Japan</name>
<symbol>JPN</symbol>
</category>
<category>
<name>Mexico</name>
<symbol>MEX</symbol>
</category>
<category>
<name>Germany</name>
<symbol>GRM</symbol>
</category>
<category>
<name>France</name>
<symbol>FRA</symbol>
</category>
<category>
<name>Brazil</name>
<symbol>BZL</symbol>
</category>
<category>
<name>Cuba</name>
<symbol>CUB</symbol>
</category>
<category>
<name>Argentina</name>
<symbol>ARG</symbol>
</category>
<category>
<name>S. Korea</name>
<symbol>SKOR</symbol>
</category>
<category>
<name>Philippines</name>
<symbol>PHIL</symbol>
</category>
<category>
<name>New Zealand</name>
<symbol>KIWI</symbol>
</category>
<category>
<name>Singapore</name>
<symbol>SING</symbol>
</category>
</subcategories>
</category>
</item>
<item>
<category>
<name>Commodities</name>
<symbol>FUT</symbol>
<subcategories>
<category>
<name>Agriculture</name>
<symbol>AG</symbol>
</category>
<category>
<name>En</name>
<symbol>ENG</symbol>
</category>
<category>
<name>Equity Index</name>
<symbol>IND</symbol>
</category>
<category>
<name>Grain</name>
<symbol>GRN</symbol>
</category>
<category>
<name>Futures Education</name>
<symbol>EDU</symbol>
</category>
<category>
<name>Options on Futures</name>
<symbol>OPT</symbol>
</category>
<category>
<name>Interest Rates</name>
<symbol>FIN</symbol>
</category>
<category>
<name>Top News</name>
<symbol>TOP</symbol>
</category>
<category>
<name>Forex</name>
<symbol>CUR</symbol>
</category>
<category>
<name>Weather</name>
<symbol>WTH</symbol>
</category>
<category>
<name>Metals</name>
<symbol>MTL</symbol>
</category>
<category>
<name>Fruits & Vegetables</name>
<symbol>FVT</symbol>
</category>
<category>
<name>Softs</name>
<symbol>SFT</symbol>
</category>
<category>
<name>Futures Exchange</name>
<symbol>EXCH</symbol>
</category>
<category>
<name>Food & Beverage</name>
<symbol>FOOD</symbol>
</category>
<category>
<name>Lumber</name>
<symbol>WOOD</symbol>
</category>
<category>
<name>Livestock</name>
<symbol>MEATS</symbol>
</category>
<category>
<name>Cryptocurrencies</name>
<symbol>CRYPTO</symbol>
</category>
</subcategories>
</category>
</item>
<item>
<category>
<name>Economics</name>
<symbol>ECO</symbol>
<subcategories>
<category>
<name>Global Trade</name>
<symbol>TRD</symbol>
</category>
<category>
<name>Employment</name>
<symbol>EMP</symbol>
</category>
<category>
<name>Central Banks</name>
<symbol>CBANK</symbol>
</category>
</subcategories>
</category>
</item>
<item>
<category>
<name>Government Debt</name>
<symbol>dFUT</symbol>
<subcategories>
<category>
<name>Government Debt</name>
<symbol>FIN</symbol>
</category>
</subcategories>
</category>
</item>
</getNewsCategories>
CSV
GET
GET https://ondemand.websol.barchart.com/getNewsCategories.csv?apikey=YOUR_API_KEY&sources=AP%2CCMTX%2CUSDA&depth=2
Host: ondemand.websol.barchart.com
POST
POST https://ondemand.websol.barchart.com/getNewsCategories.csv
Host: ondemand.websol.barchart.com
Content-Type: application/x-www-form-urlencoded
Content-Length: length
apikey=YOUR_API_KEY&sources=AP%2CCMTX%2CUSDA&depth=2
Response
name,symbol,parent
"Government Debt","dFUT"
"Government Debt","FIN","dFUT"
"Economics","ECO"
"Central Banks","CBANK","ECO"
"Employment","EMP","ECO"
"Global Trade","TRD","ECO"
"Commodities","FUT"
"Cryptocurrencies","CRYPTO","FUT"
"Livestock","MEATS","FUT"
"Lumber","WOOD","FUT"
"Food & Beverage","FOOD","FUT"
"Futures Exchange","EXCH","FUT"
"Softs","SFT","FUT"
"Fruits & Vegetables","FVT","FUT"
"Metals","MTL","FUT"
"Weather","WTH","FUT"
"Forex","CUR","FUT"
"Top News","TOP","FUT"
"Interest Rates","FIN","FUT"
"Options on Futures","OPT","FUT"
PHP
<?php
$ondemand = new SoapClient('https://ondemand.websol.barchart.com/service?wsdl');
$params = [
'apikey' => 'YOUR_API_KEY',
'sources' => 'AP,CMTX,USDA',
'depth' => '2',
];
$result = $ondemand->getNewsCategories($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.getNewsCategories("YOUR_API_KEY", "AP,CMTX,USDA", "2")
Perl
use SOAP::Lite;
use SOAP::WSDL;
my $ondemand = SOAP::Lite
-> service('https://ondemand.websol.barchart.com/service?wsdl');
my $result = $ondemand->getNewsCategories('YOUR_API_KEY', 'AP,CMTX,USDA', '2');
print $result;
Python
from suds.client import Client
ondemand = Client('https://ondemand.websol.barchart.com/service?wsdl')
result = ondemand.service.getNewsCategories('YOUR_API_KEY', 'AP,CMTX,USDA', '2')
print(result)
Ruby
require 'savon'
ondemand = Savon.client(wsdl: 'https://ondemand.websol.barchart.com/service?wsdl')
response = ondemand.call(
:getNewsCategories,
message: {
apikey: 'YOUR_API_KEY',
sources: 'AP,CMTX,USDA',
depth: '2',
}
)
response.body