Home      API      Documentation      Demo     

Documentation



About this API
Basic principles
Request parameters
Server response format
Public and secret API keys
Requests quota
Attribution
Sites where Pressmon.com API is used


About this API

This REST API returns sentences from the press and literature in different languages which contain given word or words combination allowing you to get examples of use of a word in different contexts.


This may be useful for online dictionaries and other linguistic resources.


At the moment the API allows searching for words in the following text corpora:

  • English
  • Spanish
  • Italian
  • German
  • Russian
  • French



Basic principles

1. Sending a request to server.

Example:

https://pressmon.com/api?q=word-to-search&key=YOUR_API_KEY
(this example contains the minimal set of parameters)


2. Getting a response from server in JSON format and interpreting of the results.

Server requests parameters

qWord or words combination to search for. Mandatory parameter
keyPublic or secret API key. Mandatory parameter
lText corpus language to search in. Possible values:
en - English
es - Spanish
it - Italian
de - German
ru - Russian
fr - French

Default: en
fromRecord number to start with.
Default: 0.
sizeMaximum number of sentences to return.
Default: 10.
Minimal value: 1, maximum value: 100.
formatData format to return results in. Allowed values:
json
jsonp
For cross-domain requests with jQuery library you must use jsonp format. Default: json.
gteMinimal sentence length to return. Only sentences shorter than this value will be returned. Default: 0.
lteMaximum sentence length to return. Only sentences larger than this value will be returned. Default: 10000.

You can use from and size parameters for pagination.


Request example with all parameters:
https://pressmon.com/api?q=dictionary&key=YOUR_API_KEY&l=en&from=10&size=15&gte=150&lte=500&format=jsonp
This request tells the API to search for sentences containing the word dictionary in English corpus. Return results in jsonp format, 15 records starting from the 10-th one. Search for sentences not shorter than 150 and not larger than 500 characters.

Server response format

The server returns the results in JSON or JSONP format (depending on the value of format field).
In case of successful request the res field will contain ok, otherwise - error.
In case of error, you can find the error description in the info field.

Parameters returned in server response:
res in case of successful request, error otherwise
infoError description in case of error
quota_dailyDaily requests quota for given API key
quota_daily_usedQuota used today
langText corpus language where the search was performed
timeTime of request execution, in milliseconds
queryText to search for
fromRecord number to start results with
sizeMaximum number of results in server response
gteMimimum sentence length
lteMaximum sentence length
hits Contains the sentences found as records with the following structure:

article_idArticle ID at Pressmon.com
lenCurrent sentence length (number of characters)
countryCountry code of the publication source
sourcePublication source
pub_dayPublication day
pub_monthPublication month
pub_yearPublication year
titleArticle title
bodyText of the sentence found
urlURL of the article containing the sentence found

Example of server response with an error message:
{ "res": "error", "info": "Quota exceeded" }

Example of a successful server response:
{
"res":"ok",
"from":"0",
"size":"10",
"quota_daily_used":"217",
"quota_daily":"5000",
"lang":"en",
"time":"389",
"query":"dictionary",
"collection":"sentences_en",
"max_score":"4.2429724",
"hits_total":"50",
"scope":"body",
   "hits":[

{
"country":"",
"source":"Korean News",
"pub_day":"21",
"score":"4.2429724",
"body":"A new window will open with a dictionary definition or encyclopedia entry. ",
"pub_year":"2008",
"id":"5303ad88b92aa6da710e54fa",
"article_id":"453",
"len":"22",
"url":"https://pressmon.com/-lang-/a/en/453",
"pub_month":"5",
"title":"ELECTION GUIDE 2008 \""
},
{
"country":"",
"source":"Korean News",
"pub_day":"18",
"score":"4.073505",
"body":"The dictionary contains a vocabulary of over 402,000 words. ",
"pub_year":"2008",
"id":"5303a9efb92aa6da7109771f",
"article_id":"850",
"len":"42",
"url":"https://pressmon.com/-lang-/a/en/850",
"pub_month":"1",
"title":"COMPREHENSIVE KOREAN DICTIONARY SEES LIGHT"
}
   ]

     }



Public and secret API keys

This API provides a public and a secret key. Both keys are available in your account upon registration.

For a public key you can provide a list of domains which are allowed to send requests using this API key. You may use the public key in applications running on the client side where any user can see the key, but it's use is allowed only on certain domains. The secret key can be used on the server side where the key may be used on any domain, but is not available to users.

You can change your keys at any time.

Requests quota

We provide a free quota of 2 000 daily requests. If this limit is exceeded, you will see a "quota exceeded" error message.

You can see in your account how much time is left before the quota is restored.

If you need more quota, please contact us here.

Attribution
You must provide a link to www.pressmon.com on all pages where the content obtained using this API is displayed.

Examples of links:
Powered by Pressmon.com
Examples by Pressmon.com
Примеры от Pressmon.com
Ejemplos por Pressmon.com


Sites where Pressmon.com API is used

On these sites you can see how our API is used in production:

www.diccionario.ru - Spanish-Russian and Russian-Spanish dictionary
www.diclib.com - Online dictionaries of different languages

Go to main page