Using the API for Text Analytics

All input parameters, including the text being analyzed and options, are defined in the request body.

Parameter NameTypeDescription
contentstringText to process
contentUristringURI to accessbile content
languagestringISO 639 language code

content and contentUri are mutually exclusive; only one can be specified per call.

The text being analyzed can be provided either as a string of text, a file, or the contents of a web page, specified by a URI.

To specify a stirng of text or a file, use the content parameter:

"content": "The Securities and Exchange Commission today announced the leadership \
of the agency’s trial unit. Bridget Fitzpatrick has been named Chief Litigation Counsel \
of the SEC and David Gottesman will continue to serve as the agency’s Deputy Chief Litigation \
Counsel. Since December 2016, Ms. Fitzpatrick and Mr. Gottesman have served as Co-Acting Chief \
Litigation Counsel. In that role, they were jointly responsible for supervising the trial unit \
at the agency’s Washington D.C. headquarters as well as coordinating with litigators in the SEC’s \
11 regional offices around the country."

Processing Local files

This cURL example assumes you have a file input.txt in the directory Users/user with your input data.

curl -H POST \
-H "X-BabelStreetAPI-Key: your_api_key"\
-F content=@/Users/user/input.txt \
-F request='{"options": {"multilingual": true}}';\
type=application/json \
"https://analytics.babelstreet.com/rest/v1/language"

Processing URIs

The text or document being analyzed can be contained in a website, accessed through a URI. Processing URI content is supported by submitting contentUri in your requests instead of content.

This procedure is available for all the text analtyics endpoints.

  • contentUri must be a valid HTTP, HTTPS, or FTP URL
  • Supported MIME types include text and HTML.
  • The URL must be publicly accessible from the internet.
  • No authentication is supported.
  • No cookies or other persistence mechanism is supported.
  • Page content (HTML) dynamically generated by JavaScript cannot be downloaded.
  • Sites that deny programmatic (without a real browser controlled by an end user) requests cannot be downloaded.
curl -s -X POST \
-H "X-BabelStreetAPI-Key: your_api_key" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H "Cache-Control: no-cache" \
-d '{"contentUri": "https://www.sec.gov/news/press-release/2017-161"
} }' \
"https://analytics.babelstreet.com/rest/v1/entities"