Creative Commons Licence All content and services are licenced under a Attribution-NonCommercial-ShareAlike Creative Commons Licence (see our Terms of Service).

> Using NewsIsFree's API

For using NewsIsFree's API you need to be a registered user and have a personal application key. For getting your personal application key, please, contact us. For using clipPost and unclipPost functions you need to have a Premium Account.

All the API functions may return API response structure with corresponding response code and response message. This structure is always returned on errors. Some of the functions return this structure with successfull code (it is mentioned in function description).

//response structure on success

//response structure on authorization error
'resonse_message'=>'Not Authorized');

Status response code definitions:

  • 2xx - successfull;
  • 3xx - redirection;
  • 4xx - client errors;
  • 5xx - server errors.

This site uses the PHP implementation of SOAP server with WSDL definitions. So for getting access to NIF API you need to create a SOAP client. Below there are examples of SOAP client, using php5 standard SOAP library, PEAR SOAP and nusoap libraries:
//php5 client
$client = new SoapClient("http://newsisfree.com/nifapi.wsdl",array("trace" => 1"exceptions" => 0));
$result $client->some_API_func($param1$param2,....,$paramn);

//pear soap client
$client = new SOAP_Client('http://newsisfree.com/nifapi.wsdl');
$param = array();
$param = array('param1'=>'param1','param2'=>'param2',.....,'paramn'=>'paramn');
$result $client->call('some_API_func'$param);

// nusoap client
$client = new nusoapclient('http://newsisfree.com/nifapi.wsdl'true);
$param = array();
$param = array('param1'=>'param1','param2'=>'param2',.....,'paramn'=>'paramn');
$data $client->call('some_API_func'$param);

> directSearch(login, password, search, params)

This method searches the news, depending on given parameters. The analog of newsisfree advanced search.
  • application_key (string) - application key;
  • login (string) - user login;
  • password (string) - user password;
  • search (string) - search string;
  • params (string) - hash array of additional search parameters (very important to use 'params' array values order as shown below);
    • as_language - language code (e.g. en,fr,it)
    • numitems - number of items to search (max 100)
    • source_id - source id
    • as_sourcename - source name
    • as_category - category id
    • as_author - author name
    • as_topics - topics
    • as_date_from - from date (YYYY/MM/DD)
    • as_date_to - to date (YYYY/MM/DD)
    • as_pop_from - from popularity (0
    • as_exact - exact match
    • as_synonym - use synonyms
    • as_relevance - by relevance
    • as_intitle - only in titles
This method returns a hash array with found items. The named items are:
  • "query": search query
  • "page": search query
  • "numitems": number of items to return (max 100)
  • "relevance": by relevance
  • "intitle": only in titles
  • "exact": exact match
  • "synonym": use synonyms
  • "shortdesc": short description
  • "from": from number
  • "to": to number
  • "time": time
  • "hits_total": number of items at all
  • "rate_from": rating from
  • "rate_to": rating to
  • "items": array of found items
    • "id": id of the news/item
    • "title": item headline
    • "date": date
    • "link": link from which the item was taken
    • "desc": news/item description
    • "author": item author
    • "popularity": item popularity
    • "source": name of the source
    • "sourceid": id of the source
    • "sourcetitle": name of the source
home  •   advertising  •   terms of service  •   privacy  •   about us  •   contact us  •   press release design by Popshop •   © 1999-2018 NewsKnowledge