WOW, ever heard about COSM

Category: Blog
Created on Monday, 23 July 2012 18:48
Last Updated on Wednesday, 25 July 2012 12:26
Published on Monday, 23 July 2012 18:48
Written by Lars Christoffersen
Hits: 2608

This is really very very cool. If you want to make some data public, se it graphs, make alarms and events, please have a look at COSM. The Tutorials on the site, uses CURL, but there are API's available in almost any high level language, including C# and JAVA. It is all about making data visible for a brader audience, and this site is made for that. I don't know the limits for data, but I find the concept a great inspiration. You can upload data in xml, csv or JSON. I made this small java extension (before I found the JAVA API) and it works. Be aware, you have to close the connection after every upload, so it is probably not the best solution for high resolution data, But COSM also have a solution for that, using pull instead of push.

private static void putToCosm( String timestamp, String value ){ 
        HttpURLConnection con; 
        OutputStreamWriter writer; 
        try { 
            con = (HttpURLConnection) new URL("").openConnection(); 
            con.addRequestProperty("X-ApiKey","YOUR COSM KEY"); 
            writer = new OutputStreamWriter(con.getOutputStream());
            System.out.println( con.getResponseMessage() ); 

        } catch (MalformedURLException e) { 
            System.out.println( e.toString()); 
        } catch (IOException e) { 
            System.out.println( e.toString());