HTTP/1.1 500 Internal Server Error

28 views
Skip to first unread message

Meik Mense

unread,
Oct 24, 2010, 12:20:47 PM10/24/10
to SuperTweet MyAPI Proxy
Hi!

I am working on way to connect a Botanicalls to twitter. I think Jan-
Willem had a similar problem but I don't quiet get how he solved the
problem:

http://groups.google.com/group/supertweet-myapi-proxy/browse_thread/thread/7bb927808380f93d/82d0c1d005ab9a14?lnk=gst&q=botanicalls#82d0c1d005ab9a14

I think I am coming closer but why do I get an Internal Server Error?
This is what Arduinos serial monitor gives me:


Botanicalls v2.15

moist: 0
Reset OK!

Read: 43Connected...

[username:password deleted]
POST /1/statuses/update.xml HTTP/1.1

Host: api.supertweet.netAuthorization: Basic [username:password
deleted]
Content-Length: 28

status=Current Moisture: 0%.
HTTP/1.1 500 Internal Server Error
Connection: close
Server: Jetty(6.1.20)

D
Disconnected...

tweet fail


If there's anyone who has a clue what to do in this case, I would be
very glad if you could help me.
Thanks in advance,
Regards
Meik

Mr Blog

unread,
Oct 24, 2010, 3:00:19 PM10/24/10
to SuperTweet MyAPI Proxy
Ensure that you are sending the proper content-type header:

Content-Type: application/x-www-form-urlencoded

On Oct 24, 9:20 am, Meik Mense <meikme...@gmx.de> wrote:
> Hi!
>
> I am working on way to connect a Botanicalls to twitter. I think Jan-
> Willem had a similar problem but I don't quiet get how he solved the
> problem:
>
> http://groups.google.com/group/supertweet-myapi-proxy/browse_thread/t...

Meik Mense

unread,
Oct 24, 2010, 3:09:45 PM10/24/10
to SuperTweet MyAPI Proxy
I think it works now. The supertweet api is a little huffy, it wants
each information in a unique line. Regarding this, everything works
fine.

Jacob Bockelmann

unread,
Oct 24, 2010, 3:52:39 PM10/24/10
to supertweet-...@googlegroups.com
Interesting. That might be the key to my project. Can you post your
code concerning the post function?

Thanks,
Jacob

Sent from my iPhone

> --
> You received this message because you are subscribed to the Google Groups "SuperTweet MyAPI Proxy" group.
> To post to this group, send email to supertweet-...@googlegroups.com.
> To unsubscribe from this group, send email to supertweet-myapi-...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/supertweet-myapi-proxy?hl=en.
>

Meik Mense

unread,
Oct 24, 2010, 5:12:44 PM10/24/10
to SuperTweet MyAPI Proxy
Hi Jacob.
Yes, sure.

It's a modified snipped from the Botanicalls project based on Arduino:
http://www.botanicalls.com/

The original code can be downloaded here:
http://www.botanicalls.com/code/BotanicallsTwitter_v2.15.zip

Further information concerning arduino can be found here:
http://www.arduino.cc



As you can see, I hardcoded the Supertweet api adress as host and
added the right content type (thanks Mr Blog). In comparison to the
original (check "twitter.pde") I added a "_nl" fragment to several
putstring commands.


// send the HTTP command, ie "GET /username/"
putstringSS("POST ");
putstringSS(HTTPPATH);
putstringSS_nl(" HTTP/1.1");
putstring("POST ");
putstring(HTTPPATH);
putstring_nl(" HTTP/1.1");
// next, the authentication
//putstringSS("Host: ");
//putstringSS_nl(IPADDR);
//putstring("Host: ");
//putstring_nl(IPADDR);
putstringSS_nl("Host: api.supertweet.net");
putstring_nl("Host: api.supertweet.net");
putstringSS("Authorization: Basic ");
putstring("Authorization: Basic ");
mySerial.println(linebuffer);
Serial.println(linebuffer);
putstringSS_nl("Content-Type: application/x-www-form-urlencoded");
putstring_nl("Content-Type: application/x-www-form-urlencoded");
putstringSS("Content-Length: ");
mySerial.println(7+strlen(tweet), DEC);
putstring("Content-Length: ");
Serial.println(7+strlen(tweet), DEC);
putstringSS("\nstatus=");
mySerial.println(tweet);
putstring("\nstatus=");
Serial.println(tweet);


"_nl" stands for "new line" I assume. however, the effect was that
every information is printed in it's own line like with a "println"
command. Mr. Blog posted code in this discussion which gave me the
idea:
http://groups.google.com/group/supertweet-myapi-proxy/browse_thread/thread/7bb927808380f93d/82d0c1d005ab9a14?hl=en&lnk=gst&q=botanicalls#82d0c1d005ab9a14

As a result I get this from the Arduino serial monitor:

Reset OK!
Read: 43Connected...
[secret]
POST /1/statuses/update.xml HTTP/1.1
Host: api.supertweet.net
Authorization: Basic [secret]
Content-Type: application/x-www-form-urlencoded
Content-Length: 30

status=Current Moisture: 79%25
HTTP/1.1 200 OK
Date: Sun, 24 Oct 2010 21:05:24 GMT
Content-Type: text/xml; charset=ISO-8859-1
Date: Sun, 24 Oct 2010 21:05:25 GMT
Vary: Accept-Charset, Accept-Encoding, Accept-Language, Accept
Accept-Ranges: bytes
Server: Restlet-Framework/2.0snapshot
Content-Length: 2204


The tweet is sent proper, everything works well. Supertweet is really
a nice peace of help – otherwise my Botanicall would be dead as I am
not able to write an OAuth-method in Arduino by myself.

I hope that this is going to help you a little...

Cheers
Meik






On Oct 24, 9:52 pm, Jacob Bockelmann <bockelmann.ja...@gmail.com>
wrote:
> Interesting.  That might be the key to my project.  Can you post your
> code concerning the post function?
>
> Thanks,
> Jacob
>
> Sent from my iPhone
>

Meik Mense

unread,
Oct 24, 2010, 5:13:07 PM10/24/10
to SuperTweet MyAPI Proxy
> Interesting.  That might be the key to my project.  Can you post your
> code concerning the post function?
>
> Thanks,
> Jacob
>
> Sent from my iPhone
>

Mr Blog

unread,
Oct 24, 2010, 6:27:29 PM10/24/10
to SuperTweet MyAPI Proxy

Cool, I'm glad it's working. FWIW, I believe the requirement for
newlines there is one of the http protocol, not supertweet.net
specifically. That code without the without the newlines should not
work on any http protocol compliant server.
> idea:http://groups.google.com/group/supertweet-myapi-proxy/browse_thread/t...
Reply all
Reply to author
Forward
0 new messages