We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
Page Index Toggle Pages: 1
API's. (Read 1236 times)
API's.
Jan 12th, 2010, 10:08am
 
I am interested in finding out how and what I can do using API's with processing. Is there a really basic API somewhere online that would be a good starting point?

Cheers, L.
Re: API's.
Reply #1 - Jan 12th, 2010, 12:08pm
 
what are you looking for? API means "Application Programming Interface" so it actually could be a lot, helping you to access services and platforms easier. There exist some for flickr, facebook, twitter, yahoo, geo services, weather, stock exchange data... and much much more. so the question is what  do you want to do and then see if and how this could be achieved.
Re: API's.
Reply #2 - Jan 12th, 2010, 12:09pm
 
Do you mean API as Application Programming Interface
Perhaps you mean libraries In that case, you have some explanations in Libraries and on most pages hosting the libraries.
Otherwise, perhaps you need to reformulate your request.
Re: API's.
Reply #3 - Jan 13th, 2010, 12:55pm
 
Hmm, a little vague I admit! I'm interested in pulling together a few different bits of data that are relevant to my physical location e.g. weather/temperature from metCheck or similar, hopefully so I can combine them with some GPS logging and make myself a 'live map' of where I am.
BUT, I haven't used an API very much, so i'm looking for the simplest to work with for now really so I can get up to speed before trying to build my map! Thanks!
Re: API's.
Reply #4 - Jan 14th, 2010, 3:16am
 
I think what you are looking for is a way to read a webservice. A webservice is data packed in XML. Webcheck has a webservice, but it's commercial. There are others for free, depending on where you are.

To read a webservice, just call its URL. You will then get XML back, that you can parse with the XMLElement Object


So here's a concrete example (using Googles ubiquitous services for everything).

Call http://www.google.co.uk/ig/api?weather=London

The answer will be something like:

Code:

<?xml version="1.0"?>
<xml_api_reply version="1">
 <weather module_id="0" tab_id="0" mobile_row="0" mobile_zipped="1" row="0" section="0" >
   <forecast_information>
   .....
   </forecast_information>
   <current_conditions>
     <condition data="Drizzle"/>
     <temp_f data="37"/>
     <temp_c data="3"/>
     <humidity data="Humidity: 93%"/>
     <icon data="/ig/images/weather/rain.gif"/>
     <wind_condition data="Wind: NE at 5 mph"/>
   </current_conditions>
   <forecast_conditions>
   <day_of_week data="Thu"/>
   .......
   </forecast_conditions>
   </weather>
</xml_api_reply>


Webservices may have a limit to the number of calls you can do in a day. So for testing, just save the response in a file and parse the file, like in the XMLElement Object example.
Re: API's.
Reply #5 - Jan 15th, 2010, 8:24am
 
Ah! very useful Alvaro!

That seems like a possible way to approach this thanks, one thing though - by repeatedly calling the xml (in draw() for example), will the returned results change in 'real time' in a way that would enable me to keep reading different values across the day etc?
Page Index Toggle Pages: 1