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": "Stock Options",
"symbol": "OPT"
}
},
{
"category": {
"name": "Regulatory",
"symbol": "REG"
}
},
{
"category": {
"name": "Industries",
"symbol": "IND"
}
},
{
"category": {
"name": "Mergers & Acquisitions",
"symbol": "MNA"
}
},
{
"category": {
"name": " Stock Equities",
"symbol": "EQY"
}
},
{
"category": {
"name": "Corporate Events",
"symbol": "EVNT"
}
},
{
"category": {
"name": "Venture Capital",
"symbol": "PVT"
}
},
{
"category": {
"name": "Insider Transaction",
"symbol": "EMP"
}
},
{
"category": {
"name": "Analyst Downgrade",
"symbol": "ANLST"
}
}
]
}
},
{
"category": {
"name": "Geography",
"symbol": "GEO",
"subcategories": [
{
"category": {
"name": "United States",
"symbol": "US"
}
},
{
"category": {
"name": "Iraq",
"symbol": "IRQ"
}
},
{
"category": {
"name": "Mexico",
"symbol": "MEX"
}
},
{
"category": {
"name": "S. Korea",
"symbol": "KOR"
}
},
{
"category": {
"name": "Chile",
"symbol": "CHI"
}
},
{
"category": {
"name": "Cuba",
"symbol": "CUB"
}
},
{
"category": {
"name": "Bolivia",
"symbol": "BOL"
}
},
{
"category": {
"name": "Australia",
"symbol": "AUS"
}
},
{
"category": {
"name": "Philippines",
"symbol": "PHIL"
}
}
]
}
},
{
"category": {
"name": "Economics",
"symbol": "ECO",
"subcategories": [
{
"category": {
"name": "Global Trade",
"symbol": "TRD"
}
}
]
}
},
{
"category": {
"name": null,
"symbol": "FUT",
"subcategories": [
{
"category": {
"name": "Agriculture",
"symbol": "AG"
}
},
{
"category": {
"name": "Top News",
"symbol": "TOP"
}
},
{
"category": {
"name": "Options on Futures",
"symbol": "OPT"
}
},
{
"category": {
"name": "Softs",
"symbol": "SFT"
}
},
{
"category": {
"name": "Futures Exchange",
"symbol": "EXCH"
}
},
{
"category": {
"name": "Batteries",
"symbol": "MTL"
}
},
{
"category": {
"name": "Nuts",
"symbol": "FVT"
}
},
{
"category": {
"name": "Rice",
"symbol": "GRN"
}
},
{
"category": {
"name": "Crude Oil",
"symbol": "ENG"
}
},
{
"category": {
"name": "Lamb",
"symbol": "MEATS"
}
}
]
}
},
{
"category": {
"name": "Taxes",
"symbol": "POL",
"subcategories": [
{
"category": {
"name": "Taxes",
"symbol": "TAX"
}
}
]
}
}
]
}
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>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> Stock Equities</name>
<symbol>EQY</symbol>
</category>
<category>
<name>Corporate Events</name>
<symbol>EVNT</symbol>
</category>
<category>
<name>Venture Capital</name>
<symbol>PVT</symbol>
</category>
<category>
<name>Insider Transaction</name>
<symbol>EMP</symbol>
</category>
<category>
<name>Analyst Downgrade</name>
<symbol>ANLST</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>Iraq</name>
<symbol>IRQ</symbol>
</category>
<category>
<name>Mexico</name>
<symbol>MEX</symbol>
</category>
<category>
<name>S. Korea</name>
<symbol>KOR</symbol>
</category>
<category>
<name>Chile</name>
<symbol>CHI</symbol>
</category>
<category>
<name>Cuba</name>
<symbol>CUB</symbol>
</category>
<category>
<name>Bolivia</name>
<symbol>BOL</symbol>
</category>
<category>
<name>Australia</name>
<symbol>AUS</symbol>
</category>
<category>
<name>Philippines</name>
<symbol>PHIL</symbol>
</category>
</subcategories>
</category>
</item>
<item>
<category>
<name>Economics</name>
<symbol>ECO</symbol>
<subcategories>
<category>
<name>Global Trade</name>
<symbol>TRD</symbol>
</category>
</subcategories>
</category>
</item>
<item>
<category>
<name/>
<symbol>FUT</symbol>
<subcategories>
<category>
<name>Agriculture</name>
<symbol>AG</symbol>
</category>
<category>
<name>Top News</name>
<symbol>TOP</symbol>
</category>
<category>
<name>Options on Futures</name>
<symbol>OPT</symbol>
</category>
<category>
<name>Softs</name>
<symbol>SFT</symbol>
</category>
<category>
<name>Futures Exchange</name>
<symbol>EXCH</symbol>
</category>
<category>
<name>Batteries</name>
<symbol>MTL</symbol>
</category>
<category>
<name>Nuts</name>
<symbol>FVT</symbol>
</category>
<category>
<name>Rice</name>
<symbol>GRN</symbol>
</category>
<category>
<name>Crude Oil</name>
<symbol>ENG</symbol>
</category>
<category>
<name>Lamb</name>
<symbol>MEATS</symbol>
</category>
</subcategories>
</category>
</item>
<item>
<category>
<name>Taxes</name>
<symbol>POL</symbol>
<subcategories>
<category>
<name>Taxes</name>
<symbol>TAX</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
"Taxes","POL"
"Taxes","TAX","POL"
"","FUT"
"Lamb","MEATS","FUT"
"Crude Oil","ENG","FUT"
"Rice","GRN","FUT"
"Nuts","FVT","FUT"
"Batteries","MTL","FUT"
"Futures Exchange","EXCH","FUT"
"Softs","SFT","FUT"
"Options on Futures","OPT","FUT"
"Top News","TOP","FUT"
"Agriculture","AG","FUT"
"Economics","ECO"
"Global Trade","TRD","ECO"
"Geography","GEO"
"Philippines","PHIL","GEO"
"Australia","AUS","GEO"
"Bolivia","BOL","GEO"
"Cuba","CUB","GEO"
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