URL API Documentation

Overview

  1. API Overview
  2. Classify a text
  3. Classify an URL
  4. Example response

API Overview

Our hope is to provide an easy-to-use API using URL requests. Let us know if this is not the case! When a request is done to the server, a response is returned. The response will tell you if the request was successful and return whatever is relevant for your calls. Responses will be in XML or JSON while requests are in URL format as detailed below. As you may be familiar with, accessing classifier via the web can be done by browsing them. The URL API uses the same structure to access classifiers, that is: http://uclassify.com/browse/username/classifiername/operation?arguments

Operations

ClassifyText

Classifying a text with the URL API is easy, just use a 'ClassifyText' operation together with the appropiate arguments. Please note that all arguments should be URL encoded (HttpUtility.UrlEncode in C# and urlencode in PHP). uClassify has a 1MB limit per request however Web browsers (Internet Explorer, Firefox etc) usually limit the length of urls to between 2000 and 4000 characters.

Arguments

  • readKey - (string) a read API key that has access to the specified classifier. Sign up to get yours for free. Remember to URL encode it!
  • text - (string) the text you want to classify. Remember to URL encode it!
  • removeHtml - (boolean, optional) specifies whether you want the API to remove html tags before classification. Possible values are: '1', '0', 'true', 'false'
  • output - (string, optional) specifies the response format (default is 'xml'), can be 'xml' or 'json'
  • version - (string, optional) specifies the api version (default is 1.00), can be '1.00' or '1.01'

Example - classify a text - response in XML

You must exchange 'YOUR_READ_API_KEY_HERE' with a real API key for this to work (sign up):
http://uclassify.com/browse/uClassify/Text Language/ClassifyText?readkey=YOUR_READ_API_KEY_HERE&text=What+language+is+this+text%3f&version=1.01

Example - classify a text - response in JSON

You must exchange 'YOUR_READ_API_KEY_HERE' with a real API key for this to work (sign up). Clicking on this link, will ask you to save a file (due to the nature of the MIME type application/json)
http://uclassify.com/browse/uClassify/GenderAnalyzer_v5/ClassifyText?readkey=YOUR_READ_API_KEY_HERE&text=beer+hammer+build&output=json&version=1.01

ClassifyUrl

Classifying an URL with the URL API is easy, just use the 'ClassifyUrl' operation together with the appropiate arguments. Please note that all arguments should be URL encoded (HttpUtility.UrlEncode in C# and urlencode in PHP).

Arguments

  • readKey - (string) a read API key that has access to the specified classifier. Sign up to get yours for free. Remember to URL encode it!
  • url - (string) the content on the url will be downloaded and classified. Remember to URL encode it!
  • removeHtml - (boolean, optional) specifies whether you want the API to remove html tags before classification. Possible values are: '1', '0', 'true', 'false'
  • output - (string, optional) specifies the response format (default is 'xml'), can be 'xml' or 'json'
  • version - (string, optional) specifies the api version (default is 1.00), can be '1.00' or '1.01'

Example - classify a blog

You must exchange 'YOUR_READ_API_KEY_HERE' with a real API key for this to work (sign up):
http://uclassify.com/browse/uClassify/Text Language/ClassifyUrl?readkey=YOUR_READ_API_KEY_HERE&url=http%3a%2f%2fblog.uclassify.com&version=1.01

Example Responses

JSON Example Response

I hope the JSON response is self explainatory, I am new to JSON, so if there are any issues with this format, please let me know!

XML Example Response

You can read more about the response format here * Note on the response, ex and e-x is a scientific format for floating points.