Simplest API Call For Micro Controller

An iPhone client for Growl available on the App Store.
Posts: 2
Joined: Wed Jun 18, 2014 6:29 pm

Simplest API Call For Micro Controller

Postby rickpbush » Wed Jun 18, 2014 6:44 pm

Hi there, I would like to use the Prowl Api from a micro controller. I have an Arduino and also a Spark Core.

Ultimately, I need to make the request from the spark core but seeing as there is a library for doing this from an Arduino I thought hey ho I'll give it a go on the Arduino and if I can get it working on there then I'll port it over to the Spark Core, after all, it's just an API call using a tcp client right? WRONG.

I loaded the sketch onto my Arduino with my cheap Chinese Ethernet adapter connected only to find the Prowl arduino library for some reason implements its own client which relies on the fact you have an ethernet shield attatched so I got nowhere with that. Fine, I thought I'd see if I could edit the library to work with my ethernet library, oh dear, wrong again, instead of just piping the request through a generic connection it seems to rely on custom code and lots of it, too much for me to get my head around anyway.

If I am to use the API and code it for a platform/hardware not covered by the available libraries then I'd really like a high level tutorial of how to use the API to make calls preferably with plain text http headers as examples of what I need to send.

So, what I'm looking for is either an explaination if I'm mising the point (or loosing the plot) or ultimately what I'd really like is an example of the http header including parameters so that I can write a quick and dirty function that uses a tcp client/stream to send a request.

If anyone has the knowledge to point me in the right direction I sure would appretiate it as I'm getting no where fast with my efforts.

Thanks guys anf girls, Rick.

Posts: 2
Joined: Wed Jun 18, 2014 6:29 pm

Re: Simplest API Call For Micro Controller

Postby rickpbush » Thu Jun 19, 2014 5:54 pm

Ok, anyone esle wanting to do this it really is as simple as I thought it should be :

for the spark core do this :

Code: Select all

TCPClient client;
if (client.connect("", 80))
        Serial.println(F("Command connected"));
        client.write("POST HTTP/1.1\r\nHost:\r\nContent Type: application/x-www-form-urlencoded\r\n\r\n");

and for the arduino do the same but use a tcp client object of your choice.

Return to “Prowl”

Who is online

Users browsing this forum: No registered users