Orilango API

Application Programming Interface for all Orilango services

API for Orilango Did-you-mean

Welcome to the Orilango Did-you-mean API. The API enables you to deliver clever predictions to user input from your own application or web site. The API is a simple JSON-based RESTful HTTP-API.

In short, you do a simple GET-request with the user input and get a JSON-object with suggestions in return.

Before you can start using the API, you need to ask us for an api-key.



Request format

The API communicates over RESTful HTTP. The request contains these parts:

base-url The url to the Orilango predict service:
http://api.orilango.com/v2/didyoumean/
apikey Your api-key
input The input to get predictions on. For example, the contents of the search field on your web site.
The input needs to be url-encoded

The api-key can be sent either as part of the url or in the header. If you make a call to Orilango directly from the frontend (i.e with JavaScript) you can send the api-key as part of the url. If you make a call using a server-side language we recommend sending the key in the header.



Example when sending the api-key as part of the url

http://api.orilango.com/v2/didyoumean/myapikey/shos


Example when sending the api-key in the header

We're using the curl command to illustrate the example

curl http://api.orilango.com/v2/didyoumean/sho -H "Api-Key: myapikey"


Response format

The API returns JSON-encoded objects (content-type: application/json). The response contains these parts:

original The original input that was sent in the request
result An array of suggestions to the original input.


Example

{"original":"shos","result":["shows","shoes","show's","shoe's","Soho's","chose","SOS","sows","she's","chow's"]}


Example code

Ok, cool enough. Now you want to start using this API. Here's some example code in HTML and Javascript using the jQuery UI autocomplete library



HTML

Create a small html-file including the necessary Javascript file (jQuery in this case).
Add a text field and a div for the result and assign ids to them.

					<!doctype html>
					  <html lang="en">
					    <head>
					      <meta charset="utf-8" />
					      <title>Orilango Did-you-mean example</title>
					      <script src="http://code.jquery.com/jquery-1.9.1.js"></script>
					    </head>
					  <body>
					    <form onsubmit="return check_spelling()">
					      <input id="my_text" />
					      <input type="submit" value="Ok" />
					    </form><br />
					    <div id="my_result"></div>
					  </body>
					</html>
					


Javascript

Add a small piece of javascript to the page using jQuery. Remember to replace {apikey} with your real key

					<script type="text/javascript">
					  function check_spelling() {
					    $.ajax({
					      url: "http://api.orilango.com/v2/didyoumean/[apikey]/"+$('#my_text').val(), //Append the content of the text field to the request
					      dataType: "json",
					      success: function( data ) {
					        $('#my_result').html('<b>Did you mean</b><br />' + data.result.join(', ')); //Pick the array contained in the "result" variable
					      }
					    });
					    return false;
					  }
					</script>
					


Complete example

This is the final complete code example

					<!doctype html>
					<html lang="en">
					  <head>
					    <meta charset="utf-8" />
					    <title>Orilango Did-you-mean example</title>
					    <script src="http://code.jquery.com/jquery-1.9.1.js"></script>
					    <script type="text/javascript">
					      function check_spelling() {
					        $.ajax({
					          url: "http://api.orilango.com/v2/didyoumean/[apikey]/"+$('#my_text').val(), //Append the content of the text field to the request
					          dataType: "json",
					          success: function( data ) {
					            $('#my_result').html('<b>Did you mean</b><br />' + data.result.join(', ')); //Pick the array contained in the "result" variable
					          }
					        });
					        return false;
					      }
					    </script>
					  </head>
					  <body>
					    <form onsubmit="return check_spelling()">
					      <input id="my_text" />
					      <input type="submit" value="Ok" />
					    </form><br />
					    <div id="my_result"></div>
					  </body>
					</html>
					






Login




Whoops, incorrect email/password

Forgot your password?

Enter your email to reset your password.






Get started with Orilango





There is already an account connected to your email.