Jan 5, 2010

Twitter API ME: New Year, New Version.

Hi all,

First of all, I would like to wish everybody a happy New Year. A 2010 full of health and achievements for all of us.

Besides the greetings, today I am here to announce the launch of Twitter API ME 1.1. Finally I have concluded this version. It took more time that I had planned, because I had to do some changes on certain parts of the API, in order to accommodate the new features. So, the version is already available in the website www.twitterapime.com in the section "Downloads\releases".

The new features from this new version are:
  • Tweet Posting (main one)
  • User authentication
  • Rate Limit Status access
  • Android 1.1 support for all the features
  • Some bug fixes and optimizations
For sure, the main new feature is Tweet Posting. Without posting tweets, Twitter does not make much sense, isn't it? So that's why we focused on providing this feature ASAP. See bellow how easy is to post a tweet from Twitter API ME 1.1:

Credential c = new Credential("username", "password");
UserAccountManager uam = UserAccountManager.getInstance(c);
if (uam.verifyCredential()) {
 TweetER ter = TweetER.getInstance(uam);
 Tweet t = ter.post(new Tweet("status message"));
}


That's all!!! Easy, isn't it?

Another important news from version 1.1 is the full support on Android 1.1. Now, you can also work with Twitter API ME on your Android applications.

To ensure the quality of the API, some unit tests have been implemented to ensure that no bug comes up after any change. Currently, we have 91 test cases covering 69% of the code. The objective for the next version is to increase this percentage as much as possible.

I hope to publish a new version of Sparrow application ASAP, so you guys can have a reference application.

So, give this new version a shot and download it now.

See you in the next post...

15 comments:

sam said...

hi Ernandes,
will these api works for blackberry device?

i am trying to do same application on blackberry.

thanks in advance

Ernandes Mourão Júnior said...

Hi Sam,

This API is fully compliant to Java ME CLDC 1.0 and MIDP 2.0. I believe this the minimum environment supported by current BB devices. This way, you are good to go! Otherwise, let me know, OK?

Regards,
Ernandes

Unknown said...

Thanks !!

But I will Ask If I want To show the Last Tweets Of Some one How I can Do this

Anonymous said...

Hi wondering if some could help me when I try running the sample code for posting a tweet I get null pointer exception when executing uam.verifyCredential(). Does anyone know what may be causing this. I get the error when running the code in netbeans and on the phone

Ernandes Mourão Júnior said...

Hi elkady,

To retrieve the last tweets from someone is very simple. You just need to specify, in the search query, the filters of your search, using the classes Query and QueryComposer. In this case, you have to enter the username, which tweets, you want to obtain. For instance:

...
SearchDevice s = SearchDevice.getInstance();
Query q = QueryComposer.from("ernandesmjr");
Tweet[] tweetsFromUser = s.searchTweets(q);
...

Please, take a look at the other methods of QueryComposer class and you will get a better understand of everything you can do.

Anything else, let me know.

Regards,

Ernandes Mourão Júnior said...

Hi Anonymous :)

Please, post your code so I can see what may be causing this error.

Regards,

Anonymous said...

my code is essentially the same as the sample code given. The only thing i changed was the arguments passed to the Credential Constructor which i have left as "username" and "password" below as i do not wish to post my twitter login details

try {
Credential c = new Credential("username", "password");
UserAccountManager uam = UserAccountManager.getInstance(c);
if (uam.verifyCredential()) {
TweetER ter = TweetER.getInstance(uam);
Tweet t = ter.post(new Tweet("#SavvyShopping Test Post successful"));
}
else {
Application.showWarning("Post Failed");
}
}
catch(Exception ex){Application.showWarning(ex + " tweet " + ex.getMessage());}

Unknown said...

Hi Ernandes

Thanks For Your Replay this help me a lot but I wanna Ask If I can Get the Home Line Of My Twitter

I need It More

sam said...

Credential c = new Credential("username", "password");
UserAccountManager uam = UserAccountManager.getInstance(c);
if (uam.verifyCredential())


i used above code for Black Berry appliaction to do the login But i always get the 401 ( UnAuthorized ) as response code from HTTP response.

Is there any changes i need to do for Blackberry connection to existing connection code?

Ernandes Mourão Júnior said...

Hi Anonymous,

Let's have this discussion on project's forum, OK? I believe that is a better off place for kind of talk.

Follow the forum's link:

http://kenai.com/projects/twitterapime/forums/forum/topics/2701-NullPointerException-when-invoking-verifyCredential-

Thanks!

Regards,
Ernandes

Ernandes Mourão Júnior said...

Hi elkady,

Unfortunately, this feature is not implemented yet. However, it is planned for the next version. Stay tuned! In the meanwhile, you can hard-code the list of your friends and then get the tweets from them. It is just a temporary workaround.

Regards,
Ernandes

p.s: For further doubts, let's try to use the project's forum, OK? I appreciate. :)

http://kenai.com/projects/twitterapime/forums/forum

Ernandes Mourão Júnior said...

Hi Sam,

Refer the topic on our forum:

http://kenai.com/projects/twitterapime/forums/forum/topics/2702-HTTP-401-when-verifying-credential-on-BlackBerry-

Regards,
Ernandes

sam said...

I saw this on Twitter Website and your api is doing basic Authentication

Twitter's support of HTTP Basic Authentication (the standard way to authenticate over the web with a username and password) will be deprecated. Please use OAuth.

Do we need to use OAuth ?

Also on forum i can not reply to your post so i have again posted my query to this blog only.

Anonymous said...

Hi i also could not post on the forum so im replaying here. After using the source code files i was able to get it working using the netbeans emulator. The problem was that kXML parser was missing and

Parser parser = ParserFactory.getDefaultParser();

would return null. I added the kXML parser and the code works and posted a tweet when using the netbeans emulator. However when using the Sony Ericsson Emulator or my Sony Ericsson phone i sill get a NullPointerException. However this time an error occurs when calling

HttpConnection conn = getHttpConn(TWITTER_URL_VERIFY_CREDENTIALS, credential);

in the verifyCredential() method. After tracing i tracked the problem down to the newInstance(String className) method in
the HTTPConnectorClass. When executing

return (HttpConnection)Class.forName(className).newInstance();

ClassNotFoundException is thrown and then as a result the method returns null and then eventually when the code attempts to use the conn NullPointer is thrown. I am unsure why ClassNotFoundException is thrown when using Sony Ericsson SDK but not when using the standard SDK with netbeans

Printing out the exception gives the following

java.lang.ClassNotFoundException: impl/javame/com/twitterapime/io/HttpConnectionImpl

Ernandes Mourão Júnior said...

Hi Guys,

Your answers are on our forum: http://kenai.com/projects/twitterapime/forums/forum

To reply the topics, please get registered on Kenai.com, OK? I appreciate!

Regards,