[twitter-dev] Twitter status update with Basic Auth Lua
Hi guys, I'm using a desktop platform with a Lua scripting environment. The app I'm making is standalone and does not run in a browser. It can connect to http resources. I'm trying out a simple test to update a status but web services isn't a strong point of mine. I'm following Basic Auth for now and looking to implement OAuth later. The problem I'm having seems to be waiting for the xml response from https://twitter.com/statuses/update.xml I've url encoded my status message and am requesting a https resource similar to https://twitter.com/statuses/update.xml?status=; .. url_encoded_msg I've created post data object setting type to application/x-www-form- urlencoded and added the following key/values to the post data Postdata.addValue(X-Twitter-Client, me) Postdata.addValue(X-Twitter-Client-Version, 1.0 ) Postdata.addValue(X-Twitter-Client-URL, www.my_url.com) and finally Postdata.addValue( Authorization, authValue) where authValue is the string Basic .. Base64.Encode (username:password) I then send this off to twitter url https://twitter.com/statuses/update.xml?status=; .. url_encoded_msg with the postdata. However my code ends up in a loop waiting for the xml response and eventually timing out. I'd like to know if I've got the right steps and values for PostData. thanks
Re: [twitter-dev] Twitter status update with Basic Auth Lua
Your basic auth value should be in a header not the post body. The other X- values I think also go into headers, but I don't provide those really so not sure. I'm not even sure if twitter pays attention to those. Josh On Tue, Dec 1, 2009 at 9:25 AM, Prometheus3k prometheu...@gmail.com wrote: Hi guys, I'm using a desktop platform with a Lua scripting environment. The app I'm making is standalone and does not run in a browser. It can connect to http resources. I'm trying out a simple test to update a status but web services isn't a strong point of mine. I'm following Basic Auth for now and looking to implement OAuth later. The problem I'm having seems to be waiting for the xml response from https://twitter.com/statuses/update.xml I've url encoded my status message and am requesting a https resource similar to https://twitter.com/statuses/update.xml?status=; .. url_encoded_msg I've created post data object setting type to application/x-www-form- urlencoded and added the following key/values to the post data Postdata.addValue(X-Twitter-Client, me) Postdata.addValue(X-Twitter-Client-Version, 1.0 ) Postdata.addValue(X-Twitter-Client-URL, www.my_url.com) and finally Postdata.addValue( Authorization, authValue) where authValue is the string Basic .. Base64.Encode (username:password) I then send this off to twitter url https://twitter.com/statuses/update.xml?status=; .. url_encoded_msg with the postdata. However my code ends up in a loop waiting for the xml response and eventually timing out. I'd like to know if I've got the right steps and values for PostData. thanks
Re: [twitter-dev] Twitter status update with Basic Auth Lua
Correct on the headers... Also note that if you're making a post, you don't want status=... in the query string, you want it added to the body of the request. Are you using a specific Lua HTTP library? ---Mark On Tue, Dec 1, 2009 at 8:45 AM, Josh Roesslein jroessl...@gmail.com wrote: Your basic auth value should be in a header not the post body. The other X- values I think also go into headers, but I don't provide those really so not sure. I'm not even sure if twitter pays attention to those. Josh On Tue, Dec 1, 2009 at 9:25 AM, Prometheus3k prometheu...@gmail.com wrote: Hi guys, I'm using a desktop platform with a Lua scripting environment. The app I'm making is standalone and does not run in a browser. It can connect to http resources. I'm trying out a simple test to update a status but web services isn't a strong point of mine. I'm following Basic Auth for now and looking to implement OAuth later. The problem I'm having seems to be waiting for the xml response from https://twitter.com/statuses/update.xml I've url encoded my status message and am requesting a https resource similar to https://twitter.com/statuses/update.xml?status=; .. url_encoded_msg I've created post data object setting type to application/x-www-form- urlencoded and added the following key/values to the post data Postdata.addValue(X-Twitter-Client, me) Postdata.addValue(X-Twitter-Client-Version, 1.0 ) Postdata.addValue(X-Twitter-Client-URL, www.my_url.com) and finally Postdata.addValue( Authorization, authValue) where authValue is the string Basic .. Base64.Encode (username:password) I then send this off to twitter url https://twitter.com/statuses/update.xml?status=; .. url_encoded_msg with the postdata. However my code ends up in a loop waiting for the xml response and eventually timing out. I'd like to know if I've got the right steps and values for PostData. thanks -- ---Mark http://twitter.com/mccv