PostUpdate, gets Invalide Credential, Android

41 views
Skip to first unread message

dhjapan

unread,
Aug 20, 2010, 9:10:48 AM8/20/10
to Twitxr API developers
Hi,
I'm working on an Android application for Android,
API methodes like getFriendsTimeline, works fine so I guess
authentication works fine,
but I got trouble with postUpdate. Here's My code :

HttpClient httpclient = new DefaultHttpClient();
HttpPost httppost = new HttpPost("http://" + user_login + ":" +
md5(user_password) + "@twitxr.com/api/rest/postUpdate");

try
{
// add vars to the request
List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>();
nameValuePairs.add(new BasicNameValuePair("place", place));
nameValuePairs.add(new BasicNameValuePair("text", text));
httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
//
HttpResponse response = httpclient.execute(httppost);
...
}

catch (ClientProtocolException e)
{
// TODO Auto-generated catch block
}

catch (IOException e)
{
// TODO Auto-generated catch block
}


All I can get is "Invalid Credentials" .. What could be the problem
here?

Thanks a lot.

fonlabs

unread,
Aug 24, 2010, 6:36:41 AM8/24/10
to Twitxr API developers
Have you tried to make a test page where you can see on screen if your
post call is sending correct information?

If you try this and everything seems ok, check again your user and
password.

If that's ok too, post here a message and we will see what can be
happening.

dhjapan

unread,
Aug 25, 2010, 7:54:35 AM8/25/10
to Twitxr API developers
Hi,
thanks for your help.

authentication look all right as it works with the getFriendsTimeline
method.
I've created a test page to display my post vars (print_r($_POST);),
here's what it returns :

Array
(
[latitude] => -10
[longitude] => 10
[text] => Message test
)

witch should be enough to post a pictureless message.

now I have no idea what else I could test.

Thanks again for your help.

Leon

dhjapan

unread,
Aug 24, 2010, 8:43:53 AM8/24/10
to Twitxr API developers
Hi,
thanks for your answer,
I made a test page to display the post request and it returns :

Array(
[place] => Paris, France
[text] => Message test
)

so I guess the post vars are ok for a non pictured post,
I also tried sending "latitude" and "longitude" instead of "place" :

nameValuePairs.add(new BasicNameValuePair("latitude", "-10"));
nameValuePairs.add(new BasicNameValuePair("longitude", "10"));

but it doesn't works either.

The user/password works are good as it works fine for the
getFriendsTimeline method that needs authentication, the script is the
same.


Thanks for your help.

Leon.


On 24 août, 12:36, fonlabs <fonl...@blogestudio.com> wrote:

fonlabs

unread,
Aug 27, 2010, 4:43:31 AM8/27/10
to Twitxr API developers
Hi,

It's odd, because I'm testing calls to Twitxr API with several
combinations and everything seems to work fine.

Just to isolate the problem, you can try to make a dumb test using
php, so we can verify that you can post from your machine. You can use
this code:


<?php

$user = "YOURUSER";
$password = md5("YOURPASSWORD");

$action = "http://" . $user . ":" . $password . "@twitxr.com/api/rest/
postUpdate";

?>
<html>
Test Form:<br>
<form action="<?=$action?>" method="post">
<input type="text" name="place" value="MY PLACE"/>
<input type="text" name="text" value="MY TEXT"/>
<input type="text" name="latitude" value="39"/>
<input type="text" name="longitude" value="1"/>
<input type="submit" name="postupd" value="Send" />
</form>
</html>


Try this and post here the result so we can figure out what's going
on.
Reply all
Reply to author
Forward
0 new messages