Posting to

I’m very new to spark and I need to know how to send a post to Im confused about the syntax for the tcpclient. Im using a REST client in google chrome to post temperature readings and the URL is{temperature:77}&apikey=MyAPIKey whichs works great from the browser.

I see that there is a TCPclient built in to the spark core but cant figure out what the format is. There were many posts relating to this but have so much difference in the code.

Please help.

Hi @aced1979,

Good question! There’s a great thread here where a bunch of community members are building a Http Client library. We’re working out some bugs, but that would be a great place to start! :slight_smile:


Using this Http Client in WEB IDE leads to 8RED code death for me immediately after cloud connect
Local toolchain build works fine
I have no idea why this fails in WEB

You are probably not up to date with your local toolchain? Can you see what the last commit date is with git log?

I’ve pulled local toolchaing git repositories yesterday

commit 5dfb7bf9ad34e3492098237abe5a76f0c4c007f0
Merge: 82a5028 691bdd0
Author: Zachary Crockett <>
Date:   Wed Jun 11 10:50:52 2014 -0500

    Merge pull request #222 from spark/ram-optimization/newlib-nano-option

    Ram optimization/newlib nano option

Oh, well I didn’t think of that… now you are closer to v0.2.3 which fixes RAM bloat, web IDE is still on v0.2.2

Problem is Http Client is pretty small. I can’t see why it should fail memory imediatelly after core starts even on low memory. This is a good chance to investigate while it is reproducable.

It’s because you are instantiating a TCP Client which had a decent size buffer. Then your code that uses your library probably declares another buffer. Pretty soon you are all out of RAM :smile:

It is not pretty soon, it is imediately. TCPClient client.connect is either failing either not even reached. How much RAM is availbe in WEB Ide on 0.2.2? less 1Kb?

Thanks everyone.

I guess I have some more reading to do about the library. And thanks also for letting me know about the errors the client can cause.

Honestly I’m probably not the best person to ask for that detailed answer… maybe @peekay123 or @satishgn can give you a more finite answer :wink:

I’m not an expert but I did my best when writing HttpClient to keep RAM usage low. However, it has a fairly large buffer by default — it’s 1K — which is because most people seemed to download a lot of data (webpages and such). If you are just using a REST API, chances are you can decrease the buffer a lot in size and free up some memory.

There are at least a couple dozen people that have reached out to me for different reasons after using the library, so I’m assuming more than that get by, and most don’t seem to have many issues.