Hi Scott,
That encodedPostData data looks like Bas64 encoding. x-www-form-
urlencoded should be URL encoded only (which postData is, since it has
no spaces or other characters). As for the Content-Type and Content-
Length you're seeing, I believe those are the return headers and they
seem correct.
Thanks;
— Matt / @mzsanford
On Dec 16, 12:28 pm, "Scott Birksted" <[email protected]>
wrote:
> Ya this is very odd.
>
> I set the request props in the header:
> httpConn.setRequestProperty("Content-Type","application/x-www-form-urlencod
> ed");
> httpConn.setRequestProperty( "Content-Length",
> ""+encodedPostData.getBytes().length);
>
> postData: status=testing
> encodedPostData = c3RhdHVzPXRlc3Rpbmc=
> encodedPostData len = 22
>
> then write the encodedData to the output stream.
>
> Checking the header details after that I see:
> Content-Type : application/xml; charset=utf-8
> Content-Length : 168
>
> looks like some ghost in the (java) machine, I don't know why the headers
> seem incorrect and the content-length isn't being properly set.
>
> <?xml version="1.0" encoding="UTF-8"?>
> <hash>
> <request>/statuses/update.xml</request>
> <error>Client must provide a 'status' parameter with a value.</error>
> </hash>
>
> -Scott
>
> On Tue, Dec 2, 2008 at 4:31 PM, Matt Sanford <[email protected]> wrote:
> > Hello Scott,
> > A few things come to mind. Make sure you're correctly setting the
> > Content-Type header like so:
>
> > Content-Type: application/x-www-form-urlencoded
>
> > and also make sure you URL encod the status text. My first guess would
> > be the URL encoding. If that does not work please try and capture the exact
> > headers/body that you are sending (but be sure to obscure the Authoriztion
> > header).
>
> > Thanks;
> > — Matt Sanford (@mzsanford)
>
> > On Dec 2, 2008, at 11:47 AM, ScottB wrote:
>
> > I keep getting this response to my attempts to post a status update
> > from an app I'm writing.
>
> > <?xml version="1.0" encoding="UTF-8"?>
> > <hash>
> > <request>/statuses/update.xml</request>
> > <error>Client must provide a 'status' parameter with a value.</
> > error>
> > </hash>
>
> > Everything seems totally in order,
>
> > using:
> >http://twitter.com/statuses/update.xml
>
> > I set the content length in the header, then open the HttpConnections
> > outputstream, write the request bytes, flush it, then check the
> > response code to send the request in that order.
>
> > I'm under the impression that the content body of the request should
> > be simply:
>
> > status=*update_content_string_here*
>
> > I've tried testing various different headers, adding the optional
> > "in_reply_to_status_id" as well, but it just gives me that same 403
> > error.
>
> > Any help or verification that the
> >http://twitter.com/statuses/update.xml
> > works for others and that I'm using the correct parameter formatting
> > would be greatly appreciated.
>
> > Thanks