Data Portraits – API

The Data Portraits API allows you to access the Scan History collected by Data Portraits installations by yours truly and Lisa Gwilliam. It is currently a REST-like API, meaning that the apparatus for fetching data is a simple URL. There is currently only one function (getScans) with several options for grouping and response formats. Here’s a basic run down.

The following call will return all scans, grouped by portrait/print title and returned as JSON. Total count of results is always returned.

http://qrrs.me/api/?fn=getScans

There are three other parameters you can include in query to modify the data returned:

limit

Sets number of results you want
Default: all

Example:

http://qrrs.me/api/?fn=getScans&limit=1

returns:

{
    "count":"1",
    "results":
        [
           {
                "Nick": [{
                       "id":"15",
                       "pid":"15",
                       "sid":"15",
                       "vtitle":"Nick Jonas-I can't help myself (Sugar Pie Honey Bu",
                       "link":"rtsp://v7.cache1.c.youtube.com/CiILENy73wIaGQkKZ3VNgAccLRMYESARFEgGUgZ2aWRlb3MM/0/0/0/video.3gp",
                       "thumb":"http://i.ytimg.com/vi/LRwHgE11Zwo/0.jpg",
                       "v":"LRwHgE11Zwo",
                       "x":"22",
                       "y":"17",
                       "lati":"40.725334",
                       "longi":"-73.99616",
                       "uid":"355060042028568",
                       "t":"2011-04-14 21:31:33",
                       "title":"Nick",
                       "columns":"36",
                       "row":"44",
                       "stitle":"Douchebag Apocalypse"
                  }]
              }
         ]
}

format

Sets return data type. Valid values are json and html. XML will not be supported
Default: json

Example:

http://qrrs.me/api/?fn=getScans&format=web&limit=1

Returns as HTML

groupby

Organizes the data returned. Valid values are portrait, series, date, device.
Default: portrait

Example:

http://qrrs.me/api/?fn=getScans&groupby=date&limit=2

Returns:

{
    "count":"2",
    "results": [
        {
            "2011-04-14":[{
                "id":"15",
                "pid":"15",
                "sid":"15",
                "vtitle":"Nick Jonas-I can't help myself (Sugar Pie Honey Bu",
                "link":"rtsp://v7.cache1.c.youtube.com/CiILENy73wIaGQkKZ3VNgAccLRMYESARFEgGUgZ2aWRlb3MM/0/0/0/video.3gp",
                "thumb":"http://i.ytimg.com/vi/LRwHgE11Zwo/0.jpg",
                "v":"LRwHgE11Zwo",
                "x":"22",
                "y":"17",
                "lati":"40.725334",
                "longi":"-73.99616",
                "uid":"355060042028568",
                "t":"2011-04-14 21:31:33",
                "title":"Nick",
                "columns":"36",
                "row":"44",
                "stitle":"Douchebag Apocalypse"
               },{
                "id":"15",
                "pid":"15",
                "sid":"15",
                "vtitle":"Dead Pixel",
                "link":"#",
                "thumb":"http://raysweeten.com/d/assets/img/dp.jpg",
                "v":"xoJkw_KoTRc",
                "x":"20",
                "y":"17",
                "lati":"40.725334",
                "longi":"-73.99616",
                "uid":"355060042028568",
                "t":"2011-04-14 21:31:20",
                "title":"Nick",
                "columns":"36",
                "row":"44",
                "stitle":"Douchebag Apocalypse"
              }
            ]
         }
      ]
}
This entry was posted in Internets, Notes. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>