Tag Archives: public api

RMAP – important resource

Weather-Station-128x128I would like to be the first or one of first people quoting it: RMAP project. It is a very interesting initiative for a network of environmental data agents. The acronym stays for Rete di Monitoraggio Ambientale Partecipativo (Environmental and Participated Monitoring Network).

RMAP provides a whole set of – absolutely open source – tools, from hardware sensors up to web server for data gathering and distributing.

I am sure you will hear again about it. For the meanwhile… stay in touch.

REST API for WordPress

“Everything should be made as simple as possible, but not simpler.” A. Einstein

It is not that much I started tinkering about WordPress, and they publish a very interesting API for the site.
Following a well-established path, the site is a REST one. I would like to develop some code around it.
For now I show a very little snippet, in Python:

import urllib2
f = urllib2.urlopen('http://public-api.wordpress.com/rest/v1/sites/33534099/posts/43/?pretty=true/')
print f.read(100000)

If you own a nice copy of Python on your PC (that I warmly suggest), you can just call it with the simple
python
command. In the python environment you can then copy and paste the previous snippet, a row at a time, or you can create a file and make python execute it.
The result is a JSON description of data. What is Jason? We’ll see sooner or later: for now, let’s define it as a means to describe an object in a very direct manner.
For today please just observe the REST-ivity 🙂 of the call. If you look at the URL, you can clearly understand the structure of the request: it is a hierarchical description of something you want to GET.
It’s not by chance I am using the word “GET”: with REST you return to the very beginning of HTTP, (W3C specs) using just GET, POST, DEL and (guess!) PUT as basic verbs. Talking deeply about that would take us very far, for the moment let’s admire the clarity of the call.