by crodjer on April 5, 2012, tagged api, interviewstreet, web, django

It is nowadays customary of companies to expose parts of their infrastructure to the public, in the form of an (API) Application Programming Interface. Hackers can utilize these to develop innovative apps and products.

I have been working over exposing an API to the internal codecheckers for Interviewstreet for some time. A beta version of this is up now and we are accepting registrations on an invite basis. Post a request for invite here:


The API is up at It provides a HTTP based format agnostic interface. You can use any of these popular formats: json, xml, yaml, pickle. JSON is the default. Format can be specified by appending .<format> to the url. Eg:

for talking to the API in xml format.


The functionality provided is straight forward. It asks for the programming language (supporting over 15 languages), the program to evaluate and the testcases to run that code against.
As results to the evaluation, it will tell you if the code was successfully compiled, how it ran against all your test cases and the outputs it generated.


This API is pretty reliable. It is a django front end to the system that is used internally. It is well maintained and regularly tested. In fact, it has already had a successful run with Overnite, a night long programming event conducted under Kshitj (IIT Kharagpur’s technical Fest).

Developing a client

If the language you are using supports basic HTTP request, developing a client to interact with the API is simple. The documentation explains how to use it against curl. Here is a python implementation using urllib2:

import urllib2
import json
import random

url = ''

# A demo submission
submission_data = {
    'source': 'print 111' #prints 111 in python,
    'hash': "your-random-submission-unique-hash",
    'testcases': [
    'lang': 5 #This is python

request = urllib2.Request(url)
request.add_header('Content-type', 'application/json')
response = urllib2.urlopen(request, json.dumps(submission_data)).read()
key = json.loads(response)['key']

# Getting the result

response = urllib2.urlopen("%s&key=%s" %(url, key))
result = json.loads(['result']

## Do whatever with the result

The API is undergoing modifications, so it is currntly down.