API

For times when you cannot make it in person to our convenient Canal St. location, we offer our integers via API as well.

API Methods

New Integer

To get a new CSInteger, simply send a POST request to /integer, with a format parameter:

curl -v -X POST -d format=json http://canalstintegers.com/integer

Look for your integer in the response body:

HTTP/1.1 201 Created
Location: http://canalstintegers.com/integer/231461712866459648
Content-Type: application/json; charset=utf-8

{
  "cs_integer":
  {
    "id":231461712866459648,
    "description":"A fashionable integer #231461712866459648 as used by Leonardo DiCaprio on Twitter",
    "celebrity_name":"Leonardo DiCaprio",
    "celebrity_screen_name":"LeoDiCaprio",
    "origin_url":"http://twitter.com/LeoDiCaprio/status/231461712866459648"
  }
}

Acceptable formats are JSON and XML.

Verify Integer

To view the details of an existing CSInteger, send a GET request to /integer/:id(.:format)

curl -v http://canalstintegers.com/integer/231904517690650624.json

The response will contain all the details of the CSInteger:

HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8

{
  "cs_integer":
  {
    "id":231904517690650624,
    "description":"A dashing integer #231904517690650624 as used by Neil Patrick Harris on Twitter",
    "celebrity_name":"Neil Patrick Harris",
    "celebrity_screen_name":"ActuallyNPH",
    "origin_url":"http://twitter.com/ActuallyNPH/status/231904517690650624"
  }
}

Beware of counterfeits! If the id is invalid, you will get back an error message with a HTTP 404 status code.

Acceptable formats are JSON and XML.