Thoughts on API’s and Max

After looking at hundreds of API’s over past months – models begin to emerge:

  • Visualization: Looking at data by filtering, analysis, or factors defining movement.
  • Synthesis: producing  feeds from sources, in combination – fusion
  • Transcoding: changing one type of signal into another

Or some combination of all three.

The best tools for getting data in and out of Max:

  • curl (or variants in client libraries)
  • JSON
  • Osc
  • string parsing outside of Max
  • database tools (or data recorder in Max)
  • basic data filtering and scaling tools in Max
  • for complex networked systems: node.js

 

Mashape API’s

https://www.mashape.com

notes

 

 

 

Mashape

An API factory.

https://www.mashape.com

Happened to look at mashape.com again today. Its grown considerably over the past year and now provides access to over 1300 API’s with open source client libraries and Oauth proxies.

Mashape is an API of API’s – a layer of abstraction that standardizes how you consume API’s.

Instructions for using the API: https://www.mashape.com/docs/consume/rest

Here’s an example of a typical API call which gets the weather in San Francisco. Note I have obscured the API-key.

curl -H "X-Mashape-Authorization: YOUR-MASHAPE-KEY" "https://george-vustrey-weather.p.mashape.com/api.php?_method=getForecasts&location=San%20Francisco"

Here’s the result:

[{"day_of_week":"Wed","high":"63","low":"47","condition":"Mostly Clear"},{"day_of_week":"Thu","high":"66","low":"50","condition":"Partly Cloudy"}]

[Note] examples in tkzic/mashape

The API description pages have curl examples.

 

Installing pycurl on Mac Os

notes

update: 11/1/2014 installed version 7.19.5 using easy_install

Here’s the website: http://pycurl.sourceforge.net

It worked. Because xCode was installed?

sudo env ARCHFLAGS="-arch x86_64" /usr/bin/easy_install setuptools pycurl==7.19.0

Here are instructions, but really all I needed was the above command

http://blog.carlotorniai.net/lion-and-pycurl/

Pycurl examples: http://www.angryobjects.com/2011/10/15/http-with-python-pycurl-by-example/

Local file examples in tkzic/python-api/

There are other Python libs like request, human curl, urllib….

Processing, Twitter, OSC, and Max

A variation on the Twitter mood-lamp program.

note 6/2014 – this may not work due to changes in oauth

local files:

  • Processing: /documents/processing/osc_max_testing
  • Max: tkzic/max teaching examples/processing-osc

It grabs a ‘feed’ or any URL which returns a bunch of text. Then it does some analysis on the text, and using the results to send RGB data back to Max using OSC.