Wednesday, June 20, 2007

Getting Started with the Facebook Platform API

In this three-part tutorial you'll learn how to:
  • Add the Developer Application to your Facebook account
  • Setup Java Client Library in Eclipse IDE
  • Use the Facebook Platform API


1. This screencast shows how to create a Facebook Platform application that you can use as a template for your own Facebook applications.(03:35):

2. In order for a Facebook API client to use the API, the user of the client application must be logged in to Facebook. This screencast describes typical scenarios using a simple Java Servlet. (04:15):

3. This screencast tutorial shows how to use the Facebook Platform API in an example that uses data about logged Facebook user and his friends. (03:25):

For this tutorial we have used materials from:

1): Facebook Developers Documentation
2): blogs.claritycon.com

Recommended books:
Eclipse Web Tools Platform: Developing Java(TM) Web Applications Core Servlets and JavaServer Pages, Vol. 1 Core Servlets and Javaserver Pages: Core Technologies, Vol. 2

If you are interested in more Facebook platform screencasts, please leave a comment.

32 comments:

Anonymous said...

very nice, and really helpful.

Anonymous said...

A very functional Application found at Facebook. It was created by CNET Networks.

Facebook Link:
http://mytech.cnet.com

Blog post
http://clientside.cnet.com/uncategorized/cnet-api-uses-new-facebook-application/

Anonymous said...

Wicked, can we have some more like this. Maybe showing how to send application to friends, or giving examples like the zombie application

Anonymous said...

It's just wonderful. I've followed this and made a simple application successfully. Thanks

Anonymous said...

Thank you. That was very helpful. It was a great facebook and eclipse lesson.

Matt said...

In the last example, the code that displays the number of friends for the logged in user is incorrect. Check out tip #4 on this site to correct it:

http://javablog.co.uk/2007/07/25/tips-for-writing-facebook-applications-in-java/

Anonymous said...

Very Nice - keep em coming - would like a demo showing how to create all the different components of a facebook app with java!

Md. Afzalur said...

This is a great tutorial. It has everything to start with. Near future please do the same for struts application. I am also planning to be beside you soon.

Thanks & Regards,
Md. Afzalur Rashid

Anonymous said...

very nice application check my blog for struts http://blog.strutsland.info

Anonymous said...

Awesome tutorial. The Struts idea is a good one or if you could give an example of a Facebook app that runs right in Facebook

Md. Afzalur said...

Dear Friends,
I am working with struts Facebook application. Hope can share my knowledge with you soon. I need places to upload my application which supports java application. Can any one hel me regarding java webhosting.
Thanks& Regards,
Md. Afzalur Rashid
afzal_01@yahoo.com

diibanez said...

You can try with eatj.com.

They provide you free java hosting and a MySql instance to do some initial testing.

Anonymous said...

This is a great jumpstart.
IMHO, there should be a link to this in Facebook developer Resources.

Thanks

AmitKumar Agrawal said...

Kudos for your great work....Really this is great screencast... I was looking for it. It will be very helpful if you can send more functional application to me or can post somewhere. Please update me (amitpagrawal@gmail.com) .


Thanks & Regards
Amit

thescreencast.com said...

Thanks! Another Facebook screencast is in pipeline. Stay tuned!

Matt said...

I was getting a problem because of the version number, not really sure why.

I got the error message "invalid API Key" so i changed the last line to...

response.sendRedirect("http://www.facebook.com/login.php?api_key=" + apiKey);

(but i wouldn't trust me because i still haven't got it working...!)

Anonymous said...

I keep getting an javax.servlet.ServletException: org/apache/commons/el/ExpressionEvaluatorImpl exception from the line:

request.getRequestDispatcher("info.jsp").forward(request, response);

anyone got any ideas why?

cheers

Chris said...

Excellent stuff. Well done.
I would love to see a more functional example of implementing Facebook components, e.g. invite friends etc.
This would be extremely beneficial to those starting out.

Farhan Thawar said...

Good stuff... thanks

Amarsh said...

Great work. Facebook itself is extremely limited in its documentation.
An interesting open source project to wrap the Facebook API to a more meanigful one is at http://code.google.com/p/facebook-java-api/

Yagiz said...

Excellent work! Thanks a lot!

dara_masala said...

Great tutorial.
Thanks!

Anonymous said...

Hi Guys i am trying out this example.

facebookRestClient = new FacebookRestClient(apiKey, secretKey, sessionKey);

i am getting an error
"cannot instantiate the type FacebookRestClient" for the above instantiation statement.

can somebody help me on this.

Thanks

Anonymous said...

Its very good tutorial.

koteswara said...

Hi

facebookRestClient has to be replaced with facebookXmlRestClient otherwise it will show an error message "facebookRestClient cannot be instantiated".

Anonymous said...

Thanks a lot, I was finally able to get started using the Facebook platform thanks to these great tutorial.

Keep up the good work.

Arun said...

Hi,

The post is excellent. Could you point me to links on how to integrate a facebook application into a web page. I heard that they recently made a java client library available to do that.

ihvan said...

ty for this trutorial. it is what i was looking for.

_______
www.ihwan.org

Lasantha said...

excellent! that's all i could say.

Anonymous said...

Excellent work .. good way to demonstrate and explain facebook applications

Anonymous said...

hi, I'm new to facebook. Ur sample helped me to just try but the API u have used is no longer supported by facebook.

How to do it in facebook Connect?

AH said...

Excellent series. You may want to update it with FaceBook Connect. Great job. Thanks for sharing it with us.