Skip to content

Instantly share code, notes, and snippets.

zdne / modeling.markdown
Last active August 29, 2015 13:56
Modeling API: Attributes vs. Relations vs. Affordances

Modeling API

Question: Affordances or web link relations for modeling your API?

I have been pondering this question a lot lately. Given a resource and its attributes (semantic descriptors), would you model the API using the link / relations or resource affordances? May one relation as defined by RFC5988 Web Linking imply multiple affordances? For example does the edit relation represents three affordances (retrieve, update, and delete)?

Is (should?) the perspective affordances vs. relations differ based on the point of view (API design, client, server).

Most of the hypermedia media types such as HAL, Collection+JSON and JSON API are built around link relations. Seems that on

graydon /
Created April 23, 2014 00:03
country bounding boxes
# extracted from http//
# under public domain terms
country_bounding_boxes = {
'AF': ('Afghanistan', (60.5284298033, 29.318572496, 75.1580277851, 38.4862816432)),
'AO': ('Angola', (11.6400960629, -17.9306364885, 24.0799052263, -4.43802336998)),
'AL': ('Albania', (19.3044861183, 39.624997667, 21.0200403175, 42.6882473822)),
'AE': ('United Arab Emirates', (51.5795186705, 22.4969475367, 56.3968473651, 26.055464179)),
'AR': ('Argentina', (-73.4154357571, -55.25, -53.628348965, -21.8323104794)),
'AM': ('Armenia', (43.5827458026, 38.7412014837, 46.5057198423, 41.2481285671)),