Follow us on:
We've got a full API that gives you access to the chewy center (er, the data) of BlockChalk, in a variety of formats. This is our first release of the API and we'd love to hear your feedback.


Current API version: v0.65 (10/1/09)


Basic concepts
  1. You must specify a custom user agent for all API requests. The user agent must be of the form blockchalk-*; that is, it must contain an application-specific identifier prefixed with the phrase blockchalk-.

  2. Please drop us a line and let us know your name, the name and purpose of your application, and the user agent you will be using.

  3. "User-specific" operations require a unique user ID code per user. You must request this code once per unique user of your application and then store and reuse it for all user-specific calls. Note that the "General" operations do not require this user ID code because they are not user-specific operations.

  4. All requests are in a simple HTTP GET or POST format. Data is by default returned in XML format but most requests can return JSON or RSS instead. RSS responses support GeoRSS where appropriate.

Usage guidelines


In general, do unto BlockChalk as you would have it do unto you. More specifically:
  1. Be honest: do not post chalks to locations where your user is not actually located.
  2. Play nice: do not spam people or places.
  3. Show mercy: do not make large numbers of simultaneous requests. Our bandwidth and CPU are not limitless.
  4. Kick ass: do build interesting things with these interfaces, and let us know how we can improve them.

Definition of terms (used in italics below)
  • latitude: user's current latitude, to a max of 8 decimal places; please provide as much precision as possible.

  • longitude: user's current longitude, to a max of 8 decimal places; please provide as much precision as possible.

  • userId: 32-digit ID used to identify the user; you must request this code (via user/new, see below), cache it and reuse it in order to behave as the same user across sessions and access replies addressed to this user.

  • message: desired contents of new chalk or reply, max of 256 characters.

  • chalkId: 12-digit ID of a chalk being referenced (this can also be found in a given chalk's URL; e.g. http://blockchalk.com/6b6f068a603e).

  • replyId: 12-digit ID of the chalk or reply being referenced by a private reply.

  • postId: 12-digit ID of the chalk being referenced by a chalkback.

  • place: an optional field the user can supply when authoring a chalk or reply. Can either indicate their exact coordinates at the time of authoring (with full accuracy), or it can be a valid street address. If this field is present and contains coordinates, you should consider it to be the definitive coordinates for the object in question. If this field is present and contains a street address, you should treat it as a secondary, user-specified location and display it as such.

Revision history
  • 0.60 (8/30/09): Original release.
  • 0.61 (8/31/09): Added support for GeoRSS. Added additional RSS call with different URL structure to support Google Maps mash-ups.
  • 0.62 (9/8/09): Added "coordinates" field to reveal latitude and longitude in XML and JSON responses.
  • 0.63 (9/21/09): Added "neighborhood" attribute to XML and JSON response for GET /chalks, to indicate name of the user's current neighborhood (when it is known).
  • 0.64 (9/29/09): Added optional profanity filter to most calls that return chalks or replies.
  • 0.65 (10/1/09): Added optional chalkbackTo parameter to POST /chalk, allowing for chalkbacks (public responses to chalks).

Available calls

General operations: User-specific operations:


GET /chalks - Get all chalks near a given location

Returns the latest chalks each from "right here", "this block", "within two blocks", and "in your neighborhood". Up to 100 results.

Note that the "neighborhood" field/attribute refers not to the neighborhood of a specific chalk but rather to the user's current neighborhood (as determined from the latitude and longitude passed in with the request). This data is not always available but is returned when it is known. In the XML response this it takes the form of a single attribute on the top-level "chalk" tag. In the JSON response it is a field that recurs with each individual chalk; despite this, the field should not be confused as being related to a specific. (This JSON format is admittedly a hack but it was done in order to allow providing this data without breaking backwards compatibility with the current API version. This will be improved in the next version of the API.)

URL:
http://blockchalk.com/api/v0.6/chalks?lat=latitude&long=longitude

If you also provide the optional URL parameter user=userId the results will be filtered to omit any chalks that the given user has buried (see
POST /chalk/chalkId/bury).

If you provide the optional URL parameter profanityFilter=true a profanity filter will be applied to the results.

HTTP method:
GET

Formats:
By default results are returned as XML. You can request JSON or RSS by adding the optional &format=xml|json|rss parameter.

Response (success): HTTP 200

XML:
<chalks neighborhood="Inner Sunset">
<chalk>
<id>7b1ec33dc010</id>
<contents>Drinking at Gordon biersch</contents>
<datetime>2009-08-14 00:07:04 UTC</datetime>
<distance>right here</distance>
<coordinates lat="37.344" long="-121.888"/>
<place/>
<chalkbackTo>32a9f4ea86a2</chalkbackTo>
</chalk>
<chalk>
<id>36d9f2ea81a1</id>
<contents>I'm the froyo mayur</contents>
<datetime>2009-08-13 23:09:11 UTC</datetime>
<distance>within a few blocks</distance>
<coordinates lat="37.442" long="-122.159"/>
<place>123 Main St Anytown, CA</place>
<chalkbackTo/>
</chalk>
</chalks>


JSON:
[{"contents": "Drinking at Gordon biersch", "neighborhood":"Inner Sunset","id": "7b1ec33dc010", "datetime": "2009-08-14 00:07:04 UTC", "distance": "right here", "chalkbackTo":"32a9f4ea86a2", "coordinates":{"lat":"37.344","long":"-121.888"}}, {"contents": "I'm the froyo mayur", "neighborhood":"Inner Sunset", "id": "36d9f2ea81a1", "datetime": "2009-08-13 23:09:11 UTC", "distance": "within a few blocks", "coordinates": {"lat":"37.443","long":"-122.159"}, "place": "123 Main St Anytown, CA"}]

Response (failure): HTTP 400

XML:
<errors>
<error>no latitude</error>
<error>invalid longitude</error>
</errors>


JSON:
[{"error": "no latitude"}, {"error": "invalid longitude"}]



GET /chalks/latitude,longitude - Get all chalks near a given location in GeoRSS format


GET /chalk/chalkId - Get details for a specific chalk

Returns details for the chalk specified by chalkId.

URL:
http://blockchalk.com/api/v0.6/chalk/chalkId

If you provide the optional URL parameter profanityFilter=true a profanity filter will be applied to the results.

HTTP method:
GET

Formats:
By default results are returned as XML. You can request JSON by adding the optional &format=xml|json parameter. Note that this operation does not support RSS.

Response (success): HTTP 200

XML:
<chalk>
<id>7b1ec33dc010</id>
<contents>Drinking at Gordon biersch</contents>
<datetime>2009-08-14 00:07:04 UTC</datetime>
<coordinates lat="37.344" long="-121.888"/>
<place/>
<chalkbackTo>32a9f4ea86a2</chalkbackTo>
</chalk>

JSON:
[{"contents": "Drinking at Gordon biersch", "id": 7b1ec33dc010, "datetime": "2009-08-14 00:07:04 UTC", "chalkbackTo":"32a9f4ea86a2", "coordinates":{"lat":"37.344","long":"-121.888"}}]

Response (failure): HTTP 400

XML:
<errors>
<error>invalid chalkId</error>
</errors>


JSON:
[{"error": "invalid chalkId"}]



GET /user/new - Request a new user ID

Returns a new, unique user ID code. Only call this operation when you need to request an ID for a new user of your application. Store this ID and reuse it for all future requests made on a given user's behalf.

URL:
http://blockchalk.com/api/v0.6/user/new

HTTP method:
GET

Formats:
Plain text.

Response (success): HTTP 200
A successful response includes the new user ID in the message body; e.g.:

cf9305c326cc514d23144577275a23c6

Response (failure): HTTP 500
This call should only fail if there is a server problem, in which case an HTTP 500 will be returned. Please wait and try again later.



GET /user/userId/chalks - Get recent chalks written by a given user


GET /user/userId/replies - Get recent replies written to a given user

Returns the 20 most recent replies written to the user indicated by userId.

URL:
http://blockchalk.com/api/v0.6/user/userId/replies

If you provide the optional URL parameter profanityFilter=true a profanity filter will be applied to the results.

HTTP method:
GET

Formats:
By default results are returned as XML. You can request JSON or RSS by adding the optional &format=xml|json|rss parameter.

Response (success): HTTP 200

XML:
<replies>
<reply>
<id>6a1ca13fb012</id>
<contents>lol wut r u talking about man</contents>
<datetime>2009-08-20 10:13:00 UTC</datetime>
<place/>
</reply>
</replies>


JSON:
[{"contents": "lol wut r u talking about man", "id": 6a1ca13fb012, "datetime": "2009-08-20 10:13:00 UTC"}]

Response (failure): HTTP 200
Failure responses for both XML and JSON will manifest as an HTTP 200 response with an empty response body. In this context "failure" means either that the supplied userId was invalid, or it was valid but there were no replies to return.



POST /chalk - Create a new chalk

Creates a new chalk. Returns the full details of the newly-created chalk.

URL:
http://blockchalk.com/api/v0.6/chalk/

HTTP method:
POST

Request body:
msg=message&lat=latitude&long=longitude&user=userId

If you include the optional parameter chalkbackTo=postId then this post will be considered a chalkback (a public response) to the post referenced by postId. A chalkback looks like any other post but in the future BlockChalk will provide additional differentiation in this regard. Only use this feature for chalkbacks to posts; you cannot create a chalkback that references a private reply.

Formats:
By default results are returned as XML. You can request JSON by adding the optional &format=xml|json parameter. Note that RSS is not supported for this call.

Response (success): HTTP 200

XML:
<chalk>
<id>6a2ec13ea120</id>
<contents>this pothole is a menace!</contents>
<datetime>2009-08-24 19:20:31 UTC</datetime>
<coordinates lat="37.112" long="-122.416"/>
<place/>
</chalk>


JSON:
[{"contents": "this pothole is a menace!", "id": 6a2ec13ea120, "datetime": "2009-08-24 19:20:31 UTC", "coordinates":{"lat":"37.112","long":"-122.416"}}]

Response (failure): HTTP 400

XML:
<errors>
<error>no latitude</error>
<error>invalid longitude</error>
<error>message longer than 256 characters</error>
<error>invalid userId</error>
</errors>


JSON:
[{"error": "no latitude"}, {"error": "invalid longitude"}, {"error": "message longer than 256 characters"}, {"error": "invalid userId"}]



POST /reply - Send a reply

Sends a new reply. Returns the full details of the newly-created reply.

URL:
http://blockchalk.com/api/v0.6/reply/

HTTP method:
POST

Request body:
replyTo=replyId&msg=message&lat=latitude&long=longitude&user=userId

Formats:
By default results are returned as XML. You can request JSON by adding the optional &format=xml|json parameter. Note that RSS is not supported for this call.

Response (success): HTTP 200

XML:
<reply>
<id>6a1ca13fb012</id>
<contents>lol wut r u talking about man</contents>
<datetime>2009-08-20 10:13:00 UTC</datetime>
<coordinates>37.112,-122.416</coordinates>
<place/>
</reply>

JSON:
[{"contents": "this pothole is a menace!", "id": 6a2ec13ea120, "datetime": "2009-08-24 19:20:31 UTC", "coordinates": "37.112,-122.416"}]

Response (failure): HTTP 400

XML:
<errors>
<error>no latitude</error>
<error>invalid longitude</error>
<error>message longer than 256 characters</error>
<error>invalid or missing userId</error>
<error>invalid or missing replyId</error>
</errors>


JSON:
[{"error": "no latitude"}, {"error": "invalid longitude"}, {"error": "message longer than 256 characters"}, {"error": "invalid or missing userId"}, {"error": "invalid or missing replyId"}]



POST /chalk/chalkId/bury - Bury a chalk

Buries the specified chalk, which permanently hides it from this user's view.

URL:
http://blockchalk.com/api/v0.6/chalk/chalkId/bury

HTTP method:
POST

Request body:
user=userId

Formats:
Plain text.

Response (success): HTTP 200

Success results in an HTTP 200 with an empty message body.

Response (failure): HTTP 400

XML:
<errors>
<error>invalid or missing userId</error>
<error>invalid or missing chalkId</error>
</errors>


JSON:
[{"error": "invalid or missing userId"}, {"error": "invalid or missing chalkId"}]


[home]