Search code examples
twittertitaniummessagetweets

Twitter message post in Titanium


I got some code by doing search which is doing a lot for me in showing the my tweets in tableview,till now fine. I want to add one more functionality to it that user can post the message from the sameapp.

So I just modified the code as per. While I hit the request I got result status as successful but message is not posting to my wall. I have all keys and getting access token as well.

 var client = Twitter({
      consumerKey: "have Key ",
      consumerSecret: "have Key",
      accessTokenKey: accessTokenKey, 
      accessTokenSecret: accessTokenSecret
    });


client.request("1/statuses/update.json", {status:'TEST'}, 'GET', function(e) {
              if (e.success) {alert(e.success);

          } else  {
            alert(e.error);
          }

Updated: I have go through the Twitter Dev API This is the URL http://api.twitter.com/1/statuses/update.format with required parameter "status". What am I doing wrong?


Solution

  • You are sending GET request to update status whereas twitter api needs it to be a POST request.

    Try something like

    client.request( "1/statuses/update.json", {status:'TEST'}, 'POST', function(e) {
              if (e.success)
              {
                 alert(e.success);
              } else  {
                 alert(e.error);
              }