Search API Documentation

Api reference

Lijit Search API Reference

Contents

Overview

Welcome to the documentation for the Lijit Search API .This API allows you to embed Lijit Search Results in your web pages.Once you read this documentation, you should be able to programmatically create a search query and parse the results.

Audience

This documentation is designed for people familiar with web services and object-oriented programming concepts. There are many tutorials on the web that provide information on how to interact with web services via XML-RPC and REST methods. To gain access to the api, or if you have any questions, contact us via SUPPORT at LIJIT DOT COM .

Search Requests

Use of the api involves sending a request to lijit via REST . This request will contain a search query, the scope of the query, and an api key. The data will be returned in the Open Search XML format. Once you have the data, you can parse the xml we return, and embed this data in your own web page, or application. All search queries must be url encoded prior to submission via REST . Be aware that search queries use the Lijit user as the contextual base. This api does not return search results for all lijit users. It will only return results for the user implementing the api.

Making a Search Request

Authentication

An API key is required for every api request your software makes. You can obtain an API key by contacting 'support at lijit dot com' . We will evaluate your request and supply your login credentials via email.

Please include the following information in your email request:

  • Your Name
  • Company Name
  • Contact Email

Search

Each search query requires a unique search request. This search method returns results for the
specified context.
  • blog = Search only the user's primary blog/site.
  • content = Search only all of the users self generated content.
  • network = Search only the user's social network .

REST Method:

search(api_key,context,term,[informer_uri])
Returns OpenSearch XML that represents the search results.
URL: http://www.lijit.com/search-api/rest?method=search&api_key=987654321&context=blog&term=foo
Parameters:
  • api_key. Required. The api key you were assigned.
  • context. Required. Valid options: blog,content, network.
  • term. Required. The url encoded search term.
  • informer_uri . Currently not supported

Paginate Search

Each search query requires a unique search request. The paginate search allows you to paginate through the search results. Use this method to search for a particular term or terms and only return a finite result set.

REST Method:

paginate_search(api_key, context, term, start, hits_per_page, [informer_uri])
Returns OpenSearch XML that represents the search results.
URL: http://www.lijit.com/search-api/rest?method=paginate_search&api_key=987654321&context=blog&term=foo&start=0&hits_per_page=10
Parameters:
  • api_key. Required. The api key you were assigned.
  • context. Required. Valid options: blog,content, network.
  • term. Required. The url encoded search term.
  • start. Required. The start index of the search results.For instance, if your result set was 50 and hits_per_page was set to 10 then a start index of 9 would return results 10-20.
  • hits_per_page. Required.The results you want to return per request.
  • informer_uri. Currently not supported.

Search All

Each search query requires a unique search request. This search method returns results for all of the available contexts.

REST Method:

search_all(api_key,term)
Returns OpenSearch XML that represents the search results for all contexts.
URL: http://www.lijit.com/search-api/rest?method=searchall&api_key=987654321&term=foo
Parameters:
  • key. Required. The api key you were assigned.
  • term. Required. The url encoded search term.

Error Handling

In the event the api is unavailable, the returned xml will contain an error field indicating the error state. Example xml:


service unavailable

Examples

Examples of REST requests.

REST Method:

  • Search
    • http://www.lijit.com/search-api/rest?methode=search&api_key=01010101010101&context=blog&term=Lijit%20Search%20is%20Cool
    • This will return Opensearch formatted xml for the user context "blog", and the search term "Lijit Search is Cool"
  • Paginate Search
    • http://www.lijit.com/search-api/rest?method=paginate_search&api_key=01010101010101&context=content&term=Lijit%20Search%20is%20Cool&start=14&hits_per_page=15
    • This will return Opensearch formatted xml for the user context "content", and the search term "Lijit Search is Cool, and assuming there are more than 15 results, will include results 15-30 .
  • Search All
    • http://www.lijit.com/search-api/rest?method=search_all&api_key=01010101010101&term=Lijit%20Search%20is%20Cool
    • This will return Opensearch formatted xml for the search term "Lijit Search is Cool"